fix: stop leaking BackgroundPurges (#8650)

avoid "leaking" the completions of BackgroundPurges by:

1. switching it to TaskTracker for provided close+wait
2. stop using tokio::fs::remove_dir_all which will consume two units of
memory instead of one blocking task

Additionally, use more graceful shutdown in tests which do actually some
background cleanup.
This commit is contained in:
Joonas Koivunen
2024-08-08 14:02:53 +03:00
committed by John Spray
parent 48ae1214c5
commit 552832b819
2 changed files with 36 additions and 71 deletions

View File

@@ -128,6 +128,8 @@ def test_tenant_delete_smoke(
assert ps_http.get_metric_value("pageserver_tenant_manager_slots", {"mode": "attached"}) == 1
assert ps_http.get_metric_value("pageserver_tenant_manager_slots", {"mode": "inprogress"}) == 0
env.pageserver.stop()
def test_long_timeline_create_cancelled_by_tenant_delete(neon_env_builder: NeonEnvBuilder):
"""Reproduction of 2023-11-23 stuck tenants investigation"""
@@ -200,11 +202,10 @@ def test_long_timeline_create_cancelled_by_tenant_delete(neon_env_builder: NeonE
if deletion is not None:
deletion.join()
env.pageserver.stop()
def test_tenant_delete_races_timeline_creation(
neon_env_builder: NeonEnvBuilder,
pg_bin: PgBin,
):
def test_tenant_delete_races_timeline_creation(neon_env_builder: NeonEnvBuilder):
"""
Validate that timeline creation executed in parallel with deletion works correctly.
@@ -318,6 +319,8 @@ def test_tenant_delete_races_timeline_creation(
# We deleted our only tenant, and the scrubber fails if it detects nothing
neon_env_builder.disable_scrub_on_exit()
env.pageserver.stop()
def test_tenant_delete_scrubber(pg_bin: PgBin, neon_env_builder: NeonEnvBuilder):
"""