Skip to content

Commit c7c5f81

Browse files
koivunejproblame
andcommitted
test: stop safekeepers, use readonly endpoint
this might cover the last of flakyness. Co-authored-by: Christian Schwarz <[email protected]>
1 parent 8c81443 commit c7c5f81

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

test_runner/regress/test_ondemand_download.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,17 @@ def test_ondemand_download_large_rel(
9898

9999
current_lsn = Lsn(query_scalar(cur, "SELECT pg_current_wal_flush_lsn()"))
100100

101-
# wait until pageserver receives that data
102101
wait_for_last_record_lsn(client, tenant_id, timeline_id, current_lsn)
103102

104-
# stop pg before checkpoint to stop wal generation
103+
# stop endpoint before checkpoint to stop wal generation
105104
endpoint.stop()
106105

106+
# stopping of safekeepers now will help us not to calculate logical size
107+
# after startup, so page requests should be the only one on-demand
108+
# downloading the layers
109+
for sk in env.safekeepers:
110+
sk.stop()
111+
107112
# run checkpoint manually to be sure that data landed in remote storage
108113
client.timeline_checkpoint(tenant_id, timeline_id)
109114

@@ -122,8 +127,13 @@ def test_ondemand_download_large_rel(
122127
##### Second start, restore the data and ensure it's the same
123128
env.pageserver.start()
124129

125-
endpoint.start()
130+
# start a readonly endpoint which we'll use to check the database.
131+
# readonly (with lsn=) is required so that we don't try to connect to
132+
# safekeepers, that have now been shut down.
133+
endpoint = env.endpoints.create_start("main", lsn=current_lsn)
134+
126135
before_downloads = get_num_downloaded_layers(client, tenant_id, timeline_id)
136+
assert before_downloads != 0, "basebackup should on-demand non-zero layers"
127137

128138
# Probe in the middle of the table. There's a high chance that the beginning
129139
# and end of the table was stored together in the same layer files with data

0 commit comments

Comments
 (0)