From bb5947afde4c2d48519e92649b4918c7507e6570 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Tue, 28 Mar 2023 19:16:59 +0200 Subject: [PATCH] test: test_pageserver_respects_overridden_resident_size: use absolute wiggle room instead of percentage Heikki added the `*0.75` in commit 11b16614a37c1d05136a154cc99da3912d495161 Author: Heikki Linnakangas Date: Tue Mar 28 01:13:33 2023 +0300 Fix test for change in behavior close to the min_resident_size boundary This PR changed the behavior to match my expectation per my comment: https://github.com/neondatabase/neon/pull/3809/files#r1149837135 Without it, the test fails because we fall back to global LRU, and we have an assert on that. The reason why it falls back to global LRU is that `target = delta_between_small_and_big_tenant` doesn't leave any wiggle-room to go over min_resident_size boundary. But, we redefined min_resident_size to include up to 1 layer above it in this branch. Multiply that by two because we're dealing with 2 tenants here. --- test_runner/regress/test_disk_usage_eviction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_runner/regress/test_disk_usage_eviction.py b/test_runner/regress/test_disk_usage_eviction.py index e39556d801..3897a80780 100644 --- a/test_runner/regress/test_disk_usage_eviction.py +++ b/test_runner/regress/test_disk_usage_eviction.py @@ -208,7 +208,7 @@ def test_pageserver_respects_overridden_resident_size(eviction_env: EvictionEnv) # give the larger tenant a haircut while preventing the smaller tenant from getting one min_resident_size = du_by_timeline[small_tenant] - target = int((du_by_timeline[large_tenant] - du_by_timeline[small_tenant]) * 0.75) + target = (du_by_timeline[large_tenant] - du_by_timeline[small_tenant]) - 2*env.layer_size assert any( [du > min_resident_size for du in du_by_timeline.values()] ), "ensure the larger tenant will get a haircut"