mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-30 07:17:22 +00:00
Use lazy SLRU download for all timelines is feature flag is set
This commit is contained in:
@@ -311,8 +311,8 @@ where
|
||||
self.timeline.pg_version,
|
||||
)?;
|
||||
|
||||
let lazy_slru_download = self.lazy_slru_download_enabled
|
||||
&& self.timeline.get_lazy_slru_download()
|
||||
let lazy_slru_download = (self.lazy_slru_download_enabled
|
||||
|| self.timeline.get_lazy_slru_download())
|
||||
&& !self.full_backup;
|
||||
|
||||
let pgversion = self.timeline.pg_version;
|
||||
@@ -356,7 +356,7 @@ where
|
||||
);
|
||||
|
||||
let mut slru_builder = SlruSegmentsBuilder::new(&mut self.ar);
|
||||
let mut total_slru_blocks = 0usize;
|
||||
|
||||
for part in slru_partitions.parts {
|
||||
let query = VersionedKeySpaceQuery::uniform(part, self.lsn);
|
||||
let blocks = self
|
||||
@@ -364,17 +364,12 @@ where
|
||||
.get_vectored(query, self.io_concurrency.clone(), self.ctx)
|
||||
.await?;
|
||||
|
||||
total_slru_blocks += blocks.len();
|
||||
|
||||
for (key, block) in blocks {
|
||||
let block = block?;
|
||||
slru_builder.add_block(&key, block).await?;
|
||||
}
|
||||
}
|
||||
slru_builder.finish().await?;
|
||||
self.timeline.set_lazy_slru_download(
|
||||
total_slru_blocks > self.timeline.conf.lazy_slru_download_threshold,
|
||||
);
|
||||
}
|
||||
|
||||
let mut min_restart_lsn: Lsn = Lsn::MAX;
|
||||
|
||||
@@ -210,6 +210,7 @@ pub struct PageServerConf {
|
||||
/// Interpreted protocol feature: if enabled, validate that the logical WAL received from
|
||||
/// safekeepers does not have gaps.
|
||||
pub validate_wal_contiguity: bool,
|
||||
<<<<<<< HEAD
|
||||
|
||||
/// When set, the previously written to disk heatmap is loaded on tenant attach and used
|
||||
/// to avoid clobbering the heatmap from new, cold, attached locations.
|
||||
@@ -228,6 +229,8 @@ pub struct PageServerConf {
|
||||
/// Size of SLRU object in blocks which triggers on-demand download rarther than including it in basebackup
|
||||
///
|
||||
pub lazy_slru_download_threshold: usize,
|
||||
=======
|
||||
>>>>>>> 1ef4316b4 (Use lazy SLRU download for all timelines is feature flag is set)
|
||||
}
|
||||
|
||||
/// Token for authentication to safekeepers
|
||||
@@ -397,11 +400,14 @@ impl PageServerConf {
|
||||
get_vectored_concurrent_io,
|
||||
enable_read_path_debugging,
|
||||
validate_wal_contiguity,
|
||||
<<<<<<< HEAD
|
||||
load_previous_heatmap,
|
||||
generate_unarchival_heatmap,
|
||||
tracing,
|
||||
enable_tls_page_service_api,
|
||||
lazy_slru_download_threshold,
|
||||
=======
|
||||
>>>>>>> 1ef4316b4 (Use lazy SLRU download for all timelines is feature flag is set)
|
||||
} = config_toml;
|
||||
|
||||
let mut conf = PageServerConf {
|
||||
@@ -506,7 +512,6 @@ impl PageServerConf {
|
||||
}
|
||||
None => Vec::new(),
|
||||
},
|
||||
lazy_slru_download_threshold,
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -285,11 +285,6 @@ pub struct Timeline {
|
||||
// them yet.
|
||||
disk_consistent_lsn: AtomicLsn,
|
||||
|
||||
//
|
||||
// Flag indicating that SLRU for this timeline should be loaded on demand rathert than included in basesbackup
|
||||
//
|
||||
lazy_slru_download: AtomicBool,
|
||||
|
||||
// Parent timeline that this timeline was branched from, and the LSN
|
||||
// of the branch point.
|
||||
ancestor_timeline: Option<Arc<Timeline>>,
|
||||
@@ -2496,9 +2491,6 @@ impl Timeline {
|
||||
}
|
||||
|
||||
pub(crate) fn get_lazy_slru_download(&self) -> bool {
|
||||
if self.lazy_slru_download.load(AtomicOrdering::Relaxed) {
|
||||
return true;
|
||||
}
|
||||
let tenant_conf = self.tenant_conf.load();
|
||||
tenant_conf
|
||||
.tenant_conf
|
||||
@@ -2506,7 +2498,6 @@ impl Timeline {
|
||||
.unwrap_or(self.conf.default_tenant_conf.lazy_slru_download)
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
/// Checks if a get page request should get perf tracing
|
||||
///
|
||||
/// The configuration priority is: tenant config override, default tenant config,
|
||||
@@ -2530,11 +2521,10 @@ impl Timeline {
|
||||
}
|
||||
None => false,
|
||||
}
|
||||
=======
|
||||
|
||||
pub(crate) fn set_lazy_slru_download(&self, enabled: bool) {
|
||||
self.lazy_slru_download
|
||||
.store(enabled, AtomicOrdering::Relaxed);
|
||||
>>>>>>> 7f7f353dc (Add lazy_slru_download_threshold parameter to page server config)
|
||||
}
|
||||
|
||||
fn get_checkpoint_distance(&self) -> u64 {
|
||||
@@ -2912,7 +2902,6 @@ impl Timeline {
|
||||
prev: metadata.prev_record_lsn().unwrap_or(Lsn(0)),
|
||||
}),
|
||||
disk_consistent_lsn: AtomicLsn::new(disk_consistent_lsn.0),
|
||||
lazy_slru_download: AtomicBool::new(false),
|
||||
|
||||
gc_compaction_state: ArcSwap::new(Arc::new(gc_compaction_state)),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user