Skip to content

Commit 4630b70

Browse files
authored
fix(pageserver): ensure all layers are flushed before measuring RSS (#9861)
## Problem close #9761 The test assumed that no new L0 layers are flushed throughout the process, which is not true. ## Summary of changes Fix the test case `test_compaction_l0_memory` by flushing in-memory layers before compaction. Signed-off-by: Alex Chi Z <[email protected]>
1 parent 6f6749c commit 4630b70

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test_runner/performance/test_compaction.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ def test_compaction_l0_memory(neon_compare: NeonCompare):
103103
cur.execute(f"update tbl{i} set j = {j};")
104104

105105
wait_for_last_flush_lsn(env, endpoint, tenant_id, timeline_id)
106+
pageserver_http.timeline_checkpoint(
107+
tenant_id, timeline_id, compact=False
108+
) # ^1: flush all in-memory layers
106109
endpoint.stop()
107110

108111
# Check we have generated the L0 stack we expected
@@ -118,7 +121,9 @@ def rss_hwm():
118121
return v * 1024
119122

120123
before = rss_hwm()
121-
pageserver_http.timeline_compact(tenant_id, timeline_id)
124+
pageserver_http.timeline_compact(
125+
tenant_id, timeline_id
126+
) # ^1: we must ensure during this process no new L0 layers are flushed
122127
after = rss_hwm()
123128

124129
log.info(f"RSS across compaction: {before} -> {after} (grew {after - before})")
@@ -137,7 +142,7 @@ def rss_hwm():
137142
# To be fixed in https://github.com/neondatabase/neon/issues/8184, after which
138143
# this memory estimate can be revised far downwards to something that doesn't scale
139144
# linearly with the layer sizes.
140-
MEMORY_ESTIMATE = (initial_l0s_size - final_l0s_size) * 1.5
145+
MEMORY_ESTIMATE = (initial_l0s_size - final_l0s_size) * 1.25
141146

142147
# If we find that compaction is using more memory, this may indicate a regression
143148
assert compaction_mapped_rss < MEMORY_ESTIMATE

0 commit comments

Comments
 (0)