10000 Merge branch 'REL_2_5' into REL_2_5-PBCKP-304 · postgrespro/pg_probackup@516d325 · GitHub
[go: up one dir, main page]

Skip to content

Commit 516d325

Browse files
committed
Merge branch 'REL_2_5' into REL_2_5-PBCKP-304
2 parents af4fb2e + 858de55 commit 516d325

20 files changed

+106
-72
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ env:
3535
- PG_VERSION=10 PG_BRANCH=REL_10_STABLE
3636
- PG_VERSION=9.6 PG_BRANCH=REL9_6_STABLE
3737
- PG_VERSION=9.5 PG_BRANCH=REL9_5_STABLE
38-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=archive
38+
- PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup.BackupTest.test_full_backup
39+
- PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup.BackupTest.test_full_backup_stream
3940
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=backup
4041
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=catchup
4142
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=checkdb

src/pg_probackup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ typedef enum ShowFormat
345345
#define BYTES_INVALID (-1) /* file didn`t changed since previous backup, DELTA backup do not rely on it */
346346
#define FILE_NOT_FOUND (-2) /* file disappeared during backup */
347347
#define BLOCKNUM_INVALID (-1)
348-
#define PROGRAM_VERSION "2.5.9"
348+
#define PROGRAM_VERSION "2.5.10"
349349

350350
/* update when remote agent API or behaviour changes */
351351
#define AGENT_PROTOCOL_VERSION 20509

tests/archive.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_pgpro434_2(self):
7878
)
7979

8080
if self.get_version(node) < self.version_to_num('9.6.0'):
81-
return unittest.skip(
81+
self.skipTest(
8282
'Skipped because pg_control_checkpoint() is not supported in PG 9.5')
8383

8484
self.init_pb(backup_dir)
@@ -680,7 +680,7 @@ def test_replica_archive(self):
680680
'max_wal_size': '32MB'})
681681

682682
if self.get_version(master) < self.version_to_num('9.6.0'):
683-
return unittest.skip(
683+
self.skipTest(
684684
'Skipped because backup from replica is not supported in PG 9.5')
685685

686686
self.init_pb(backup_dir)
@@ -806,7 +806,7 @@ def test_master_and_replica_parallel_archiving(self):
806806
)
807807

808808
if self.get_version(master) < self.version_to_num('9.6.0'):
809-
return unittest.skip(
809+
self.skipTest(
810810
'Skipped because backup from replica is not supported in PG 9.5')
811811

812812
replica = self.make_simple_node(
@@ -884,7 +884,7 @@ def test_basic_master_and_replica_concurrent_archiving(self):
884884
make sure that archiving on both node is working.
885885
"""
886886
if self.pg_config_version < self.version_to_num('9.6.0'):
887-
return unittest.skip('You need PostgreSQL >= 9.6 for this test')
887+
self.skipTest('You need PostgreSQL >= 9.6 for this test')
888888

889889
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
890890
master = self.make_simple_node(
@@ -896,7 +896,7 @@ def test_basic_master_and_replica_concurrent_archiving(self):
896896
'archive_timeout': '10s'})
897897

898898
if self.get_version(master) < self.version_to_num('9.6.0'):
899-
return unittest.skip(
899+
self.skipTest(
900900
'Skipped because backup from replica is not supported in PG 9.5')
901901

902902
replica = self.make_simple_node(
@@ -984,7 +984,7 @@ def test_concurrent_archiving(self):
984984
"""
985985

986986
if self.pg_config_version < self.version_to_num('11.0'):
987-
return unittest.skip('You need PostgreSQL >= 11 for this test')
987+
self.skipTest('You need PostgreSQL >= 11 for this test')
988988

989989
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
990990
master = self.make_simple_node(
@@ -1138,7 +1138,7 @@ def test_archive_pg_receivexlog_compression_pg10(self):
11381138
self.add_instance(backup_dir, 'node', node)
11391139
node.slow_start()
11401140
if self.get_version(node) < self.version_to_num('10.0'):
1141-
return unittest.skip('You need PostgreSQL >= 10 for this test')
1141+
self.skipTest('You need PostgreSQL >= 10 for this test')
11421142
else:
11431143
pg_receivexlog_path = self.get_bin_path('pg_receivewal')
11441144

@@ -1217,7 +1217,7 @@ def test_archive_catalog(self):
12171217
'checkpoint_timeout': '30s'})
12181218

12191219
if self.get_version(master) < self.version_to_num('9.6.0'):
1220-
return unittest.skip(
1220+
self.skipTest(
12211221
'Skipped because backup from replica is not supported in PG 9.5')
12221222

12231223
self.init_pb(backup_dir)
@@ -1857,7 +1857,7 @@ def test_waldir_outside_pgdata_archiving(self):
18571857
check that archive-push works correct with symlinked waldir
18581858
"""
18591859
if self.pg_config_version < self.version_to_num('10.0'):
1860-
return unittest.skip(
1860+
self.skipTest(
18611861
'Skipped because waldir outside pgdata is supported since PG 10')
18621862

18631863
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
@@ -2078,7 +2078,7 @@ def test_archive_pg_receivexlog_partial_handling(self):
20782078
initdb_params=['--data-checksums'])
20792079

20802080
if self.get_version(node) < self.version_to_num('9.6.0'):
2081-
return unittest.skip(
2081+
self.skipTest(
20822082
'Skipped because backup from replica is not supported in PG 9.5')
20832083

20842084
self.init_pb(backup_dir)
@@ -2278,7 +2278,7 @@ def test_archive_get_batching_sanity(self):
22782278
initdb_params=['--data-checksums'])
22792279

22802280
if self.get_version(node) < self.version_to_num('9.6.0'):
2281-
return unittest.skip(
2281+
self.skipTest(
22822282
'Skipped because backup from replica is not supported in PG 9.5')
22832283

22842284
self.init_pb(backup_dir)

tests/backup.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class BackupTest(ProbackupTest, unittest.TestCase):
1212

13-
def test_basic_full_backup(self):
13+
def test_full_backup(self):
1414
"""
1515
Just test full backup with at least two segments
1616
"""
@@ -38,6 +38,34 @@ def test_basic_full_backup(self):
3838
"INFO: Backup {0} is valid".format(backup_id),
3939
out)
4040

41+
def test_full_backup_stream(self):
42+
"""
43+
Just test full backup with at least two segments in stream mode
44+
"""
45+
node = self.make_simple_node(
46+
base_dir=os.path.join(self.module_name, self.fname, 'node'),
47+
initdb_params=['--data-checksums'],
48+
# we need to write a lot. Lets speedup a bit.
49+
pg_options={"fsync": "off", "synchronous_commit": "off"})
50+
51+
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
52+
self.init_pb(backup_dir)
53+
self.add_instance(backup_dir, 'node', node)
54+
node.slow_start()
55+
56+
# Fill with data
57+
# Have to use scale=100 to create second segment.
58+
node.pgbench_init(scale=100, no_vacuum=True)
59+
60+
# FULL
61+
backup_id = self.backup_node(backup_dir, 'node', node,
62+
options=["--stream"])
63+
64+
out = self.validate_pb(backup_dir, 'node', backup_id)
65+
self.assertIn(
66+
"INFO: Backup {0} is valid".format(backup_id),
67+
out)
68+
4169
# @unittest.skip("skip")
4270
# @unittest.expectedFailure
4371
# PGPRO-707
@@ -1375,7 +1403,7 @@ def test_basic_temp_slot_for_stream_backup(self):
13751403
pg_options={'max_wal_size': '40MB'})
13761404

13771405
if self.get_version(node) < self.version_to_num('10.0'):
1378-
return unittest.skip('You need PostgreSQL >= 10 for this test')
1406+
self.skipTest('You need PostgreSQL >= 10 for this test')
13791407

13801408
self.init_pb(backup_dir)
13811409
self.add_instance(backup_dir, 'node', node)
@@ -1440,7 +1468,7 @@ def test_backup_concurrent_drop_table(self):
14401468
def test_pg_11_adjusted_wal_segment_size(self):
14411469
""""""
14421470
if self.pg_config_version < self.version_to_num('11.0'):
1443-
return unittest.skip('You need PostgreSQL >= 11 for this test')
1471+
self.skipTest('You need PostgreSQL >= 11 for this test')
14441472

14451473
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
14461474
node = self.make_simple_node(
@@ -1663,7 +1691,7 @@ def test_drop_table(self):
16631691
def test_basic_missing_file_permissions(self):
16641692
""""""
16651693
if os.name == 'nt':
1666-
return unittest.skip('Skipped because it is POSIX only test')
1694+
self.skipTest('Skipped because it is POSIX only test')
16671695

16681696
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
16691697
node = self.make_simple_node(
@@ -1706,7 +1734,7 @@ def test_basic_missing_file_permissions(self):
17061734
def test_basic_missing_dir_permissions(self):
17071735
""""""
17081736
if os.name == 'nt':
1709-
return unittest.skip('Skipped because it is POSIX only test')
1737+
self.skipTest('Skipped because it is POSIX only test')
17101738

17111739
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
17121740
node = self.make_simple_node(

tests/catchup.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def test_basic_ptrack_catchup(self):
183183
Test ptrack catchup
184184
"""
185185
if not self.ptrack:
186-
return unittest.skip('Skipped because ptrack support is disabled')
186+
self.skipTest('Skipped because ptrack support is disabled')
187187

188188
# preparation 1: source
189189
src_pg = self.make_simple_node(
@@ -327,7 +327,7 @@ def test_tli_ptrack_catchup(self):
327327
Test that we correctly follow timeline change with ptrack catchup
328328
"""
329329
if not self.ptrack:
330-
return unittest.skip('Skipped because ptrack support is disabled')
330+
self.skipTest('Skipped because ptrack support is disabled')
331331

332332
# preparation 1: source
333333
src_pg = self.make_simple_node(
@@ -464,7 +464,7 @@ def test_table_drop_with_ptrack(self):
464464
Test that dropped table in source will be dropped in ptrack catchup'ed instance too
465465
"""
466466
if not self.ptrack:
467-
return unittest.skip('Skipped because ptrack support is disabled')
467+
self.skipTest('Skipped because ptrack support is disabled')
468468

469469
# preparation 1: source
470470
src_pg = self.make_simple_node(
@@ -577,7 +577,7 @@ def test_tablefile_truncation_with_ptrack(self):
577577
Test that truncated table in source will be truncated in ptrack catchup'ed instance too
578578
"""
579579
if not self.ptrack:
580-
return unittest.skip('Skipped because ptrack support is disabled')
580+
self.skipTest('Skipped because ptrack support is disabled')
581581

582582
# preparation 1: source
583583
src_pg = self.make_simple_node(
@@ -641,7 +641,7 @@ def test_local_tablespace_without_mapping(self):
641641
Test that we detect absence of needed --tablespace-mapping option
642642
"""
643643
if self.remote:
644-
return unittest.skip('Skipped because this test tests local catchup error handling')
644+
self.skipTest('Skipped because this test tests local catchup error handling')
645645

646646
src_pg = self.make_simple_node(base_dir = os.path.join(self.module_name, self.fname, 'src'))
647647
src_pg.slow_start()
@@ -1015,7 +1015,7 @@ def test_unclean_ptrack_catchup(self):
10151015
Test that we correctly recover uncleanly shutdowned destination
10161016
"""
10171017
if not self.ptrack:
1018-
return unittest.skip('Skipped because ptrack support is disabled')
1018+
self.skipTest('Skipped because ptrack support is disabled')
10191019

10201020
# preparation 1: source
10211021
src_pg = self.make_simple_node(
@@ -1482,7 +1482,7 @@ def test_dry_run_catchup_ptrack(self):
14821482
Test dry-run option for catchup in incremental ptrack mode
14831483
"""
14841484
if not self.ptrack:
1485-
return unittest.skip('Skipped because ptrack support is disabled')
1485+
self.skipTest('Skipped because ptrack support is disabled')
14861486

14871487
# preparation 1: source
14881488
src_pg = self.make_simple_node(

tests/compatibility.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ def test_backward_compatibility_ptrack(self):
353353
"""Description in jira issue PGPRO-434"""
354354

355355
if not self.ptrack:
356-
return unittest.skip('Skipped because ptrack support is disabled')
356+
self.skipTest('Skipped because ptrack support is disabled')
357357

358358
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
359359
node = self.make_simple_node(

tests/delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def test_delete_increment_page(self):
169169
def test_delete_increment_ptrack(self):
170170
"""delete increment and all after him"""
171171
if not self.ptrack:
172-
return unittest.skip('Skipped because ptrack support is disabled')
172+
self.skipTest('Skipped because ptrack support is disabled')
173173

174174
node = self.make_simple_node(
175175
base_dir=os.path.join(self.module_name, self.fname, 'node'),

tests/expected/option_version.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pg_probackup 2.5.9
1+
pg_probackup 2.5.10

tests/external.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ def test_external_dir_is_symlink(self):
14651465
but restored as directory
14661466
"""
14671467
if os.name == 'nt':
1468-
return unittest.skip('Skipped for Windows')
1468+
self.skipTest('Skipped for Windows')
14691469

14701470
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
14711471
core_dir = os.path.join(self.tmp_path, self.module_name, self.fname)
@@ -1544,7 +1544,7 @@ def test_external_dir_contain_symlink_on_dir(self):
15441544
but restored as directory
15451545
"""
15461546
if os.name == 'nt':
1547-
return unittest.skip('Skipped for Windows')
1547+
self.skipTest('Skipped for Windows')
15481548

15491549
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
15501550
core_dir = os.path.join(self.tmp_path, self.module_name, self.fname)
@@ -1625,7 +1625,7 @@ def test_external_dir_contain_symlink_on_file(self):
16251625
but restored as directory
16261626
"""
16271627
if os.name == 'nt':
1628-
return unittest.skip('Skipped for Windows')
1628+
self.skipTest('Skipped for Windows')
16291629

16301630
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
16311631
core_dir = os.path.join(self.tmp_path, self.module_name, self.fname)

tests/false_positive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_pg_10_waldir(self):
105105
test group access for PG >= 11
106106
"""
107107
if self.pg_config_version < self.version_to_num('10.0'):
108-
return unittest.skip('You need PostgreSQL >= 10 for this test')
108+
self.skipTest('You need PostgreSQL >= 10 for this test')
109109

110110
wal_dir = os.path.join(
111111
os.path.join(self.tmp_path, self.module_name, self.fname), 'wal_dir')

tests/helpers/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
__all__ = ['ptrack_helpers', 'cfs_helpers', 'expected_errors']
2-
#from . import *
2+
3+
import unittest
4+
5+
# python 2.7 compatibility
6+
if not hasattr(unittest.TestCase, "skipTest"):
7+
def skipTest(self, reason):
8+
raise unittest.SkipTest(reason)
9+
unittest.TestCase.skipTest = skipTest

tests/helpers/ptrack_helpers.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,7 @@ def __init__(self, *args, **kwargs):
273273
self.user = self.get_username()
274274
self.probackup_path = None
275275
if 'PGPROBACKUPBIN' in self.test_env:
276-
if (
277-
os.path.isfile(self.test_env["PGPROBACKUPBIN"]) and
278-
os.access(self.test_env["PGPROBACKUPBIN"], os.X_OK)
279-
):
276+
if shutil.which(self.test_env["PGPROBACKUPBIN"]):
280277
self.probackup_path = self.test_env["PGPROBACKUPBIN"]
281278
else:
282279
if self.verbose:

tests/incr_restore.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ def test_make_replica_via_incr_checksum_restore(self):
14001400
initdb_params=['--data-checksums'])
14011401

14021402
if self.get_version(master) < self.version_to_num('9.6.0'):
1403-
return unittest.skip(
1403+
self.skipTest(
14041404
'Skipped because backup from replica is not supported in PG 9.5')
14051405

14061406
self.init_pb(backup_dir)
@@ -1468,7 +1468,7 @@ def test_make_replica_via_incr_lsn_restore(self):
14681468
initdb_params=['--data-checksums'])
14691469

14701470
if self.get_version(master) < self.version_to_num('9.6.0'):
1471-
return unittest.skip(
1471+
self.skipTest(
14721472
'Skipped because backup from replica is not supported in PG 9.5')
14731473

14741474
self.init_pb(backup_dir)

tests/merge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ def test_merge_ptrack_truncate(self):
762762
restore last page backup and check data correctness
763763
"""
764764
if not self.ptrack:
765-
return unittest.skip('Skipped because ptrack support is disabled')
765+
self.skipTest('Skipped because ptrack support is disabled')
766766

767767
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
768768
node = self.make_simple_node(

tests/option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,5 @@ def test_help_6(self):
227227
help_out.read().decode("utf-8")
228228
)
229229
else:
230-
return unittest.skip(
230+
self.skipTest(
231231
'You need configure PostgreSQL with --enabled-nls option for this test')

tests/ptrack.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
class PtrackTest(ProbackupTest, unittest.TestCase):
1414
def setUp(self):
1515
if self.pg_config_version < self.version_to_num('11.0'):
16-
return unittest.skip('You need PostgreSQL >= 11 for this test')
16+
self.skipTest('You need PostgreSQL >= 11 for this test')
17+
self.fname = self.id().split('.')[3]
1718

1819
# @unittest.skip("skip")
1920
def test_drop_rel_during_backup_ptrack(self):

0 commit comments

Comments
 (0)
0