Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0493eab

Browse files
committed
tests: added backup.BackupTest.test_backup_concurrent_drop_table and compatibility.CompatibilityTest.test_backup_concurrent_drop_table
1 parent ebeebca commit 0493eab

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

tests/backup.py

+45
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,51 @@ def test_temp_slot_for_stream_backup(self):
10021002
# Clean after yourself
10031003
self.del_test_dir(module_name, fname)
10041004

1005+
# @unittest.skip("skip")
1006+
def test_backup_concurrent_drop_table(self):
1007+
""""""
1008+
fname = self.id().split('.')[3]
1009+
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
1010+
node = self.make_simple_node(
1011+
base_dir=os.path.join(module_name, fname, 'node'),
1012+
set_replication=True,
1013+
initdb_params=['--data-checksums'])
1014+
1015+
self.init_pb(backup_dir)
1016+
self.add_instance(backup_dir, 'node', node)
1017+
self.set_archiving(backup_dir, 'node', node)
1018+
node.slow_start()
1019+
1020+
node.pgbench_init(scale=5)
1021+
1022+
# FULL backup
1023+
gdb = self.backup_node(
1024+
backup_dir, 'node', node,
1025+
options=['--stream', '--compress', '--log-level-file=VERBOSE'],
1026+
gdb=True)
1027+
1028+
gdb.set_breakpoint('backup_data_file')
1029+
gdb.run_until_break()
1030+
1031+
node.safe_psql(
1032+
'postgres',
1033+
'DROP TABLE pgbench_accounts')
1034+
1035+
# do checkpoint to guarantee filenode removal
1036+
node.safe_psql(
1037+
'postgres',
1038+
'CHECKPOINT')
1039+
1040+
gdb.remove_all_breakpoints()
1041+
gdb.continue_execution_until_exit()
1042+
1043+
show_backup = self.show_pb(backup_dir, 'node')[0]
1044+
1045+
self.assertEqual(show_backup['status'], "OK")
1046+
1047+
# Clean after yourself
1048+
self.del_test_dir(module_name, fname)
1049+
10051050
# @unittest.skip("skip")
10061051
def test_pg_11_adjusted_wal_segment_size(self):
10071052
""""""

tests/compatibility.py

+46
Original file line numberDiff line numberDiff line change
@@ -537,3 +537,49 @@ def test_backward_compatibility_merge(self):
537537

538538
# Clean after yourself
539539
self.del_test_dir(module_name, fname)
540+
541+
# @unittest.skip("skip")
542+
def test_backup_concurrent_drop_table(self):
543+
""""""
544+
fname = self.id().split('.')[3]
545+
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
546+
node = self.make_simple_node(
547+
base_dir=os.path.join(module_name, fname, 'node'),
548+
set_replication=True,
549+
initdb_params=['--data-checksums'])
550+
551+
self.init_pb(backup_dir)
552+
self.add_instance(backup_dir, 'node', node, old_binary=True)
553+
node.slow_start()
554+
555+
node.pgbench_init(scale=5)
556+
557+
# FULL backup
558+
gdb = self.backup_node(
559+
backup_dir, 'node', node,
560+
options=['--stream', '--compress', '--log-level-file=VERBOSE'],
561+
gdb=True, old_binary=True)
562+
563+
gdb.set_breakpoint('backup_data_file')
564+
gdb.run_until_break()
565+
566+
node.safe_psql(
567+
'postgres',
568+
'DROP TABLE pgbench_accounts')
569+
570+
# do checkpoint to guarantee filenode removal
571+
node.safe_psql(
572+
'postgres',
573+
'CHECKPOINT')
574+
575+
gdb.remove_all_breakpoints()
576+
gdb.continue_execution_until_exit()
577+
578+
# show_backup = self.show_pb(backup_dir, 'node')[0]
579+
# self.assertEqual(show_backup['status'], "OK")
580+
581+
# validate with fresh binary, it MUST be successful
582+
self.validate_pb(backup_dir)
583+
584+
# Clean after yourself
585+
self.del_test_dir(module_name, fname)

0 commit comments

Comments
 (0)