Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2927549

Browse files
committed
tests: fixes for 2.3.0
1 parent04dacea commit2927549

File tree

6 files changed

+148
-19
lines changed

6 files changed

+148
-19
lines changed

‎tests/archive.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,6 @@ def test_archive_catalog(self):
12001200
os.path.join(backup_dir,'wal','master'),
12011201
os.path.join(backup_dir,'wal','replica'))
12021202

1203-
# Check data correctness on replica
12041203
replica.slow_start(replica=True)
12051204

12061205
# FULL backup replica

‎tests/compatibility.py‎

Lines changed: 133 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
importos
44
from .helpers.ptrack_helpersimportProbackupTest,ProbackupException
55
fromsysimportexit
6+
importshutil
67

78
module_name='compatibility'
89

@@ -627,24 +628,23 @@ def test_backward_compatibility_merge_1(self):
627628
self.set_archiving(backup_dir,'node',node,old_binary=True)
628629
node.slow_start()
629630

630-
node.pgbench_init(scale=1)
631+
node.pgbench_init(scale=20)
631632

632633
# FULL backup with OLD binary
633634
self.backup_node(
634-
backup_dir,'node',node,
635-
old_binary=True)
635+
backup_dir,'node',node,old_binary=True)
636636

637637
pgbench=node.pgbench(
638638
stdout=subprocess.PIPE,
639639
stderr=subprocess.STDOUT,
640-
options=["-c","4","-T","10"])
640+
options=["-c","1","-T","10","--no-vacuum"])
641641
pgbench.wait()
642642
pgbench.stdout.close()
643643

644644
# PAGE1 backup with OLD binary
645-
backup_id=self.backup_node(
645+
self.backup_node(
646646
backup_dir,'node',node,
647-
backup_type='page',old_binary=True)
647+
backup_type='page',old_binary=True,options=['--log-level-file=LOG'])
648648

649649
node.safe_psql(
650650
'postgres',
@@ -655,20 +655,20 @@ def test_backward_compatibility_merge_1(self):
655655
'VACUUM pgbench_accounts')
656656

657657
# PAGE2 backup with OLD binary
658-
backup_id=self.backup_node(
658+
self.backup_node(
659659
backup_dir,'node',node,
660-
backup_type='page',old_binary=True)
660+
backup_type='page',old_binary=True,options=['--log-level-file=LOG'])
661661

662662
# PAGE3 backup with OLD binary
663663
backup_id=self.backup_node(
664664
backup_dir,'node',node,
665-
backup_type='page',old_binary=True)
665+
backup_type='page',old_binary=True,options=['--log-level-file=LOG'])
666666

667667
pgdata=self.pgdata_content(node.data_dir)
668668

669669
# merge chain created by old binary with new binary
670670
output=self.merge_backup(
671-
backup_dir,"node",backup_id)
671+
backup_dir,"node",backup_id,options=['--log-level-file=LOG'])
672672

673673
# check that in-place is disabled
674674
self.assertIn(
@@ -689,6 +689,129 @@ def test_backward_compatibility_merge_1(self):
689689
# Clean after yourself
690690
self.del_test_dir(module_name,fname)
691691

692+
# @unittest.expectedFailure
693+
# @unittest.skip("skip")
694+
deftest_backward_compatibility_merge_2(self):
695+
"""
696+
Create node, take FULL and PAGE backups with old binary,
697+
merge them with new binary.
698+
old binary version =< 2.2.7
699+
"""
700+
fname=self.id().split('.')[3]
701+
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
702+
node=self.make_simple_node(
703+
base_dir=os.path.join(module_name,fname,'node'),
704+
set_replication=True,
705+
initdb_params=['--data-checksums'],
706+
pg_options={'autovacuum':'off'})
707+
708+
self.init_pb(backup_dir,old_binary=True)
709+
self.add_instance(backup_dir,'node',node,old_binary=True)
710+
711+
self.set_archiving(backup_dir,'node',node,old_binary=True)
712+
node.slow_start()
713+
714+
node.pgbench_init(scale=50)
715+
716+
node.safe_psql(
717+
'postgres',
718+
'VACUUM pgbench_accounts')
719+
720+
node_restored=self.make_simple_node(
721+
base_dir=os.path.join(module_name,fname,'node_restored'))
722+
723+
# FULL backup with OLD binary
724+
self.backup_node(backup_dir,'node',node,old_binary=True)
725+
726+
pgbench=node.pgbench(
727+
stdout=subprocess.PIPE,
728+
stderr=subprocess.STDOUT,
729+
options=["-c","1","-T","10","--no-vacuum"])
730+
pgbench.wait()
731+
pgbench.stdout.close()
732+
733+
# PAGE1 backup with OLD binary
734+
page1=self.backup_node(
735+
backup_dir,'node',node,
736+
backup_type='page',old_binary=True)
737+
738+
pgdata1=self.pgdata_content(node.data_dir)
739+
740+
node.safe_psql(
741+
'postgres',
742+
"DELETE from pgbench_accounts where ctid > '(10,1)'")
743+
744+
# PAGE2 backup with OLD binary
745+
page2=self.backup_node(
746+
backup_dir,'node',node,
747+
backup_type='page',old_binary=True)
748+
749+
pgdata2=self.pgdata_content(node.data_dir)
750+
751+
# PAGE3 backup with OLD binary
752+
page3=self.backup_node(
753+
backup_dir,'node',node,
754+
backup_type='page',old_binary=True)
755+
756+
pgdata3=self.pgdata_content(node.data_dir)
757+
758+
pgbench=node.pgbench(
759+
stdout=subprocess.PIPE,
760+
stderr=subprocess.STDOUT,
761+
options=["-c","1","-T","10","--no-vacuum"])
762+
pgbench.wait()
763+
pgbench.stdout.close()
764+
765+
# PAGE4 backup with NEW binary
766+
page4=self.backup_node(
767+
backup_dir,'node',node,backup_type='page')
768+
pgdata4=self.pgdata_content(node.data_dir)
769+
770+
# merge backups one by one and check data correctness
771+
# merge PAGE1
772+
self.merge_backup(
773+
backup_dir,"node",page1,options=['--log-level-file=VERBOSE'])
774+
775+
# check data correctness for PAGE1
776+
node_restored.cleanup()
777+
self.restore_node(
778+
backup_dir,'node',node_restored,backup_id=page1,
779+
options=['--log-level-file=VERBOSE'])
780+
pgdata_restored=self.pgdata_content(node_restored.data_dir)
781+
self.compare_pgdata(pgdata1,pgdata_restored)
782+
783+
# merge PAGE2
784+
self.merge_backup(backup_dir,"node",page2)
785+
786+
# check data correctness for PAGE2
787+
node_restored.cleanup()
788+
self.restore_node(backup_dir,'node',node_restored,backup_id=page2)
789+
pgdata_restored=self.pgdata_content(node_restored.data_dir)
790+
self.compare_pgdata(pgdata2,pgdata_restored)
791+
792+
# merge PAGE3
793+
self.show_pb(backup_dir,'node',page3)
794+
self.merge_backup(backup_dir,"node",page3)
795+
self.show_pb(backup_dir,'node',page3)
796+
797+
# check data correctness for PAGE3
798+
node_restored.cleanup()
799+
self.restore_node(backup_dir,'node',node_restored,backup_id=page3)
800+
pgdata_restored=self.pgdata_content(node_restored.data_dir)
801+
self.compare_pgdata(pgdata3,pgdata_restored)
802+
803+
# merge PAGE4
804+
self.merge_backup(backup_dir,"node",page4)
805+
806+
# check data correctness for PAGE4
807+
node_restored.cleanup()
808+
self.restore_node(backup_dir,'node',node_restored,backup_id=page4)
809+
pgdata_restored=self.pgdata_content(node_restored.data_dir)
810+
self.compare_pgdata(pgdata4,pgdata_restored)
811+
812+
# Clean after yourself
813+
self.del_test_dir(module_name,fname)
814+
692815
# @unittest.skip("skip")
693816
deftest_page_vacuum_truncate(self):
694817
"""

‎tests/helpers/ptrack_helpers.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ def make_simple_node(
340340

341341
# set major version
342342
withopen(os.path.join(node.data_dir,'PG_VERSION'))asf:
343-
node.major_version=float(str(f.read().rstrip()))
343+
node.major_version_str=str(f.read().rstrip())
344+
node.major_version=float(node.major_version_str)
344345

345346
# Sane default parameters
346347
options= {}

‎tests/ptrack.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ def test_ptrack_uncommitted_xact(self):
388388
set_replication=True,
389389
ptrack_enable=True,
390390
initdb_params=['--data-checksums'],
391-
pg_options={'wal_level':'replica'})
391+
pg_options={
392+
'wal_level':'replica',
393+
'autovacuum':'off'})
392394

393395
self.init_pb(backup_dir)
394396
self.add_instance(backup_dir,'node',node)
@@ -421,19 +423,20 @@ def test_ptrack_uncommitted_xact(self):
421423
node_restored.cleanup()
422424

423425
self.restore_node(
424-
backup_dir,'node',node_restored,options=["-j","4"])
426+
backup_dir,'node',node_restored,
427+
node_restored.data_dir,options=["-j","4"])
425428

426-
# Physical comparison
427-
ifself.paranoia:
428-
pgdata_restored=self.pgdata_content(
429+
pgdata_restored=self.pgdata_content(
429430
node_restored.data_dir,ignore_ptrack=False)
430-
self.compare_pgdata(pgdata,pgdata_restored)
431431

432432
self.set_auto_conf(
433433
node_restored, {'port':node_restored.port})
434434

435435
node_restored.slow_start()
436436

437+
# Physical comparison
438+
self.compare_pgdata(pgdata,pgdata_restored)
439+
437440
# Clean after yourself
438441
self.del_test_dir(module_name,fname)
439442

‎tests/replica.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,9 @@ def test_replica_promote_archive_page(self):
14551455
# node1 is back to be a master
14561456
node1.promote()
14571457
node1.safe_psql('postgres','CHECKPOINT')
1458+
self.switch_wal_segment(node1)
1459+
1460+
sleep(5)
14581461

14591462
# delta3_id = self.backup_node(
14601463
# backup_dir, 'node', node2, node2.data_dir, 'delta')

‎tests/restore.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2462,7 +2462,7 @@ def test_partial_restore_exclude_tablespace(self):
24622462
node.slow_start()
24632463

24642464
cat_version=node.get_control_data()["Catalog version number"]
2465-
version_specific_dir='PG_'+str(node.major_version)+'_'+cat_version
2465+
version_specific_dir='PG_'+node.major_version_str+'_'+cat_version
24662466

24672467
# PG_10_201707211
24682468
# pg_tblspc/33172/PG_9.5_201510051/16386/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp