@@ -311,3 +311,162 @@ def test_backward_compatibility_ptrack(self):
311311 if self .paranoia :
312312 pgdata_restored = self .pgdata_content (node_restored .data_dir )
313313 self .compare_pgdata (pgdata , pgdata_restored )
314+
315+ # @unittest.expectedFailure
316+ # @unittest.skip("skip")
317+ def test_backward_compatibility_compression (self ):
318+ """Description in jira issue PGPRO-434"""
319+ fname = self .id ().split ('.' )[3 ]
320+ backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
321+ node = self .make_simple_node (
322+ base_dir = "{0}/{1}/node" .format (module_name , fname ),
323+ set_replication = True ,
324+ initdb_params = ['--data-checksums' ],
325+ pg_options = {
326+ 'max_wal_senders' : '2' ,
327+ 'autovacuum' : 'off' })
328+
329+ self .init_pb (backup_dir , old_binary = True )
330+ self .add_instance (backup_dir , 'node' , node , old_binary = True )
331+
332+ self .set_archiving (backup_dir , 'node' , node , old_binary = True )
333+ node .slow_start ()
334+
335+ node .pgbench_init (scale = 10 )
336+
337+ # FULL backup with OLD binary
338+ backup_id = self .backup_node (
339+ backup_dir , 'node' , node ,
340+ old_binary = True ,
341+ options = ['--compress' ])
342+
343+ if self .paranoia :
344+ pgdata = self .pgdata_content (node .data_dir )
345+
346+ # restore OLD FULL with new binary
347+ node_restored = self .make_simple_node (
348+ base_dir = "{0}/{1}/node_restored" .format (module_name , fname ))
349+
350+ node_restored .cleanup ()
351+
352+ self .restore_node (
353+ backup_dir , 'node' , node_restored ,
354+ options = ["-j" , "4" ])
355+
356+ if self .paranoia :
357+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
358+ self .compare_pgdata (pgdata , pgdata_restored )
359+
360+ # PAGE backup with OLD binary
361+ pgbench = node .pgbench (
362+ stdout = subprocess .PIPE ,
363+ stderr = subprocess .STDOUT ,
364+ options = ["-c" , "4" , "-T" , "10" ])
365+ pgbench .wait ()
366+ pgbench .stdout .close ()
367+
368+ self .backup_node (
369+ backup_dir , 'node' , node ,
370+ backup_type = 'page' ,
371+ old_binary = True ,
372+ options = ['--compress' ])
373+
374+ if self .paranoia :
375+ pgdata = self .pgdata_content (node .data_dir )
376+
377+ node_restored .cleanup ()
378+ self .restore_node (
379+ backup_dir , 'node' , node_restored ,
380+ options = ["-j" , "4" ])
381+
382+ if self .paranoia :
383+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
384+ self .compare_pgdata (pgdata , pgdata_restored )
385+
386+ # PAGE backup with new binary
387+ pgbench = node .pgbench (
388+ stdout = subprocess .PIPE ,
389+ stderr = subprocess .STDOUT ,
390+ options = ["-c" , "4" , "-T" , "10" ])
391+ pgbench .wait ()
392+ pgbench .stdout .close ()
393+
394+ self .backup_node (
395+ backup_dir , 'node' , node ,
396+ backup_type = 'page' ,
397+ options = ['--compress' ])
398+
399+ if self .paranoia :
400+ pgdata = self .pgdata_content (node .data_dir )
401+
402+ node_restored .cleanup ()
403+
404+ self .restore_node (
405+ backup_dir , 'node' , node_restored ,
406+ options = ["-j" , "4" ])
407+
408+ if self .paranoia :
409+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
410+ self .compare_pgdata (pgdata , pgdata_restored )
411+
412+ # Delta backup with old binary
413+ self .delete_pb (backup_dir , 'node' , backup_id )
414+
415+ self .backup_node (
416+ backup_dir , 'node' , node ,
417+ old_binary = True ,
418+ options = ['--compress' ])
419+
420+ pgbench = node .pgbench (
421+ stdout = subprocess .PIPE ,
422+ stderr = subprocess .STDOUT ,
423+ options = ["-c" , "4" , "-T" , "10" ])
424+
425+ pgbench .wait ()
426+ pgbench .stdout .close ()
427+
428+ self .backup_node (
429+ backup_dir , 'node' , node ,
430+ backup_type = 'delta' ,
431+ options = ['--compress' ],
432+ old_binary = True )
433+
434+ if self .paranoia :
435+ pgdata = self .pgdata_content (node .data_dir )
436+
437+ node_restored .cleanup ()
438+
439+ self .restore_node (
440+ backup_dir , 'node' , node_restored ,
441+ options = ["-j" , "4" ])
442+
443+ if self .paranoia :
444+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
445+ self .compare_pgdata (pgdata , pgdata_restored )
446+
447+ # Delta backup with new binary
448+ pgbench = node .pgbench (
449+ stdout = subprocess .PIPE ,
450+ stderr = subprocess .STDOUT ,
451+ options = ["-c" , "4" , "-T" , "10" ])
452+
453+ pgbench .wait ()
454+ pgbench .stdout .close ()
455+
456+ self .backup_node (
457+ backup_dir , 'node' , node ,
458+ backup_type = 'delta' ,
459+ options = ['--compress' ])
460+
461+ if self .paranoia :
462+ pgdata = self .pgdata_content (node .data_dir )
463+
464+ node_restored .cleanup ()
465+
466+ self .restore_node (
467+ backup_dir , 'node' , node_restored ,
468+ options = ["-j" , "4" ])
469+
470+ if self .paranoia :
471+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
472+ self .compare_pgdata (pgdata , pgdata_restored )
0 commit comments