mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-05-13 22:26:34 +02:00
Bug fix. Fix race condition with parallel MERGE
This commit is contained in:
parent
13fb0489b7
commit
ad5cda62fd
@ -352,15 +352,10 @@ merge_files(void *arg)
|
|||||||
merge_files_arg *argument = (merge_files_arg *) arg;
|
merge_files_arg *argument = (merge_files_arg *) arg;
|
||||||
pgBackup *to_backup = argument->to_backup;
|
pgBackup *to_backup = argument->to_backup;
|
||||||
pgBackup *from_backup = argument->from_backup;
|
pgBackup *from_backup = argument->from_backup;
|
||||||
char tmp_file_path[MAXPGPATH];
|
|
||||||
int i,
|
int i,
|
||||||
num_files = parray_num(argument->files);
|
num_files = parray_num(argument->files);
|
||||||
int to_root_len = strlen(argument->to_root);
|
int to_root_len = strlen(argument->to_root);
|
||||||
|
|
||||||
if (to_backup->compress_alg == PGLZ_COMPRESS ||
|
|
||||||
to_backup->compress_alg == ZLIB_COMPRESS)
|
|
||||||
join_path_components(tmp_file_path, argument->to_root, "tmp");
|
|
||||||
|
|
||||||
for (i = 0; i < num_files; i++)
|
for (i = 0; i < num_files; i++)
|
||||||
{
|
{
|
||||||
pgFile *file = (pgFile *) parray_get(argument->files, i);
|
pgFile *file = (pgFile *) parray_get(argument->files, i);
|
||||||
@ -433,8 +428,11 @@ merge_files(void *arg)
|
|||||||
if (to_backup->compress_alg == PGLZ_COMPRESS ||
|
if (to_backup->compress_alg == PGLZ_COMPRESS ||
|
||||||
to_backup->compress_alg == ZLIB_COMPRESS)
|
to_backup->compress_alg == ZLIB_COMPRESS)
|
||||||
{
|
{
|
||||||
|
char tmp_file_path[MAXPGPATH];
|
||||||
char *prev_path;
|
char *prev_path;
|
||||||
|
|
||||||
|
join_path_components(tmp_file_path, to_path_tmp, "_tmp");
|
||||||
|
|
||||||
/* Start the magic */
|
/* Start the magic */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -616,7 +616,8 @@ class ProbackupTest(object):
|
|||||||
return self.run_pb(cmd_list + options, async, gdb)
|
return self.run_pb(cmd_list + options, async, gdb)
|
||||||
|
|
||||||
def merge_backup(
|
def merge_backup(
|
||||||
self, backup_dir, instance, backup_id, async=False, gdb=False):
|
self, backup_dir, instance, backup_id, async=False,
|
||||||
|
gdb=False, options=[]):
|
||||||
cmd_list = [
|
cmd_list = [
|
||||||
"merge",
|
"merge",
|
||||||
"-B", backup_dir,
|
"-B", backup_dir,
|
||||||
@ -624,7 +625,7 @@ class ProbackupTest(object):
|
|||||||
"-i", backup_id
|
"-i", backup_id
|
||||||
]
|
]
|
||||||
|
|
||||||
return self.run_pb(cmd_list, async, gdb)
|
return self.run_pb(cmd_list + options, async, gdb)
|
||||||
|
|
||||||
def restore_node(
|
def restore_node(
|
||||||
self, backup_dir, instance, node=False,
|
self, backup_dir, instance, node=False,
|
||||||
|
@ -69,7 +69,8 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.assertEqual(show_backup["backup-mode"], "PAGE")
|
self.assertEqual(show_backup["backup-mode"], "PAGE")
|
||||||
|
|
||||||
# Merge all backups
|
# Merge all backups
|
||||||
self.merge_backup(backup_dir, "node", page_id)
|
self.merge_backup(backup_dir, "node", page_id,
|
||||||
|
options=["-j", "4"])
|
||||||
show_backups = self.show_pb(backup_dir, "node")
|
show_backups = self.show_pb(backup_dir, "node")
|
||||||
|
|
||||||
# sanity check
|
# sanity check
|
||||||
|
Loading…
x
Reference in New Issue
Block a user