@@ -98,12 +98,17 @@ def test_ondemand_download_large_rel(
98
98
99
99
current_lsn = Lsn (query_scalar (cur , "SELECT pg_current_wal_flush_lsn()" ))
100
100
101
- # wait until pageserver receives that data
102
101
wait_for_last_record_lsn (client , tenant_id , timeline_id , current_lsn )
103
102
104
- # stop pg before checkpoint to stop wal generation
103
+ # stop endpoint before checkpoint to stop wal generation
105
104
endpoint .stop ()
106
105
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
+
107
112
# run checkpoint manually to be sure that data landed in remote storage
108
113
client .timeline_checkpoint (tenant_id , timeline_id )
109
114
@@ -122,8 +127,13 @@ def test_ondemand_download_large_rel(
122
127
##### Second start, restore the data and ensure it's the same
123
128
env .pageserver .start ()
124
129
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
+
126
135
before_downloads = get_num_downloaded_layers (client , tenant_id , timeline_id )
136
+ assert before_downloads != 0 , "basebackup should on-demand non-zero layers"
127
137
128
138
# Probe in the middle of the table. There's a high chance that the beginning
129
139
# and end of the table was stored together in the same layer files with data
0 commit comments