From b7d7496221e7b676cffecfbea60457042d1f2cb6 Mon Sep 17 00:00:00 2001 From: Alex Chi Z Date: Tue, 24 Jun 2025 13:56:38 -0400 Subject: [PATCH] fix storage tests Signed-off-by: Alex Chi Z --- test_runner/fixtures/neon_fixtures.py | 3 ++- .../regress/test_pageserver_generations.py | 9 +++++++- .../regress/test_timeline_detach_ancestor.py | 21 +++++++++++++++---- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/test_runner/fixtures/neon_fixtures.py b/test_runner/fixtures/neon_fixtures.py index 050d61055e..c3f13c1b2a 100644 --- a/test_runner/fixtures/neon_fixtures.py +++ b/test_runner/fixtures/neon_fixtures.py @@ -5806,6 +5806,7 @@ def generate_uploads_and_deletions( data: str | None = None, pageserver: NeonPageserver, wait_until_uploaded: bool = True, + config_lines: list[str] | None = None, ): """ Using the environment's default tenant + timeline, generate a load pattern @@ -5823,7 +5824,7 @@ def generate_uploads_and_deletions( ps_http = pageserver.http_client() with env.endpoints.create_start( - "main", tenant_id=tenant_id, pageserver_id=pageserver.id + "main", tenant_id=tenant_id, pageserver_id=pageserver.id, config_lines=config_lines ) as endpoint: if init: endpoint.safe_psql("CREATE TABLE foo (id INTEGER PRIMARY KEY, val text)") diff --git a/test_runner/regress/test_pageserver_generations.py b/test_runner/regress/test_pageserver_generations.py index e3f9982486..fdd73ccb9b 100644 --- a/test_runner/regress/test_pageserver_generations.py +++ b/test_runner/regress/test_pageserver_generations.py @@ -226,7 +226,14 @@ def test_deletion_queue_recovery( ps_http.configure_failpoints(failpoints) - generate_uploads_and_deletions(env, pageserver=main_pageserver) + # As the compute will write a pg_stat aux file record when shutting down and we check the delta layers + # generated in this test case, we need to disable it to avoid the test case from failing + make things + # more deterministic. + disable_pg_stat_persistence_config_line = ["neon.pgstat_file_size_limit = 0"] + + generate_uploads_and_deletions( + env, pageserver=main_pageserver, config_lines=disable_pg_stat_persistence_config_line + ) # There should be entries in the deletion queue assert_deletion_queue(ps_http, lambda n: n > 0) diff --git a/test_runner/regress/test_timeline_detach_ancestor.py b/test_runner/regress/test_timeline_detach_ancestor.py index c58f78aeb1..a47ddee88c 100644 --- a/test_runner/regress/test_timeline_detach_ancestor.py +++ b/test_runner/regress/test_timeline_detach_ancestor.py @@ -93,7 +93,14 @@ def test_ancestor_detach_branched_from( client = env.pageserver.http_client() - with env.endpoints.create_start("main", tenant_id=env.initial_tenant) as ep: + # As the compute will write a pg_stat aux file record when shutting down and we check the delta layers + # generated in this test case, we need to disable it to avoid the test case from failing + make things + # more deterministic. + disable_pg_stat_persistence_config_line = ["neon.pgstat_file_size_limit = 0"] + + with env.endpoints.create_start( + "main", tenant_id=env.initial_tenant, config_lines=disable_pg_stat_persistence_config_line + ) as ep: ep.safe_psql("CREATE TABLE foo (i BIGINT);") after_first_tx = wait_for_last_flush_lsn(env, ep, env.initial_tenant, env.initial_timeline) @@ -151,7 +158,9 @@ def test_ancestor_detach_branched_from( assert branch_at == recorded, "the test should not use unaligned lsns" if write_to_branch_first: - with env.endpoints.create_start(name, tenant_id=env.initial_tenant) as ep: + with env.endpoints.create_start( + name, tenant_id=env.initial_tenant, config_lines=disable_pg_stat_persistence_config_line + ) as ep: assert ep.safe_psql("SELECT count(*) FROM foo;")[0][0] == rows # make sure the ep is writable # with BEFORE_L0, AFTER_L0 there will be a gap in Lsns caused by accurate end_lsn on straddling layers @@ -180,10 +189,14 @@ def test_ancestor_detach_branched_from( env.pageserver.stop() env.pageserver.start() - with env.endpoints.create_start("main", tenant_id=env.initial_tenant) as ep: + with env.endpoints.create_start( + "main", tenant_id=env.initial_tenant, config_lines=disable_pg_stat_persistence_config_line + ) as ep: assert ep.safe_psql("SELECT count(*) FROM foo;")[0][0] == 16384 - with env.endpoints.create_start(name, tenant_id=env.initial_tenant) as ep: + with env.endpoints.create_start( + name, tenant_id=env.initial_tenant, config_lines=disable_pg_stat_persistence_config_line + ) as ep: assert ep.safe_psql("SELECT count(*) FROM foo;")[0][0] == rows old_main_info = client.layer_map_info(env.initial_tenant, env.initial_timeline)