From c631fa1f5092f4c063f1570866ca9e76e6f1ef8d Mon Sep 17 00:00:00 2001 From: Dmitry Rodionov Date: Thu, 10 Nov 2022 19:17:29 +0200 Subject: [PATCH] fix test_gc_cutoff test Also improve it so it fails earlier if something is not working because otherwise it was failing because of the timeout. And if timeout was big enough test can even pass --- pageserver/src/tenant.rs | 8 ++------ pageserver/src/tenant_mgr.rs | 5 +++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index 5647a0c345..6782209fcb 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -538,9 +538,7 @@ impl Tenant { // We're ready for business. // Change to active state under the hood spawns background loops // The loops will shut themselves down when they notice that the tenant is inactive. - self.set_state(TenantState::Active { - background_jobs_running: true, - }); + self.activate(true); info!("Done"); @@ -777,9 +775,7 @@ impl Tenant { // We're ready for business. // Change to active state under the hood spawns background loops // The loops will shut themselves down when they notice that the tenant is inactive. - self.set_state(TenantState::Active { - background_jobs_running: true, - }); + self.activate(true); info!("Done"); diff --git a/pageserver/src/tenant_mgr.rs b/pageserver/src/tenant_mgr.rs index 853447470c..c694671de5 100644 --- a/pageserver/src/tenant_mgr.rs +++ b/pageserver/src/tenant_mgr.rs @@ -307,10 +307,11 @@ pub fn create_tenant( hash_map::Entry::Vacant(v) => { let wal_redo_manager = Arc::new(PostgresRedoManager::new(conf, tenant_id)); create_tenant_files(conf, tenant_conf, tenant_id)?; - // TODO review, created in active state immediately, is it correctly? + // create tenant in Active state so it is possible to issue create_timeline + // request. Which on timeline activation will trigger tenant activation let tenant = Arc::new(Tenant::new( TenantState::Active { - background_jobs_running: true, + background_jobs_running: false, }, conf, tenant_conf,