@@ -89,7 +89,7 @@ def test_multithread_remote_transfer(self):
89
89
self .del_test_dir (module_name , fname )
90
90
91
91
# @unittest.skip("skip")
92
- def test_remote_catchup (self ):
92
+ def test_remote_ptrack_catchup (self ):
93
93
"""
94
94
Test 'catchup' mode
95
95
create node,
@@ -150,4 +150,64 @@ def test_remote_catchup(self):
150
150
# Clean after yourself
151
151
self .del_test_dir (module_name , fname )
152
152
153
+ # @unittest.skip("skip")
154
+ def test_remote_delta_catchup (self ):
155
+ """
156
+ Test 'catchup' mode
157
+ create node,
158
+ make a copy with replication, start copy, stop copy,
159
+ generate some load on master, insert some test data on master,
160
+ catchup copy, start and select test data
161
+ """
162
+ fname = self .id ().split ('.' )[3 ]
163
+
164
+ # prepare master
165
+ source_pg = self .make_simple_node (
166
+ base_dir = os .path .join (module_name , fname , 'src' ),
167
+ set_replication = True ,
168
+ ptrack_enable = True ,
169
+ initdb_params = ['--data-checksums' ]
170
+ )
171
+ source_pg .slow_start ()
172
+ source_pg .safe_psql ("postgres" , "CREATE EXTENSION ptrack" )
173
+ source_pg .safe_psql ("postgres" , "CREATE TABLE ultimate_question(answer int)" )
174
+
175
+ # make clean shutdowned lagging behind replica
176
+ dest_pg = self .make_empty_node (os .path .join (module_name , fname , 'dst' ))
177
+ dest_pg = self .catchup_node (
178
+ backup_mode = 'FULL' ,
179
+ source_pgdata = source_pg .data_dir ,
180
+ destination_node = dest_pg ,
181
+ options = ['-d' , 'postgres' , '-p' , str (source_pg .port ), '--stream' ])
182
+ self .set_replica (source_pg , dest_pg )
183
+ dest_pg .slow_start (replica = True )
184
+ dest_pg .stop ()
185
+
186
+ # make changes on master
187
+ source_pg .pgbench_init (scale = 10 )
188
+ pgbench = source_pg .pgbench (options = ['-T' , '10' , '--no-vacuum' ])
189
+ pgbench .wait ()
190
+ source_pg .safe_psql ("postgres" , "INSERT INTO ultimate_question VALUES(42)" )
191
+ result = source_pg .safe_psql ("postgres" , "SELECT * FROM ultimate_question" )
192
+
193
+ # catchup
194
+ self .catchup_node (
195
+ backup_mode = 'DELTA' ,
196
+ source_pgdata = source_pg .data_dir ,
197
+ destination_node = dest_pg ,
198
+ options = ['-d' , 'postgres' , '-p' , str (source_pg .port ), '--stream' ])
153
199
200
+ # stop replication
201
+ source_pg .stop ()
202
+
203
+ # check latest changes
204
+ self .set_replica (source_pg , dest_pg )
205
+ dest_pg .slow_start (replica = True )
206
+ self .assertEqual (
207
+ result ,
208
+ dest_pg .safe_psql ("postgres" , "SELECT * FROM ultimate_question" ),
209
+ 'Different answer from copy' )
210
+ dest_pg .stop ()
211
+
212
+ # Clean after yourself
213
+ self .del_test_dir (module_name , fname )
0 commit comments