Skip to content

Commit 16f5c9a

Browse files
committed
Merge branch 'master' into remote_pull
2 parents dbb787f + 38bd369 commit 16f5c9a

File tree

10 files changed

+63
-49
lines changed

10 files changed

+63
-49
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ endif
4747

4848
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS} -Isrc -I$(top_srcdir)/$(subdir)/src
4949
override CPPFLAGS := -DFRONTEND $(CPPFLAGS) $(PG_CPPFLAGS)
50-
PG_LIBS = $(libpq_pgport) ${PTHREAD_CFLAGS}
50+
PG_LIBS_INTERNAL = $(libpq_pgport) ${PTHREAD_CFLAGS}
5151

5252
all: checksrcdir $(INCLUDES);
5353

src/help.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ help_pg_probackup(void)
9797
printf(_(" [--format=format]\n"));
9898

9999
printf(_("\n %s backup -B backup-path -b backup-mode --instance=instance_name\n"), PROGRAM_NAME);
100-
printf(_(" [-C] [--stream [-S slot-name] [--temp-slot]\n"));
100+
printf(_(" [-C] [--stream [-S slot-name]] [--temp-slot]\n"));
101101
printf(_(" [--backup-pg-log] [-j num-threads]\n"));
102102
printf(_(" [--archive-timeout=archive-timeout] [--progress]\n"));
103103
printf(_(" [--log-level-console=log-level-console]\n"));

src/merge.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,9 @@ merge_backups(pgBackup *to_backup, pgBackup *from_backup)
288288
to_backup->end_time = time(NULL);
289289

290290
/*
291-
* If one of the backups isn't "stream" backup then the target backup become
292-
* non-stream backup too.
291+
* Target backup must inherit wal mode too.
293292
*/
294-
to_backup->stream = to_backup->stream && from_backup->stream;
293+
to_backup->stream = from_backup->stream;
295294
/* Compute summary of size of regular files in the backup */
296295
to_backup->data_bytes = 0;
297296
for (i = 0; i < parray_num(files); i++)

tests/__init__.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from . import init_test, merge, option_test, show_test, compatibility, \
44
backup_test, delete_test, delta, restore_test, validate_test, \
5-
retention_test, pgpro560, pgpro589, false_positive, replica, \
5+
retention_test, pgpro560, pgpro589, pgpro2068, false_positive, replica, \
66
compression, page, ptrack, archive, exclude, cfs_backup, cfs_restore, \
77
cfs_validate_backup, auth_test, time_stamp, snapfs, logging, \
88
locking, remote
@@ -47,18 +47,8 @@ def load_tests(loader, tests, pattern):
4747
# ToDo:
4848
# archive:
4949
# discrepancy of instance`s SYSTEMID and node`s SYSTEMID should lead to archive-push refusal to work
50-
# replica:
51-
# backup should exit with correct error message if some master* option is missing
52-
# --master* options shoukd not work when backuping master
5350
# logging:
5451
# https://jira.postgrespro.ru/browse/PGPRO-584
5552
# https://jira.postgrespro.ru/secure/attachment/20420/20420_doc_logging.md
5653
# archive:
5754
# immediate recovery and full recovery
58-
# backward compatibility:
59-
# previous version catalog must be readable by newer version
60-
# incremental chain from previous version can be continued
61-
# backups from previous version can be restored
62-
# 10vanilla_1.3ptrack +
63-
# 10vanilla+
64-
# 9.6vanilla_1.3ptrack +

tests/delta.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,7 @@ def test_delta_vacuum_full(self):
562562
acurs.execute("VACUUM FULL t_heap")
563563

564564
if gdb.stopped_in_breakpoint():
565-
if gdb.continue_execution_until_break(20) != 'breakpoint-hit':
566-
print('Failed to hit breakpoint')
567-
exit(1)
565+
gdb.continue_execution_until_break(20)
568566

569567
self.backup_node(
570568
backup_dir, 'node', node,

tests/expected/option_help.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ pg_probackup - utility to manage backup/recovery of PostgreSQL database.
2929
[--format=format]
3030

3131
pg_probackup backup -B backup-path -b backup-mode --instance=instance_name
32-
[-C] [--stream [-S slot-name]] [--backup-pg-log]
33-
[-j num-threads] [--archive-timeout=archive-timeout]
34-
[--progress]
32+
[-C] [--stream [-S slot-name]] [--temp-slot]
33+
[--backup-pg-log] [-j num-threads]
34+
[--archive-timeout=archive-timeout] [--progress]
3535
[--log-level-console=log-level-console]
3636
[--log-level-file=log-level-file]
3737
[--log-filename=log-filename]

tests/helpers/ptrack_helpers.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,17 +1463,14 @@ def continue_execution_until_break(self, ignore_count=0):
14631463
else:
14641464
result = self._execute('continue', False)
14651465

1466-
running = False
14671466
for line in result:
1468-
if line.startswith('*running'):
1469-
running = True
14701467
if line.startswith('*stopped,reason="breakpoint-hit"'):
1471-
return 'breakpoint-hit'
1468+
return
14721469
if line.startswith('*stopped,reason="exited-normally"'):
1473-
return 'exited-normally'
1470+
break
14741471

1475-
if running:
1476-
return 'running'
1472+
raise GdbException(
1473+
'Failed to continue execution until break.\n')
14771474

14781475
def stopped_in_breakpoint(self):
14791476
output = []

tests/locking.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ def test_locking_running_validate_1(self):
3737
gdb.set_breakpoint('copy_file')
3838
gdb.run_until_break()
3939

40-
if gdb.continue_execution_until_break(20) != 'breakpoint-hit':
41-
self.AssertTrue(False, 'Failed to hit breakpoint')
40+
gdb.continue_execution_until_break(20)
4241

4342
self.assertEqual(
4443
'OK', self.show_pb(backup_dir, 'node')[0]['status'])
@@ -93,8 +92,7 @@ def test_locking_running_validate_2(self):
9392
gdb.set_breakpoint('copy_file')
9493
gdb.run_until_break()
9594

96-
if gdb.continue_execution_until_break(20) != 'breakpoint-hit':
97-
self.AssertTrue(False, 'Failed to hit breakpoint')
95+
gdb.continue_execution_until_break(20)
9896

9997
gdb._execute('signal SIGKILL')
10098
gdb.continue_execution_until_error()
@@ -164,8 +162,7 @@ def test_locking_running_validate_2_specific_id(self):
164162
gdb.set_breakpoint('copy_file')
165163
gdb.run_until_break()
166164

167-
if gdb.continue_execution_until_break(20) != 'breakpoint-hit':
168-
self.AssertTrue(False, 'Failed to hit breakpoint')
165+
gdb.continue_execution_until_break(20)
169166

170167
gdb._execute('signal SIGKILL')
171168
gdb.continue_execution_until_error()
@@ -263,8 +260,7 @@ def test_locking_running_3(self):
263260
gdb.set_breakpoint('copy_file')
264261
gdb.run_until_break()
265262

266-
if gdb.continue_execution_until_break(20) != 'breakpoint-hit':
267-
self.AssertTrue(False, 'Failed to hit breakpoint')
263+
gdb.continue_execution_until_break(20)
268264

269265
gdb._execute('signal SIGKILL')
270266
gdb.continue_execution_until_error()

tests/merge.py

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,9 +1071,7 @@ def test_continue_failed_merge(self):
10711071
gdb.set_breakpoint('copy_file')
10721072
gdb.run_until_break()
10731073

1074-
if gdb.continue_execution_until_break(20) != 'breakpoint-hit':
1075-
print('Failed to hit breakpoint')
1076-
exit(1)
1074+
gdb.continue_execution_until_break(20)
10771075

10781076
gdb._execute('signal SIGKILL')
10791077

@@ -1154,9 +1152,7 @@ def test_continue_failed_merge_with_corrupted_delta_backup(self):
11541152
gdb.set_breakpoint('copy_file')
11551153
gdb.run_until_break()
11561154

1157-
if gdb.continue_execution_until_break(2) != 'breakpoint-hit':
1158-
print('Failed to hit breakpoint')
1159-
exit(1)
1155+
gdb.continue_execution_until_break(2)
11601156

11611157
gdb._execute('signal SIGKILL')
11621158

@@ -1252,9 +1248,7 @@ def test_continue_failed_merge_2(self):
12521248
gdb.set_breakpoint('fio_unlink')
12531249
gdb.run_until_break()
12541250

1255-
if gdb.continue_execution_until_break(20) != 'breakpoint-hit':
1256-
print('Failed to hit breakpoint')
1257-
exit(1)
1251+
gdb.continue_execution_until_break(20)
12581252

12591253
gdb._execute('signal SIGKILL')
12601254

@@ -1333,6 +1327,48 @@ def test_merge_different_compression_algo(self):
13331327

13341328
self.del_test_dir(module_name, fname)
13351329

1330+
def test_merge_different_wal_modes(self):
1331+
"""
1332+
Check that backups with different wal modes can be merged
1333+
correctly
1334+
"""
1335+
fname = self.id().split('.')[3]
1336+
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
1337+
node = self.make_simple_node(
1338+
base_dir=os.path.join(module_name, fname, 'node'),
1339+
set_replication=True,
1340+
initdb_params=['--data-checksums'])
1341+
1342+
self.init_pb(backup_dir)
1343+
self.add_instance(backup_dir, 'node', node)
1344+
self.set_archiving(backup_dir, 'node', node)
1345+
node.slow_start()
1346+
1347+
# FULL stream backup
1348+
self.backup_node(
1349+
backup_dir, 'node', node, options=['--stream'])
1350+
1351+
# DELTA archive backup
1352+
backup_id = self.backup_node(
1353+
backup_dir, 'node', node, backup_type='delta')
1354+
1355+
self.merge_backup(backup_dir, 'node', backup_id=backup_id)
1356+
1357+
self.assertEqual(
1358+
'ARCHIVE', self.show_pb(backup_dir, 'node', backup_id)['wal'])
1359+
1360+
# DELTA stream backup
1361+
backup_id = self.backup_node(
1362+
backup_dir, 'node', node,
1363+
backup_type='delta', options=['--stream'])
1364+
1365+
self.merge_backup(backup_dir, 'node', backup_id=backup_id)
1366+
1367+
self.assertEqual(
1368+
'STREAM', self.show_pb(backup_dir, 'node', backup_id)['wal'])
1369+
1370+
self.del_test_dir(module_name, fname)
1371+
13361372
# 1. always use parent link when merging (intermediates may be from different chain)
13371373
# 2. page backup we are merging with may disappear after failed merge,
13381374
# it should not be possible to continue merge after that

tests/ptrack.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,7 @@ def test_ptrack_vacuum_full(self):
241241
acurs.execute("VACUUM FULL t_heap")
242242

243243
if gdb.stopped_in_breakpoint():
244-
if gdb.continue_execution_until_break(20) != 'breakpoint-hit':
245-
print('Failed to hit breakpoint')
246-
exit(1)
244+
gdb.continue_execution_until_break(20)
247245

248246
self.backup_node(
249247
backup_dir, 'node', node, backup_type='ptrack')

0 commit comments

Comments
 (0)