mirror of
https://github.com/neondatabase/neon.git
synced 2026-07-06 13:40:37 +00:00
Start GC in page cache initialization rather than during branch creation
This commit is contained in:
@@ -47,6 +47,7 @@ pub fn init_pageserver(
|
||||
workdir: &Path,
|
||||
create_tenant: Option<&str>,
|
||||
) -> Result<()> {
|
||||
|
||||
env::set_current_dir(workdir)?;
|
||||
|
||||
// Initialize logger
|
||||
@@ -104,17 +105,11 @@ pub fn create_repo(
|
||||
// rapid init+start case now, but the general race condition remains if you restart the
|
||||
// server quickly.
|
||||
let repo: Arc<dyn Repository + Sync + Send> = match conf.repository_format {
|
||||
RepositoryFormat::Layered => {
|
||||
let repo = Arc::new(crate::layered_repository::LayeredRepository::new(
|
||||
conf,
|
||||
wal_redo_manager,
|
||||
tenantid,
|
||||
));
|
||||
if conf.gc_horizon != 0 {
|
||||
crate::layered_repository::LayeredRepository::launch_gc_thread(conf, repo.clone());
|
||||
}
|
||||
repo
|
||||
}
|
||||
RepositoryFormat::Layered => Arc::new(
|
||||
crate::layered_repository::LayeredRepository::new(conf,
|
||||
wal_redo_manager,
|
||||
tenantid
|
||||
)),
|
||||
RepositoryFormat::RocksDb => {
|
||||
let obj_store = crate::rocksdb_storage::RocksObjectStore::create(conf, &tenantid)?;
|
||||
|
||||
@@ -122,7 +117,7 @@ pub fn create_repo(
|
||||
conf,
|
||||
Arc::new(obj_store),
|
||||
wal_redo_manager,
|
||||
tenantid,
|
||||
tenantid
|
||||
))
|
||||
}
|
||||
};
|
||||
|
||||
@@ -33,10 +33,19 @@ pub fn init(conf: &'static PageServerConf) {
|
||||
|
||||
// Set up an object repository, for actual data storage.
|
||||
let repo: Arc<dyn Repository + Sync + Send> = match conf.repository_format {
|
||||
RepositoryFormat::Layered => Arc::new(LayeredRepository::new(conf,
|
||||
Arc::new(walredo_mgr),
|
||||
tenantid
|
||||
)),
|
||||
RepositoryFormat::Layered => {
|
||||
let repo = Arc::new(LayeredRepository::new(
|
||||
conf,
|
||||
Arc::new(walredo_mgr),
|
||||
tenantid,
|
||||
));
|
||||
if conf.gc_horizon != 0 {
|
||||
crate::layered_repository::LayeredRepository::launch_gc_thread(conf, repo.clone());
|
||||
} else {
|
||||
info!("Garbage collection is disabled");
|
||||
}
|
||||
repo
|
||||
}
|
||||
RepositoryFormat::RocksDb => {
|
||||
let obj_store = RocksObjectStore::open(conf, &tenantid).unwrap();
|
||||
|
||||
@@ -44,7 +53,7 @@ pub fn init(conf: &'static PageServerConf) {
|
||||
conf,
|
||||
Arc::new(obj_store),
|
||||
Arc::new(walredo_mgr),
|
||||
tenantid
|
||||
tenantid,
|
||||
))
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user