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

Appearance settings

Commit be2b90b

Browse filesBrowse files
author
Sergey Fukanchik
committed
PBCKP-553 fix a typo in merge preconditions check
1 parent 7249b10 commit be2b90b
Copy full SHA for be2b90b

File tree

Expand file treeCollapse file tree

2 files changed

+42
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+42
-1
lines changed

‎src/merge.c

Copy file name to clipboardExpand all lines: src/merge.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ do_merge(InstanceState *instanceState, time_t backup_id, bool no_validate, bool
337337
else
338338
{
339339
if ((full_backup->status == BACKUP_STATUS_MERGED ||
340-
full_backup->status == BACKUP_STATUS_MERGED) &&
340+
full_backup->status == BACKUP_STATUS_MERGING) &&
341341
dest_backup->start_time != full_backup->merge_dest_backup)
342342
{
343343
elog(ERROR, "Full backup %s has unfinished merge with backup %s",

‎tests/merge_test.py

Copy file name to clipboardExpand all lines: tests/merge_test.py
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,5 +2734,46 @@ def test_merge_pg_filenode_map(self):
27342734
'postgres',
27352735
'select 1')
27362736

2737+
def test_unfinished_merge(self):
2738+
""" Test when parent has unfinished merge with a different backup. """
2739+
self._check_gdb_flag_or_skip_test()
2740+
cases = [('fail_merged', 'write_backup_filelist', ['MERGED', 'MERGING', 'OK']),
2741+
('fail_merging', 'pgBackupWriteControl', ['MERGING', 'OK', 'OK'])]
2742+
2743+
for name, terminate_at, states in cases:
2744+
node_name = 'node_' + name
2745+
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, name)
2746+
node = self.make_simple_node(
2747+
base_dir=os.path.join(self.module_name, self.fname, node_name),
2748+
set_replication=True,
2749+
initdb_params=['--data-checksums'])
2750+
2751+
self.init_pb(backup_dir)
2752+
self.add_instance(backup_dir, node_name, node)
2753+
self.set_archiving(backup_dir, node_name, node)
2754+
node.slow_start()
2755+
2756+
full_id=self.backup_node(backup_dir, node_name, node, options=['--stream'])
2757+
2758+
backup_id = self.backup_node(backup_dir, node_name, node, backup_type='delta')
2759+
second_backup_id = self.backup_node(backup_dir, node_name, node, backup_type='delta')
2760+
2761+
gdb = self.merge_backup(backup_dir, node_name, backup_id, gdb=True)
2762+
gdb.set_breakpoint(terminate_at)
2763+
gdb.run_until_break()
2764+
2765+
gdb.remove_all_breakpoints()
2766+
gdb._execute('signal SIGINT')
2767+
gdb.continue_execution_until_error()
2768+
2769+
print(self.show_pb(backup_dir, node_name, as_json=False, as_text=True))
2770+
2771+
for expected, real in zip(states, self.show_pb(backup_dir, node_name), strict=True):
2772+
self.assertEqual(expected, real['status'])
2773+
2774+
with self.assertRaisesRegex(ProbackupException,
2775+
f"Full backup {full_id} has unfinished merge with backup {backup_id}"):
2776+
self.merge_backup(backup_dir, node_name, second_backup_id, gdb=False)
2777+
27372778
# 1. Need new test with corrupted FULL backup
27382779
# 2. different compression levels

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.