@@ -140,13 +140,15 @@ def test_ptrack_stream(self):
140
140
self .restore_node (backup_dir , 'node' , node , backup_id = ptrack_backup_id , options = ["-j" , "4" ]),
141
141
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (self .output ), self .cmd ))
142
142
pgdata_restored = self .pgdata_content (node .data_dir )
143
- # self.compare_pgdata(pgdata, pgdata_restored)
144
143
node .start ()
145
144
while node .safe_psql ("postgres" , "select pg_is_in_recovery()" ) == 't\n ' :
146
145
time .sleep (1 )
147
146
ptrack_result_new = node .safe_psql ("postgres" , "SELECT * FROM t_heap" )
148
147
self .assertEqual (ptrack_result , ptrack_result_new )
149
148
149
+ if self .paranoia :
150
+ self .compare_pgdata (pgdata , pgdata_restored )
151
+
150
152
# Clean after yourself
151
153
self .del_test_dir (module_name , fname )
152
154
@@ -203,12 +205,15 @@ def test_ptrack_archive(self):
203
205
self .restore_node (backup_dir , 'node' , node , backup_id = ptrack_backup_id , options = ["-j" , "4" , "--time={0}" .format (ptrack_target_time )]),
204
206
'\n Unexpected Error Message: {0}\n CMD: {1}' .format (repr (self .output ), self .cmd ))
205
207
pgdata_restored = self .pgdata_content (node .data_dir )
206
- # self.compare_pgdata(pgdata, pgdata_restored)
207
208
node .start ()
208
209
while node .safe_psql ("postgres" , "select pg_is_in_recovery()" ) == 't\n ' :
209
210
time .sleep (1 )
210
211
ptrack_result_new = node .safe_psql ("postgres" , "SELECT * FROM t_heap" )
211
212
self .assertEqual (ptrack_result , ptrack_result_new )
213
+
214
+ if self .paranoia :
215
+ self .compare_pgdata (pgdata , pgdata_restored )
216
+
212
217
node .cleanup ()
213
218
214
219
# Clean after yourself
@@ -401,8 +406,9 @@ def test_create_db(self):
401
406
node_restored .cleanup ()
402
407
# COMPARE PHYSICAL CONTENT
403
408
self .restore_node (backup_dir , 'node' , node_restored , backup_id = backup_id , options = ["-j" , "4" ])
404
- pgdata_new = self .pgdata_content (node_restored .data_dir )
405
- # self.compare_pgdata(pgdata, pgdata_restored)
409
+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
410
+ if self .paranoia :
411
+ self .compare_pgdata (pgdata , pgdata_restored )
406
412
407
413
# START RESTORED NODE
408
414
node_restored .append_conf ("postgresql.auto.conf" , "port = {0}" .format (node_restored .port ))
@@ -424,8 +430,9 @@ def test_create_db(self):
424
430
node_restored .start ()
425
431
426
432
# COMPARE PHYSICAL CONTENT
427
- pgdata_new = self .pgdata_content (node_restored .data_dir )
428
- # self.compare_pgdata(pgdata, pgdata_restored)
433
+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
434
+ if self .paranoia :
435
+ self .compare_pgdata (pgdata , pgdata_restored )
429
436
430
437
try :
431
438
node_restored .safe_psql ('db1' , 'select 1' )
@@ -485,8 +492,7 @@ def test_alter_table_set_tablespace_ptrack(self):
485
492
])
486
493
487
494
# GET RESTORED PGDATA AND COMPARE
488
- pgdata_new = self .pgdata_content (node_restored .data_dir )
489
- # self.compare_pgdata(pgdata, pgdata_new)
495
+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
490
496
# START RESTORED NODE
491
497
node_restored .append_conf ('postgresql.auto.conf' , 'port = {0}' .format (node_restored .port ))
492
498
node_restored .start ()
@@ -496,6 +502,8 @@ def test_alter_table_set_tablespace_ptrack(self):
496
502
result_new = node_restored .safe_psql ("postgres" , "select * from t_heap" )
497
503
498
504
self .assertEqual (result , result_new , 'lost some data after restore' )
505
+ if self .paranoia :
506
+ self .compare_pgdata (pgdata , pgdata_restored )
499
507
500
508
# Clean after yourself
501
509
self .del_test_dir (module_name , fname )
@@ -538,9 +546,10 @@ def test_alter_database_set_tablespace_ptrack(self):
538
546
"-T" , "{0}={1}" .format (self .get_tblspace_path (node ,'somedata' ), self .get_tblspace_path (node_restored ,'somedata' ))])
539
547
540
548
# GET PHYSICAL CONTENT
541
- pgdata_new = self .pgdata_content (node_restored .data_dir )
549
+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
542
550
# COMPARE PHYSICAL CONTENT
543
- # self.compare_pgdata(pgdata, pgdata_restored)
551
+ if self .paranoia :
552
+ self .compare_pgdata (pgdata , pgdata_restored )
544
553
# START RESTORED NODE
545
554
node_restored .start ()
546
555
@@ -649,9 +658,8 @@ def test_ptrack_alter_tablespace(self):
649
658
"-j" , "4" , "-T" , "{0}={1}" .format (tblspc_path , tblspc_path_new )])
650
659
result = node .safe_psql ("postgres" , "select * from t_heap" )
651
660
652
- pgdata_new = self .pgdata_content (restored_node .data_dir )
653
- # COMPARE PHYSICAL CONTENT
654
- # self.compare_pgdata(pgdata, pgdata_restored)
661
+ pgdata_restored = self .pgdata_content (restored_node .data_dir )
662
+
655
663
# START RESTORED NODE
656
664
restored_node .append_conf ("postgresql.auto.conf" , "port = {0}" .format (restored_node .port ))
657
665
restored_node .start ()
@@ -660,6 +668,11 @@ def test_ptrack_alter_tablespace(self):
660
668
661
669
result_new = restored_node .safe_psql ("postgres" , "select * from t_heap" )
662
670
self .assertEqual (result , result_new )
671
+
672
+ # COMPARE PHYSICAL CONTENT
673
+ if self .paranoia :
674
+ self .compare_pgdata (pgdata , pgdata_restored )
675
+
663
676
restored_node .cleanup ()
664
677
shutil .rmtree (tblspc_path_new , ignore_errors = True )
665
678
@@ -675,9 +688,8 @@ def test_ptrack_alter_tablespace(self):
675
688
"-j" , "4" , "-T" , "{0}={1}" .format (tblspc_path , tblspc_path_new )])
676
689
restored_node .append_conf ("postgresql.auto.conf" , "port = {0}" .format (restored_node .port ))
677
690
678
- # COMPARE PHYSICAL CONTENT
679
- pgdata_new = self .pgdata_content (restored_node .data_dir )
680
- # self.compare_pgdata(pgdata, pgdata_restored)
691
+ # GET PHYSICAL CONTENT
692
+ pgdata_restored = self .pgdata_content (restored_node .data_dir )
681
693
682
694
# START RESTORED NODE
683
695
restored_node .start ()
@@ -687,13 +699,16 @@ def test_ptrack_alter_tablespace(self):
687
699
result_new = restored_node .safe_psql ("postgres" , "select * from t_heap" )
688
700
self .assertEqual (result , result_new )
689
701
702
+ if self .paranoia :
703
+ # COMPARE PHYSICAL CONTENT
704
+ self .compare_pgdata (pgdata , pgdata_restored )
705
+
690
706
# Clean after yourself
691
707
self .del_test_dir (module_name , fname )
692
708
693
709
# @unittest.skip("skip")
694
710
def test_relation_with_multiple_segments (self ):
695
711
"""Make node, create table, alter table tablespace, take ptrack backup, move table from tablespace, take ptrack backup"""
696
- self .maxDiff = None
697
712
fname = self .id ().split ('.' )[3 ]
698
713
backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
699
714
node = self .make_simple_node (base_dir = "{0}/{1}/node" .format (module_name , fname ),
@@ -736,7 +751,6 @@ def test_relation_with_multiple_segments(self):
736
751
737
752
# GET PHYSICAL CONTENT FROM NODE_RESTORED
738
753
pgdata_restored = self .pgdata_content (restored_node .data_dir )
739
- # self.compare_pgdata(pgdata, pgdata_restored)
740
754
741
755
# START RESTORED NODE
742
756
restored_node .append_conf ("postgresql.auto.conf" , "port = {0}" .format (restored_node .port ))
@@ -745,7 +759,12 @@ def test_relation_with_multiple_segments(self):
745
759
time .sleep (1 )
746
760
747
761
result_new = restored_node .safe_psql ("postgres" , "select * from pgbench_accounts" )
762
+
763
+ # COMPARE RESTORED FILES
748
764
self .assertEqual (result , result_new )
749
765
766
+ if self .paranoia :
767
+ self .compare_pgdata (pgdata , pgdata_restored )
768
+
750
769
# Clean after yourself
751
770
self .del_test_dir (module_name , fname )
0 commit comments