repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/controller_upcall_client.rs
pageserver/src/controller_upcall_client.rs
use std::collections::HashMap; use std::net::IpAddr; use futures::Future; use pageserver_api::config::NodeMetadata; use pageserver_api::controller_api::{AvailabilityZone, NodeRegisterRequest}; use pageserver_api::models::ShardImportStatus; use pageserver_api::shard::TenantShardId; use pageserver_api::upcall_api::{ ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/aux_file.rs
pageserver/src/aux_file.rs
use std::sync::Arc; use ::metrics::IntGauge; use bytes::{Buf, BufMut, Bytes}; use pageserver_api::key::{AUX_KEY_PREFIX, Key, METADATA_KEY_SIZE}; use tracing::warn; // BEGIN Copyright (c) 2017 Servo Contributors /// Const version of FNV hash. #[inline] #[must_use] pub const fn fnv_hash(bytes: &[u8]) -> u128 { con...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/utilization.rs
pageserver/src/utilization.rs
//! An utilization metric which is used to decide on which pageserver to put next tenant. //! //! The metric is exposed via `GET /v1/utilization`. Refer and maintain its openapi spec as the //! truth. use std::path::Path; use anyhow::Context; use pageserver_api::models::PageserverUtilization; use utils::serde_percent...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/feature_resolver.rs
pageserver/src/feature_resolver.rs
use std::{ collections::HashMap, sync::{Arc, atomic::AtomicBool}, time::Duration, }; use arc_swap::ArcSwap; use pageserver_api::config::NodeMetadata; use posthog_client_lite::{ CaptureEvent, FeatureResolverBackgroundLoop, PostHogEvaluationError, PostHogFlagFilterPropertyValue, }; use rand::Rng; use...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/metrics.rs
pageserver/src/metrics.rs
use std::cell::Cell; use std::collections::HashMap; use std::num::NonZeroUsize; use std::os::fd::RawFd; use std::sync::atomic::AtomicU64; use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; use enum_map::{Enum as _, EnumMap}; use futures::Future; use metrics::{ Counter, CounterVec, GaugeVec, Histogram...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/context.rs
pageserver/src/context.rs
//! Defines [`RequestContext`]. //! //! It is a structure that we use throughout the pageserver to propagate //! high-level context from places that _originate_ activity down to the //! shared code paths at the heart of the pageserver. It's inspired by //! Golang's `context.Context`. //! //! For example, in `Timeline::...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file.rs
pageserver/src/virtual_file.rs
//! VirtualFile is like a normal File, but it's not bound directly to //! a file descriptor. //! //! Instead, the file is opened when it's read from, //! and if too many files are open globally in the system, least-recently //! used ones are closed. //! //! To track which files have been recently used, we use the clock...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/page_cache.rs
pageserver/src/page_cache.rs
//! //! Global page cache //! //! The page cache uses up most of the memory in the page server. It is shared //! by all tenants, and it is used to store different kinds of pages. Sharing //! the cache allows memory to be dynamically allocated where it's needed the //! most. //! //! The page cache consists of fixed-size...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/pgdatadir_mapping.rs
pageserver/src/pgdatadir_mapping.rs
//! //! This provides an abstraction to store PostgreSQL relations and other files //! in the key-value store that implements the Repository interface. //! //! (TODO: The line between PUT-functions here and walingest.rs is a bit blurry, as //! walingest.rs handles a few things like implicit relation creation and extens...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/config.rs
pageserver/src/tenant/config.rs
//! Functions for handling per-tenant configuration options //! //! If tenant is created with --config option, //! the tenant-specific config will be stored in tenant's directory. //! Otherwise, global pageserver's config is used. //! //! If the tenant config file is corrupted, the tenant will be disabled. //! We canno...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer.rs
pageserver/src/tenant/storage_layer.rs
//! Common traits and structs for layers pub mod batch_split_writer; pub mod delta_layer; pub mod errors; pub mod filter_iterator; pub mod image_layer; pub mod inmemory_layer; pub(crate) mod layer; mod layer_desc; mod layer_name; pub mod merge_iterator; use std::cmp::Ordering; use std::collections::hash_map::Entry; u...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/throttle.rs
pageserver/src/tenant/throttle.rs
use std::sync::Arc; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::Instant; use arc_swap::ArcSwap; use utils::leaky_bucket::{LeakyBucketConfig, RateLimiter}; /// Throttle for `async` functions. /// /// Runtime reconfigurable. /// /// To share a throttle among multiple entities, wrap it in an [`Arc`]. //...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/tasks.rs
pageserver/src/tenant/tasks.rs
//! This module contains per-tenant background processes, e.g. compaction and GC. use std::cmp::max; use std::future::Future; use std::ops::{ControlFlow, RangeInclusive}; use std::pin::pin; use std::sync::Arc; use std::time::{Duration, Instant}; use once_cell::sync::Lazy; use pageserver_api::config::tenant_conf_defau...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/gc_result.rs
pageserver/src/tenant/gc_result.rs
use std::ops::AddAssign; use std::time::Duration; use anyhow::Result; use serde::Serialize; /// /// Result of performing GC /// #[derive(Default, Serialize, Debug)] pub struct GcResult { pub layers_total: u64, pub layers_needed_by_cutoff: u64, pub layers_needed_by_pitr: u64, pub layers_needed_by_branc...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/mgr.rs
pageserver/src/tenant/mgr.rs
//! This module acts as a switchboard to access different repositories managed by this //! page server. use std::borrow::Cow; use std::cmp::Ordering; use std::collections::{BTreeMap, HashMap, HashSet}; use std::ops::Deref; use std::sync::Arc; use std::time::Duration; use anyhow::Context; use camino::{Utf8DirEntry, Ut...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/remote_timeline_client.rs
pageserver/src/tenant/remote_timeline_client.rs
//! This module manages synchronizing local FS with remote storage. //! //! # Overview //! //! * [`RemoteTimelineClient`] provides functions related to upload/download of a particular timeline. //! It contains a queue of pending uploads, and manages the queue, performing uploads in parallel //! when it's safe to do...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/upload_queue.rs
pageserver/src/tenant/upload_queue.rs
use std::collections::{HashMap, HashSet, VecDeque}; use std::fmt::Debug; use std::sync::Arc; use std::sync::atomic::AtomicU32; use chrono::NaiveDateTime; use once_cell::sync::Lazy; use tracing::info; use utils::generation::Generation; use utils::lsn::{AtomicLsn, Lsn}; use super::remote_timeline_client::is_same_remote...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/disk_btree_test_data.rs
pageserver/src/tenant/disk_btree_test_data.rs
use hex_literal::hex; /// Test data set for the 'particular_data' test in disk_btree.rs /// /// This test contains a particular data set, representing all the keys /// generated by the 'test_random_updates' unit test. I extracted this while /// trying to debug a failure in that test. The bug turned out to be /// elsew...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/checks.rs
pageserver/src/tenant/checks.rs
use std::collections::BTreeSet; use itertools::Itertools; use pageserver_compaction::helpers::overlaps_with; use super::storage_layer::LayerName; /// Checks whether a layer map is valid (i.e., is a valid result of the current compaction algorithm if nothing goes wrong). /// /// The function implements a fast path ch...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/debug.rs
pageserver/src/tenant/debug.rs
use std::{ops::Range, str::FromStr, sync::Arc}; use crate::walredo::RedoAttemptType; use base64::{Engine as _, engine::general_purpose::STANDARD}; use bytes::{Bytes, BytesMut}; use camino::Utf8PathBuf; use clap::Parser; use itertools::Itertools; use pageserver_api::{ key::Key, keyspace::KeySpace, shard::{S...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/layer_map.rs
pageserver/src/tenant/layer_map.rs
//! //! The layer map tracks what layers exist in a timeline. //! //! When the timeline is first accessed, the server lists of all layer files //! in the timelines/<timeline_id> directory, and populates this map with //! ImageLayer and DeltaLayer structs corresponding to each file. When the first //! new WAL record is ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline.rs
pageserver/src/tenant/timeline.rs
pub(crate) mod analysis; pub(crate) mod compaction; pub mod delete; pub(crate) mod detach_ancestor; mod eviction_task; pub(crate) mod handle; mod heatmap_layers_downloader; pub(crate) mod import_pgdata; mod init; pub mod layer_manager; pub(crate) mod logical_size; pub mod offload; pub mod span; pub mod uninit; mod walr...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/block_io.rs
pageserver/src/tenant/block_io.rs
//! //! Low-level Block-oriented I/O functions //! use std::ops::Deref; use super::storage_layer::delta_layer::{Adapter, DeltaLayerInner}; use crate::context::RequestContext; use crate::page_cache::{self, FileId, PAGE_SZ, PageReadGuard, PageWriteGuard, ReadBufResult}; #[cfg(test)] use crate::virtual_file::IoBufferMut...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/blob_io.rs
pageserver/src/tenant/blob_io.rs
//! //! Functions for reading and writing variable-sized "blobs". //! //! Each blob begins with a 1- or 4-byte length field, followed by the //! actual data. If the length is smaller than 128 bytes, the length //! is written as a one byte. If it's larger than that, the length //! is written as a four-byte integer, in b...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/ephemeral_file.rs
pageserver/src/tenant/ephemeral_file.rs
//! Implementation of append-only file data structure //! used to keep in-memory layers spilled on disk. use std::io; use std::sync::Arc; use std::sync::atomic::{AtomicU64, Ordering}; use camino::Utf8PathBuf; use num_traits::Num; use pageserver_api::shard::TenantShardId; use tokio_epoll_uring::{BoundedBuf, Slice}; us...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/disk_btree.rs
pageserver/src/tenant/disk_btree.rs
//! //! Simple on-disk B-tree implementation //! //! This is used as the index structure within image and delta layers //! //! Features: //! - Fixed-width keys //! - Fixed-width values (VALUE_SZ) //! - The tree is created in a bulk operation. Insert/deletion after creation //! is not supported //! - page-oriented //!...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/metadata.rs
pageserver/src/tenant/metadata.rs
//! Describes the legacy now hopefully no longer modified per-timeline metadata. //! //! It is stored in `index_part.json` managed by [`remote_timeline_client`]. For many tenants and //! their timelines, this struct and its original serialization format is still needed because //! they were written a long time ago. //!...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/vectored_blob_io.rs
pageserver/src/tenant/vectored_blob_io.rs
//! //! Utilities for vectored reading of variable-sized "blobs". //! //! The "blob" api is an abstraction on top of the "block" api, //! with the main difference being that blobs do not have a fixed //! size (each blob is prefixed with 1 or 4 byte length field) //! //! The vectored apis provided in this module allow f...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/secondary.rs
pageserver/src/tenant/secondary.rs
mod downloader; pub mod heatmap; mod heatmap_uploader; mod scheduler; use std::sync::Arc; use std::time::SystemTime; use metrics::UIntGauge; use pageserver_api::models; use pageserver_api::shard::{ShardIdentity, TenantShardId}; use remote_storage::GenericRemoteStorage; use tokio::task::JoinHandle; use tokio_util::syn...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/gc_block.rs
pageserver/src/tenant/gc_block.rs
use std::collections::HashMap; use std::sync::Arc; use utils::id::TimelineId; use super::remote_timeline_client::index::GcBlockingReason; type Storage = HashMap<TimelineId, enumset::EnumSet<GcBlockingReason>>; /// GcBlock provides persistent (per-timeline) gc blocking. #[derive(Default)] pub(crate) struct GcBlock {...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/size.rs
pageserver/src/tenant/size.rs
use std::cmp; use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; use std::sync::Arc; use tenant_size_model::svg::SvgBranchKind; use tenant_size_model::{Segment, StorageModel}; use tokio::sync::Semaphore; use tokio::sync::oneshot::error::RecvError; use tokio_util::sync::CancellationToken; ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/secondary/heatmap_uploader.rs
pageserver/src/tenant/secondary/heatmap_uploader.rs
use std::collections::HashMap; use std::pin::Pin; use std::sync::{Arc, Weak}; use std::time::{Duration, Instant}; use futures::Future; use pageserver_api::shard::TenantShardId; use remote_storage::{GenericRemoteStorage, TimeoutOrCancel}; use tokio_util::sync::CancellationToken; use tracing::{Instrument, info_span, ins...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/secondary/downloader.rs
pageserver/src/tenant/secondary/downloader.rs
use std::collections::{HashMap, HashSet}; use std::pin::Pin; use std::str::FromStr; use std::sync::Arc; use std::time::{Duration, Instant, SystemTime}; use crate::metrics::{STORAGE_IO_SIZE, StorageIoSizeOperation}; use camino::Utf8PathBuf; use chrono::format::{DelayedFormat, StrftimeItems}; use futures::Future; use me...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/secondary/heatmap.rs
pageserver/src/tenant/secondary/heatmap.rs
use std::collections::HashMap; use std::time::SystemTime; use serde::{Deserialize, Serialize}; use serde_with::{DisplayFromStr, TimestampSeconds, serde_as}; use utils::generation::Generation; use utils::id::TimelineId; use crate::tenant::remote_timeline_client::index::LayerFileMetadata; use crate::tenant::storage_lay...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/secondary/scheduler.rs
pageserver/src/tenant/secondary/scheduler.rs
use std::collections::HashMap; use std::marker::PhantomData; use std::pin::Pin; use std::time::{Duration, Instant}; use futures::Future; use pageserver_api::shard::TenantShardId; use rand::Rng; use tokio::task::JoinSet; use tokio_util::sync::CancellationToken; use utils::completion::Barrier; use utils::yielding_loop::...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/errors.rs
pageserver/src/tenant/storage_layer/errors.rs
use crate::tenant::blob_io::WriteBlobError; #[derive(Debug, thiserror::Error)] pub enum PutError { #[error(transparent)] WriteBlob(WriteBlobError), #[error(transparent)] Other(anyhow::Error), } impl PutError { pub fn is_cancel(&self) -> bool { match self { PutError::WriteBlob(e...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/delta_layer.rs
pageserver/src/tenant/storage_layer/delta_layer.rs
//! A DeltaLayer represents a collection of WAL records or page images in a range of //! LSNs, and in a range of Keys. It is stored on a file on disk. //! //! Usually a delta layer only contains differences, in the form of WAL records //! against a base LSN. However, if a relation extended or a whole new relation //! i...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/merge_iterator.rs
pageserver/src/tenant/storage_layer/merge_iterator.rs
use std::cmp::Ordering; use std::collections::{BinaryHeap, binary_heap}; use std::sync::Arc; use anyhow::bail; use pageserver_api::key::Key; use utils::lsn::Lsn; use wal_decoder::models::value::Value; use super::delta_layer::{DeltaLayerInner, DeltaLayerIterator}; use super::image_layer::{ImageLayerInner, ImageLayerIt...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/batch_split_writer.rs
pageserver/src/tenant/storage_layer/batch_split_writer.rs
use std::future::Future; use std::ops::Range; use std::sync::Arc; use bytes::Bytes; use pageserver_api::key::{KEY_SIZE, Key}; use tokio_util::sync::CancellationToken; use utils::id::TimelineId; use utils::lsn::Lsn; use utils::shard::TenantShardId; use wal_decoder::models::value::Value; use super::errors::PutError; us...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/layer.rs
pageserver/src/tenant/storage_layer/layer.rs
use std::ops::Range; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::{Arc, Weak}; use std::time::{Duration, SystemTime}; use crate::PERF_TRACE_TARGET; use crate::metrics::{ONDEMAND_DOWNLOAD_BYTES, ONDEMAND_DOWNLOAD_COUNT}; use anyhow::Context; use camino::{Utf8Path, Utf8PathBuf}; use pageser...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/image_layer.rs
pageserver/src/tenant/storage_layer/image_layer.rs
//! An ImageLayer represents an image or a snapshot of a key-range at //! one particular LSN. //! //! It contains an image of all key-value pairs in its key-range. Any key //! that falls into the image layer's range but does not exist in the layer, //! does not exist. //! //! An image layer is stored in a file on disk....
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/inmemory_layer.rs
pageserver/src/tenant/storage_layer/inmemory_layer.rs
//! An in-memory layer stores recently received key-value pairs. //! //! The "in-memory" part of the name is a bit misleading: the actual page versions are //! held in an ephemeral file, not in memory. The metadata for each page version, i.e. //! its position in the file, is kept in memory, though. //! use std::cmp::Or...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/layer_name.rs
pageserver/src/tenant/storage_layer/layer_name.rs
//! //! Helper functions for dealing with filenames of the image and delta layer files. //! use std::cmp::Ordering; use std::fmt; use std::ops::Range; use std::str::FromStr; use pageserver_api::key::Key; use utils::lsn::Lsn; use super::PersistentLayerDesc; // Note: Timeline::load_layer_map() relies on this sort orde...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/layer_desc.rs
pageserver/src/tenant/storage_layer/layer_desc.rs
use core::fmt::Display; use std::ops::Range; use pageserver_api::key::Key; use pageserver_api::shard::TenantShardId; use serde::{Deserialize, Serialize}; #[cfg(test)] use utils::id::TenantId; use utils::id::TimelineId; use utils::lsn::Lsn; use super::{DeltaLayerName, ImageLayerName, LayerName}; /// A unique identifi...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/filter_iterator.rs
pageserver/src/tenant/storage_layer/filter_iterator.rs
use std::ops::Range; use std::sync::Arc; use anyhow::bail; use pageserver_api::key::Key; use pageserver_api::keyspace::{KeySpace, SparseKeySpace}; use utils::lsn::Lsn; use wal_decoder::models::value::Value; use super::PersistentLayerKey; use super::merge_iterator::{MergeIterator, MergeIteratorItem}; /// A filter ite...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/inmemory_layer/vectored_dio_read.rs
pageserver/src/tenant/storage_layer/inmemory_layer/vectored_dio_read.rs
use std::collections::BTreeMap; use std::sync::{Arc, RwLock}; use itertools::Itertools; use tokio_epoll_uring::{BoundedBuf, IoBufMut, Slice}; use crate::assert_u64_eq_usize::{U64IsUsize, UsizeIsU64}; use crate::context::RequestContext; use crate::virtual_file::IoBufferMut; use crate::virtual_file::owned_buffers_io::i...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/layer/failpoints.rs
pageserver/src/tenant/storage_layer/layer/failpoints.rs
//! failpoints for unit tests, implying `#[cfg(test)]`. //! //! These are not accessible over http. use super::*; impl Layer { /// Enable a failpoint from a unit test. pub(super) fn enable_failpoint(&self, failpoint: Failpoint) { self.0.failpoints.lock().unwrap().push(failpoint); } } impl LayerIn...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/storage_layer/layer/tests.rs
pageserver/src/tenant/storage_layer/layer/tests.rs
use std::time::UNIX_EPOCH; use pageserver_api::key::{CONTROLFILE_KEY, Key}; use postgres_ffi::PgMajorVersion; use tokio::task::JoinSet; use utils::completion::{self, Completion}; use utils::id::TimelineId; use super::failpoints::{Failpoint, FailpointKind}; use super::*; use crate::context::DownloadBehavior; use crate...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/layer_map/historic_layer_coverage.rs
pageserver/src/tenant/layer_map/historic_layer_coverage.rs
use std::collections::BTreeMap; use std::ops::Range; use tracing::info; use super::layer_coverage::LayerCoverageTuple; use crate::tenant::storage_layer::PersistentLayerDesc; /// Layers in this module are identified and indexed by this data. /// /// This is a helper struct to enable sorting layers by lsn.start. /// /...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/layer_map/layer_coverage.rs
pageserver/src/tenant/layer_map/layer_coverage.rs
use std::ops::Range; // NOTE the `im` crate has 20x more downloads and also has // persistent/immutable BTree. But it's bugged so rpds is a // better choice <https://github.com/neondatabase/neon/issues/3395> use rpds::RedBlackTreeMapSync; /// Data structure that can efficiently: /// - find the latest layer by lsn.end...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/remote_timeline_client/download.rs
pageserver/src/tenant/remote_timeline_client/download.rs
//! Helper functions to download files from remote storage with a RemoteStorage //! //! The functions in this module retry failed operations automatically, according //! to the FAILED_DOWNLOAD_RETRIES constant. use std::collections::HashSet; use std::future::Future; use std::str::FromStr; use std::sync::atomic::Atomic...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/remote_timeline_client/index.rs
pageserver/src/tenant/remote_timeline_client/index.rs
//! In-memory index to track the tenant files on the remote storage. //! //! Able to restore itself from the storage index parts, that are located in every timeline's remote directory and contain all data about //! remote timeline layers and its metadata. use std::collections::HashMap; use chrono::NaiveDateTime; use ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/remote_timeline_client/manifest.rs
pageserver/src/tenant/remote_timeline_client/manifest.rs
use chrono::NaiveDateTime; use serde::{Deserialize, Serialize}; use utils::id::TimelineId; use utils::lsn::Lsn; use utils::shard::ShardStripeSize; /// Tenant shard manifest, stored in remote storage. Contains offloaded timelines and other tenant /// shard-wide information that must be persisted in remote storage. /// ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/remote_timeline_client/upload.rs
pageserver/src/tenant/remote_timeline_client/upload.rs
//! Helper functions to upload files to remote storage with a RemoteStorage use std::io::{ErrorKind, SeekFrom}; use std::num::NonZeroU32; use std::time::SystemTime; use anyhow::{Context, bail}; use bytes::Bytes; use camino::Utf8Path; use fail::fail_point; use pageserver_api::shard::TenantShardId; use remote_storage::...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/heatmap_layers_downloader.rs
pageserver/src/tenant/timeline/heatmap_layers_downloader.rs
//! Timeline utility module to hydrate everything from the current heatmap. //! //! Provides utilities to spawn and abort a background task where the downloads happen. //! See /v1/tenant/:tenant_shard_id/timeline/:timeline_id/download_heatmap_layers. use std::sync::{Arc, Mutex}; use futures::StreamExt; use http_utils...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/compaction.rs
pageserver/src/tenant/timeline/compaction.rs
//! New compaction implementation. The algorithm itself is implemented in the //! compaction crate. This file implements the callbacks and structs that allow //! the algorithm to drive the process. //! //! The old legacy algorithm is implemented directly in `timeline.rs`. use std::cmp::min; use std::collections::{Bina...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/walreceiver.rs
pageserver/src/tenant/timeline/walreceiver.rs
//! WAL receiver manages an open connection to safekeeper, to get the WAL it streams into. //! To do so, a current implementation needs to do the following: //! //! * acknowledge the timelines that it needs to stream WAL into. //! Pageserver is able to dynamically (un)load tenants on attach and detach, //! hence WA...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/import_pgdata.rs
pageserver/src/tenant/timeline/import_pgdata.rs
use std::sync::Arc; use anyhow::{Context, bail}; use importbucket_client::{ControlFile, RemoteStorageWrapper}; use pageserver_api::models::ShardImportStatus; use remote_storage::RemotePath; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; use tracing::info; use utils::lsn::Lsn; use utils::pausable...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/analysis.rs
pageserver/src/tenant/timeline/analysis.rs
use std::collections::BTreeSet; use std::ops::Range; use utils::lsn::Lsn; use super::Timeline; use crate::tenant::timeline::layer_manager::LayerManagerLockHolder; #[derive(serde::Serialize)] pub(crate) struct RangeAnalysis { start: String, end: String, has_image: bool, num_of_deltas_above_image: usiz...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/logical_size.rs
pageserver/src/tenant/timeline/logical_size.rs
use std::sync::atomic::{AtomicBool, AtomicI64, Ordering as AtomicOrdering}; use anyhow::Context; use once_cell::sync::OnceCell; use tokio_util::sync::CancellationToken; use utils::lsn::Lsn; /// Internal structure to hold all data needed for logical size calculation. /// /// Calculation consists of two stages: /// ///...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/detach_ancestor.rs
pageserver/src/tenant/timeline/detach_ancestor.rs
use std::collections::HashSet; use std::sync::Arc; use anyhow::Context; use bytes::Bytes; use http_utils::error::ApiError; use pageserver_api::key::Key; use pageserver_api::keyspace::KeySpace; use pageserver_api::models::DetachBehavior; use pageserver_api::models::detach_ancestor::AncestorDetached; use pageserver_api:...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/span.rs
pageserver/src/tenant/timeline/span.rs
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/offload.rs
pageserver/src/tenant/timeline/offload.rs
use std::sync::Arc; use pageserver_api::models::{TenantState, TimelineState}; use super::Timeline; use super::delete::{DeletionGuard, delete_local_timeline_directory}; use crate::span::debug_assert_current_span_has_tenant_and_timeline_id; use crate::tenant::remote_timeline_client::ShutdownIfArchivedError; use crate::...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/init.rs
pageserver/src/tenant/timeline/init.rs
use std::collections::{HashMap, hash_map}; use std::str::FromStr; use anyhow::Context; use camino::{Utf8Path, Utf8PathBuf}; use utils::lsn::Lsn; use crate::is_temporary; use crate::tenant::ephemeral_file::is_ephemeral_file; use crate::tenant::remote_timeline_client::index::{IndexPart, LayerFileMetadata}; use crate::t...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/uninit.rs
pageserver/src/tenant/timeline/uninit.rs
use std::collections::hash_map::Entry; use std::fs; use std::future::Future; use std::sync::Arc; use anyhow::Context; use camino::Utf8PathBuf; use tracing::{error, info, info_span}; use utils::fs_ext; use utils::id::TimelineId; use utils::lsn::Lsn; use utils::sync::gate::GateGuard; use super::Timeline; use crate::con...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/layer_manager.rs
pageserver/src/tenant/timeline/layer_manager.rs
use std::collections::HashMap; use std::mem::ManuallyDrop; use std::ops::{Deref, DerefMut}; use std::sync::Arc; use std::time::Duration; use anyhow::{Context, bail, ensure}; use itertools::Itertools; use pageserver_api::keyspace::KeySpace; use pageserver_api::shard::TenantShardId; use tokio_util::sync::CancellationTok...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/eviction_task.rs
pageserver/src/tenant/timeline/eviction_task.rs
//! The per-timeline layer eviction task, which evicts data which has not been accessed for more //! than a given threshold. //! //! Data includes all kinds of caches, namely: //! - (in-memory layers) //! - on-demand downloaded layer files on disk //! - (cached layer file pages) //! - derived data from layer file conte...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/handle.rs
pageserver/src/tenant/timeline/handle.rs
//! A cache for [`crate::tenant::mgr`]+`Tenant::get_timeline`+`Timeline::gate.enter()`. //! //! # Motivation //! //! On a single page service connection, we're typically serving a single TenantTimelineId. //! //! Without sharding, there is a single Timeline object to which we dispatch //! all requests. For example, a g...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/delete.rs
pageserver/src/tenant/timeline/delete.rs
use std::ops::{Deref, DerefMut}; use std::sync::Arc; use anyhow::Context; use pageserver_api::models::TimelineState; use pageserver_api::shard::TenantShardId; use remote_storage::DownloadError; use tokio::sync::OwnedMutexGuard; use tracing::{Instrument, error, info, info_span, instrument}; use utils::id::TimelineId; u...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/walreceiver/connection_manager.rs
pageserver/src/tenant/timeline/walreceiver/connection_manager.rs
//! WAL receiver logic that ensures the pageserver gets connectected to safekeeper, //! that contains the latest WAL to stream and this connection does not go stale. //! //! To achieve that, a storage broker is used: safekepers propagate their timelines' state in it, //! the manager subscribes for changes and accumulat...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs
pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs
//! Actual Postgres connection handler to stream WAL to the server. use std::error::Error; use std::pin::pin; use std::str::FromStr; use std::sync::Arc; use std::time::{Duration, SystemTime}; use anyhow::{Context, anyhow}; use bytes::BytesMut; use chrono::{NaiveDateTime, Utc}; use fail::fail_point; use futures::Strea...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/import_pgdata/importbucket_client.rs
pageserver/src/tenant/timeline/import_pgdata/importbucket_client.rs
use std::ops::Bound; use std::sync::Arc; use anyhow::Context; use bytes::Bytes; use postgres_ffi::{ControlFileData, PgMajorVersion}; use remote_storage::{ Download, DownloadError, DownloadKind, DownloadOpts, GenericRemoteStorage, Listing, ListingObject, RemotePath, RemoteStorageConfig, }; use serde::de::Deseri...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/import_pgdata/flow.rs
pageserver/src/tenant/timeline/import_pgdata/flow.rs
//! Import a PGDATA directory into an empty root timeline. //! //! This module is adapted hackathon code by Heikki and Stas. //! Other code in the parent module was written by Christian as part of a customer PoC. //! //! The hackathon code was producing image layer files as a free-standing program. //! //! It has been ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/import_pgdata/index_part_format.rs
pageserver/src/tenant/timeline/import_pgdata/index_part_format.rs
#[cfg(feature = "testing")] use camino::Utf8PathBuf; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] pub enum Root { V1(V1), } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] pub enum V1 { InProgress(InProgress), Done(Done), } #[derive(Ser...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/tenant/timeline/import_pgdata/importbucket_format.rs
pageserver/src/tenant/timeline/import_pgdata/importbucket_format.rs
use serde::{Deserialize, Serialize}; #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)] pub struct PgdataStatus { pub done: bool, // TODO: remaining fields }
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/consumption_metrics/disk_cache.rs
pageserver/src/consumption_metrics/disk_cache.rs
use std::sync::Arc; use anyhow::Context; use camino::{Utf8Path, Utf8PathBuf}; use super::{NewMetricsRoot, NewRawMetric, RawMetric}; use crate::consumption_metrics::NewMetricsRefRoot; pub(super) fn read_metrics_from_serde_value( json_value: serde_json::Value, ) -> anyhow::Result<Vec<NewRawMetric>> { if NewMet...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/consumption_metrics/upload.rs
pageserver/src/consumption_metrics/upload.rs
use std::error::Error as _; use std::time::SystemTime; use chrono::{DateTime, Utc}; use consumption_metrics::{CHUNK_SIZE, Event, EventChunk, IdempotencyKey}; use remote_storage::{GenericRemoteStorage, RemotePath}; use tokio::io::AsyncWriteExt; use tokio_util::sync::CancellationToken; use tracing::Instrument; use utils...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/consumption_metrics/metrics.rs
pageserver/src/consumption_metrics/metrics.rs
use std::sync::Arc; use std::time::SystemTime; use chrono::{DateTime, Utc}; use consumption_metrics::EventType; use futures::stream::StreamExt; use utils::id::{TenantId, TimelineId}; use utils::lsn::Lsn; use super::{Cache, NewRawMetric}; use crate::context::RequestContext; use crate::tenant::mgr::TenantManager; use c...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/consumption_metrics/metrics/tests.rs
pageserver/src/consumption_metrics/metrics/tests.rs
use std::collections::HashMap; use super::*; use crate::consumption_metrics::RawMetric; #[test] fn startup_collected_timeline_metrics_before_advancing() { let tenant_id = TenantId::generate(); let timeline_id = TimelineId::generate(); let mut metrics = Vec::new(); let cache = HashMap::new(); let...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/deletion_queue/list_writer.rs
pageserver/src/deletion_queue/list_writer.rs
//! The list writer is the first stage in the deletion queue. It accumulates //! layers to delete, and periodically writes out these layers into a persistent //! DeletionList. //! //! The purpose of writing DeletionLists is to decouple the decision to //! delete an object from the validation required to execute it: ev...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/deletion_queue/deleter.rs
pageserver/src/deletion_queue/deleter.rs
//! The deleter is the final stage in the deletion queue. It accumulates remote //! paths to delete, and periodically executes them in batches of up to 1000 //! using the DeleteObjects request. //! //! Its purpose is to increase efficiency of remote storage I/O by issuing a smaller //! number of full-sized DeleteObjec...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/deletion_queue/validator.rs
pageserver/src/deletion_queue/validator.rs
//! The validator is responsible for validating DeletionLists for execution, //! based on whether the generation in the DeletionList is still the latest //! generation for a tenant. //! //! The purpose of validation is to ensure split-brain safety in the cluster //! of pageservers: a deletion may only be executed if th...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/open_options.rs
pageserver/src/virtual_file/open_options.rs
//! Enum-dispatch to the `OpenOptions` type of the respective [`super::IoEngineKind`]; use std::os::fd::OwnedFd; use std::os::unix::fs::OpenOptionsExt; use std::path::Path; use super::io_engine::IoEngine; #[derive(Debug, Clone)] pub struct OpenOptions { /// We keep a copy of the write() flag we pass to the `inne...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/io_engine.rs
pageserver/src/virtual_file/io_engine.rs
//! [`super::VirtualFile`] supports different IO engines. //! //! The [`IoEngineKind`] enum identifies them. //! //! The choice of IO engine is global. //! Initialize using [`init`]. //! //! Then use [`get`] and [`super::OpenOptions`]. //! //! #[cfg(target_os = "linux")] pub(super) mod tokio_epoll_uring_ext; use tok...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/temporary.rs
pageserver/src/virtual_file/temporary.rs
use tracing::error; use utils::sync::gate::GateGuard; use crate::context::RequestContext; use super::{ MaybeFatalIo, VirtualFile, owned_buffers_io::{ io_buf_aligned::IoBufAligned, io_buf_ext::FullSlice, write::OwnedAsyncWriter, }, }; /// A wrapper around [`super::VirtualFile`] that deletes the fi...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/metadata.rs
pageserver/src/virtual_file/metadata.rs
use std::fs; pub enum Metadata { StdFs(fs::Metadata), #[cfg(target_os = "linux")] TokioEpollUring(Box<tokio_epoll_uring::ops::statx::statx>), } #[cfg(target_os = "linux")] impl From<Box<tokio_epoll_uring::ops::statx::statx>> for Metadata { fn from(value: Box<tokio_epoll_uring::ops::statx::statx>) -> S...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/slice.rs
pageserver/src/virtual_file/owned_buffers_io/slice.rs
use tokio_epoll_uring::{BoundedBuf, BoundedBufMut, IoBufMut, Slice}; pub(crate) trait SliceMutExt { /// Get a `&mut[0..self.bytes_total()`] slice, for when you need to do borrow-based IO. /// /// See the test case `test_slice_full_zeroed` for the difference to just doing `&slice[..]` fn as_mut_rust_sli...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/aligned_buffer.rs
pageserver/src/virtual_file/owned_buffers_io/aligned_buffer.rs
pub mod alignment; pub mod buffer; pub mod buffer_mut; pub mod raw; pub mod slice; pub use alignment::*; pub use buffer_mut::AlignedBufferMut; pub use slice::AlignedSlice;
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/io_buf_ext.rs
pageserver/src/virtual_file/owned_buffers_io/io_buf_ext.rs
//! See [`FullSlice`]. use std::ops::{Deref, Range}; use bytes::{Bytes, BytesMut}; use tokio_epoll_uring::{BoundedBuf, IoBuf, Slice}; use super::write::CheapCloneForRead; use crate::virtual_file::{IoBuffer, IoBufferMut}; /// The true owned equivalent for Rust [`slice`]. Use this for the write path. /// /// Unlike [...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/write.rs
pageserver/src/virtual_file/owned_buffers_io/write.rs
mod flush; use bytes::BufMut; pub(crate) use flush::FlushControl; use flush::FlushHandle; pub(crate) use flush::FlushTaskError; use flush::ShutdownRequest; use tokio_epoll_uring::IoBuf; use tokio_util::sync::CancellationToken; use tracing::trace; use super::io_buf_aligned::IoBufAligned; use super::io_buf_aligned::IoB...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/io_buf_aligned.rs
pageserver/src/virtual_file/owned_buffers_io/io_buf_aligned.rs
use tokio_epoll_uring::{IoBuf, IoBufMut}; use crate::virtual_file::{IoBuffer, IoBufferMut, PageWriteGuardBuf}; /// A marker trait for a mutable aligned buffer type. pub trait IoBufAlignedMut: IoBufMut {} /// A marker trait for an aligned buffer type. pub trait IoBufAligned: IoBuf {} impl IoBufAlignedMut for IoBuffe...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/write/flush.rs
pageserver/src/virtual_file/owned_buffers_io/write/flush.rs
use std::ops::ControlFlow; use tokio_util::sync::CancellationToken; use tracing::{Instrument, info_span, warn}; use utils::sync::duplex; use super::{Buffer, CheapCloneForRead, OwnedAsyncWriter}; use crate::context::RequestContext; use crate::virtual_file::MaybeFatalIo; use crate::virtual_file::owned_buffers_io::io_bu...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/slice.rs
pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/slice.rs
use std::ops::{Deref, DerefMut}; use super::alignment::{Alignment, ConstAlign}; /// Newtype for an aligned slice. pub struct AlignedSlice<'a, const N: usize, A: Alignment> { /// underlying byte slice buf: &'a mut [u8; N], /// alignment marker _align: A, } impl<'a, const N: usize, const A: usize> Alig...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/alignment.rs
pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/alignment.rs
pub trait Alignment: std::marker::Unpin + 'static { /// Returns the required alignments. fn align(&self) -> usize; } /// Alignment at compile time. #[derive(Debug, Clone, Copy)] pub struct ConstAlign<const A: usize>; impl<const A: usize> Alignment for ConstAlign<A> { fn align(&self) -> usize { A ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/raw.rs
pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/raw.rs
use core::slice; use std::alloc::{self, Layout}; use std::cmp; use std::mem::ManuallyDrop; use super::alignment::{Alignment, ConstAlign}; #[derive(Debug)] struct AlignedBufferPtr(*mut u8); // SAFETY: We gurantees no one besides `IoBufferPtr` itself has the raw pointer. unsafe impl Send for AlignedBufferPtr {} // SA...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/buffer_mut.rs
pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/buffer_mut.rs
use std::mem::MaybeUninit; use std::ops::{Deref, DerefMut}; use super::alignment::{Alignment, ConstAlign}; use super::buffer::AlignedBuffer; use super::raw::RawAlignedBuffer; /// A mutable aligned buffer type. #[derive(Debug)] pub struct AlignedBufferMut<A: Alignment> { raw: RawAlignedBuffer<A>, } impl<const A: ...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/buffer.rs
pageserver/src/virtual_file/owned_buffers_io/aligned_buffer/buffer.rs
use std::ops::{Deref, Range, RangeBounds}; use std::sync::Arc; use super::alignment::Alignment; use super::raw::RawAlignedBuffer; use super::{AlignedBufferMut, ConstAlign}; /// An shared, immutable aligned buffer type. #[derive(Clone, Debug)] pub struct AlignedBuffer<A: Alignment> { /// Shared raw buffer. raw...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/virtual_file/io_engine/tokio_epoll_uring_ext.rs
pageserver/src/virtual_file/io_engine/tokio_epoll_uring_ext.rs
//! Like [`::tokio_epoll_uring::thread_local_system()`], but with pageserver-specific //! handling in case the instance can't launched. //! //! This is primarily necessary due to ENOMEM aka OutOfMemory errors during io_uring creation //! on older kernels, such as some (but not all) older kernels in the Linux 5.10 serie...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/bin/pageserver.rs
pageserver/src/bin/pageserver.rs
#![recursion_limit = "300"] //! Main entry point for the Page Server executable. use std::env; use std::env::{VarError, var}; use std::io::Read; use std::str::FromStr; use std::sync::Arc; use std::time::Duration; use anyhow::{Context, anyhow}; use camino::Utf8Path; use clap::{Arg, ArgAction, Command}; use http_utils...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
true
neondatabase/neon
https://github.com/neondatabase/neon/blob/015b1c7cb3259a6fcd5039bc2bd46a462e163ae8/pageserver/src/bin/test_helper_slow_client_reads.rs
pageserver/src/bin/test_helper_slow_client_reads.rs
use std::io::{Read, Write, stdin, stdout}; use std::time::Duration; use clap::Parser; use pageserver_api::pagestream_api::{ PagestreamFeMessage, PagestreamRequest, PagestreamTestRequest, }; use utils::id::{TenantId, TimelineId}; use utils::lsn::Lsn; #[derive(clap::Parser)] struct Args { connstr: String, t...
rust
Apache-2.0
015b1c7cb3259a6fcd5039bc2bd46a462e163ae8
2026-01-04T15:40:24.223849Z
false