test: test_pageserver_respects_overridden_resident_size: use absolute wiggle room instead of percentage

Heikki added the `*0.75` in

    commit 11b16614a3
    Author: Heikki Linnakangas <heikki@neon.tech>
    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.
This commit is contained in:
Christian Schwarz
2023-03-28 19:16:59 +02:00
parent d6c2867b46
commit bb5947afde

View File

@@ -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"