@@ -163,9 +163,9 @@ def test_merge_compressed_backups(self):
163
163
node .cleanup ()
164
164
self .del_test_dir (module_name , fname )
165
165
166
- def test_merge_compressed_and_uncompressed_backups (self ):
166
+ def test_merge_compressed_backups_1 (self ):
167
167
"""
168
- Test MERGE command with compressed and uncompressed backups
168
+ Test MERGE command with compressed backups
169
169
"""
170
170
fname = self .id ().split ("." )[3 ]
171
171
backup_dir = os .path .join (self .tmp_path , module_name , fname , "backup" )
@@ -203,16 +203,12 @@ def test_merge_compressed_and_uncompressed_backups(self):
203
203
self .backup_node (
204
204
backup_dir , "node" , node , backup_type = "delta" ,
205
205
options = ['--compress-algorithm=zlib' , '--stream' ])
206
- show_backup = self .show_pb (backup_dir , "node" )[1 ]
207
-
208
- self .assertEqual (show_backup ["status" ], "OK" )
209
- self .assertEqual (show_backup ["backup-mode" ], "DELTA" )
210
206
211
207
# Change data
212
208
pgbench = node .pgbench (options = ['-T' , '20' , '-c' , '2' , '--no-vacuum' ])
213
209
pgbench .wait ()
214
210
215
- # Do not compressed PAGE backup
211
+ # Do compressed PAGE backup
216
212
self .backup_node (
217
213
backup_dir , "node" , node , backup_type = "page" ,
218
214
options = ['--compress-algorithm=zlib' ])
@@ -244,6 +240,82 @@ def test_merge_compressed_and_uncompressed_backups(self):
244
240
node .cleanup ()
245
241
self .del_test_dir (module_name , fname )
246
242
243
+ def test_merge_compressed_and_uncompressed_backups (self ):
244
+ """
245
+ Test MERGE command with compressed and uncompressed backups
246
+ """
247
+ fname = self .id ().split ("." )[3 ]
248
+ backup_dir = os .path .join (self .tmp_path , module_name , fname , "backup" )
249
+
250
+ # Initialize instance and backup directory
251
+ node = self .make_simple_node (
252
+ base_dir = "{0}/{1}/node" .format (module_name , fname ),
253
+ initdb_params = ["--data-checksums" ],
254
+ pg_options = {
255
+ 'autovacuum' : 'off'
256
+ }
257
+ )
258
+
259
+ self .init_pb (backup_dir )
260
+ self .add_instance (backup_dir , "node" , node )
261
+ self .set_archiving (backup_dir , "node" , node )
262
+ node .slow_start ()
263
+
264
+ # Fill with data
265
+ node .pgbench_init (scale = 5 )
266
+
267
+ # Do compressed FULL backup
268
+ self .backup_node (backup_dir , "node" , node , options = [
269
+ '--compress-algorithm=zlib' , '--stream' ])
270
+ show_backup = self .show_pb (backup_dir , "node" )[0 ]
271
+
272
+ self .assertEqual (show_backup ["status" ], "OK" )
273
+ self .assertEqual (show_backup ["backup-mode" ], "FULL" )
274
+
275
+ # Change data
276
+ pgbench = node .pgbench (options = ['-T' , '20' , '-c' , '2' , '--no-vacuum' ])
277
+ pgbench .wait ()
278
+
279
+ # Do compressed DELTA backup
280
+ self .backup_node (
281
+ backup_dir , "node" , node , backup_type = "delta" ,
282
+ options = ['--compress-algorithm=zlib' , '--stream' ])
283
+
284
+ # Change data
285
+ pgbench = node .pgbench (options = ['-T' , '20' , '-c' , '2' , '--no-vacuum' ])
286
+ pgbench .wait ()
287
+
288
+ # Do uncompressed PAGE backup
289
+ self .backup_node (
290
+ backup_dir , "node" , node , backup_type = "page" )
291
+
292
+ pgdata = self .pgdata_content (node .data_dir )
293
+
294
+ show_backup = self .show_pb (backup_dir , "node" )[2 ]
295
+ page_id = show_backup ["id" ]
296
+
297
+ self .assertEqual (show_backup ["status" ], "OK" )
298
+ self .assertEqual (show_backup ["backup-mode" ], "PAGE" )
299
+
300
+ # Merge all backups
301
+ self .merge_backup (backup_dir , "node" , page_id )
302
+ show_backups = self .show_pb (backup_dir , "node" )
303
+
304
+ self .assertEqual (len (show_backups ), 1 )
305
+ self .assertEqual (show_backups [0 ]["status" ], "OK" )
306
+ self .assertEqual (show_backups [0 ]["backup-mode" ], "FULL" )
307
+
308
+ # Drop node and restore it
309
+ node .cleanup ()
310
+ self .restore_node (backup_dir , 'node' , node )
311
+
312
+ pgdata_restored = self .pgdata_content (node .data_dir )
313
+ self .compare_pgdata (pgdata , pgdata_restored )
314
+
315
+ # Clean after yourself
316
+ node .cleanup ()
317
+ self .del_test_dir (module_name , fname )
318
+
247
319
# @unittest.skip("skip")
248
320
def test_merge_tablespaces (self ):
249
321
"""
0 commit comments