1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-05 13:20:31 +02:00

Merge branch 'master' of github.com:postgrespro/pg_probackup

This commit is contained in:
Grigory Smolkin 2021-02-12 15:33:18 +03:00
commit 673b11bc31
5 changed files with 61 additions and 48 deletions

View File

@ -1,7 +1,11 @@
[см wiki](https://confluence.postgrespro.ru/display/DEV/pg_probackup)
[see wiki](https://confluence.postgrespro.ru/display/DEV/pg_probackup)
```
Note: For now these are works on Linux and "kinda" works on Windows
Note: For now these tests work on Linux and "kinda" work on Windows
```
```
Note: tests require python3 to work properly.
```
```

View File

@ -20,9 +20,9 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
self.node = self.make_simple_node(
base_dir="{0}/{1}/node".format(module_name, self.fname),
set_replication=True,
ptrack_enable=True,
initdb_params=['--data-checksums'],
pg_options={
'ptrack_enable': 'on',
'cfs_encryption': 'off',
'max_wal_senders': '2',
'shared_buffers': '200MB'
@ -35,18 +35,27 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
self.node.slow_start()
if self.node.major_version >= 12:
self.node.safe_psql(
"postgres",
"CREATE EXTENSION ptrack")
self.create_tblspace_in_node(self.node, tblspace_name, cfs=True)
tblspace = self.node.safe_psql(
"postgres",
"SELECT * FROM pg_tablespace WHERE spcname='{0}'".format(
tblspace_name)
)
self.assertTrue(
tblspace_name in tblspace and "compression=true" in tblspace,
tblspace_name))
self.assertIn(
tblspace_name, str(tblspace),
"ERROR: The tablespace not created "
"or it create without compressions"
)
"or it create without compressions")
self.assertIn(
"compression=true", str(tblspace),
"ERROR: The tablespace not created "
"or it create without compressions")
self.assertTrue(
find_by_name(
@ -473,7 +482,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
)
# --- Section: Incremental from fill tablespace --- #
@unittest.expectedFailure
# @unittest.expectedFailure
# @unittest.skip("skip")
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
def test_fullbackup_after_create_table_ptrack_after_create_table(self):
@ -537,7 +546,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
)
)
@unittest.expectedFailure
# @unittest.expectedFailure
# @unittest.skip("skip")
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
def test_fullbackup_after_create_table_ptrack_after_create_table_stream(self):
@ -603,7 +612,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
)
)
@unittest.expectedFailure
# @unittest.expectedFailure
# @unittest.skip("skip")
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
def test_fullbackup_after_create_table_page_after_create_table(self):
@ -738,12 +747,14 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
# CHECK FULL BACKUP
self.node.stop()
self.node.cleanup()
shutil.rmtree(
self.get_tblspace_path(self.node, tblspace_name),
ignore_errors=True)
shutil.rmtree(self.get_tblspace_path(self.node, tblspace_name))
self.restore_node(
self.backup_dir, 'node', self.node,
backup_id=backup_id_full, options=["-j", "4"])
self.backup_dir, 'node', self.node, backup_id=backup_id_full,
options=[
"-j", "4",
"--recovery-target=immediate",
"--recovery-target-action=promote"])
self.node.slow_start()
self.assertEqual(
full_result,
@ -757,8 +768,12 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
self.get_tblspace_path(self.node, tblspace_name),
ignore_errors=True)
self.restore_node(
self.backup_dir, 'node', self.node,
backup_id=backup_id_page, options=["-j", "4"])
self.backup_dir, 'node', self.node, backup_id=backup_id_page,
options=[
"-j", "4",
"--recovery-target=immediate",
"--recovery-target-action=promote"])
self.node.slow_start()
self.assertEqual(
page_result,
@ -786,8 +801,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
"AS SELECT i AS id, MD5(i::text) AS text, "
"MD5(repeat(i::text,10))::tsvector AS tsvector "
"FROM generate_series(0,1005000) i".format(
't_heap_1', tblspace_name_1)
)
't_heap_1', tblspace_name_1))
self.node.safe_psql(
"postgres",
@ -795,8 +809,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
"AS SELECT i AS id, MD5(i::text) AS text, "
"MD5(repeat(i::text,10))::tsvector AS tsvector "
"FROM generate_series(0,1005000) i".format(
't_heap_2', tblspace_name_2)
)
't_heap_2', tblspace_name_2))
full_result_1 = self.node.safe_psql(
"postgres", "SELECT * FROM t_heap_1")
@ -864,21 +877,16 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
# CHECK FULL BACKUP
self.node.stop()
self.node.cleanup()
shutil.rmtree(
self.get_tblspace_path(self.node, tblspace_name),
ignore_errors=True)
shutil.rmtree(
self.get_tblspace_path(self.node, tblspace_name_1),
ignore_errors=True)
shutil.rmtree(
self.get_tblspace_path(self.node, tblspace_name_2),
ignore_errors=True)
self.restore_node(
self.backup_dir, 'node', self.node,
backup_id=backup_id_full, options=["-j", "4"])
backup_id=backup_id_full,
options=[
"-j", "4", "--incremental-mode=checksum",
"--recovery-target=immediate",
"--recovery-target-action=promote"])
self.node.slow_start()
self.assertEqual(
full_result_1,
self.node.safe_psql("postgres", "SELECT * FROM t_heap_1"),
@ -890,21 +898,16 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
# CHECK PAGE BACKUP
self.node.stop()
self.node.cleanup()
shutil.rmtree(
self.get_tblspace_path(self.node, tblspace_name),
ignore_errors=True)
shutil.rmtree(
self.get_tblspace_path(self.node, tblspace_name_1),
ignore_errors=True)
shutil.rmtree(
self.get_tblspace_path(self.node, tblspace_name_2),
ignore_errors=True)
self.restore_node(
self.backup_dir, 'node', self.node,
backup_id=backup_id_page, options=["-j", "4"])
backup_id=backup_id_page,
options=[
"-j", "4", "--incremental-mode=checksum",
"--recovery-target=immediate",
"--recovery-target-action=promote"])
self.node.slow_start()
self.assertEqual(
page_result_1,
self.node.safe_psql("postgres", "SELECT * FROM t_heap_1"),
@ -914,7 +917,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
self.node.safe_psql("postgres", "SELECT * FROM t_heap_2"),
'Lost data after restore')
@unittest.expectedFailure
# @unittest.expectedFailure
# @unittest.skip("skip")
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
def test_fullbackup_after_create_table_page_after_create_table_stream(self):

View File

@ -88,4 +88,6 @@ def corrupt_file(filename):
def random_string(n):
a = string.ascii_letters + string.digits
return ''.join([random.choice(a) for i in range(int(n)+1)])
random_str = ''.join([random.choice(a) for i in range(int(n)+1)])
return str.encode(random_str)
# return ''.join([random.choice(a) for i in range(int(n)+1)])

View File

@ -1711,6 +1711,9 @@ class IncrRestoreTest(ProbackupTest, unittest.TestCase):
# @unittest.skip("skip")
# @unittest.expectedFailure
# This test will pass with Enterprise
# because it has checksums enabled by default
@unittest.skipIf(ProbackupTest.enterprise, 'skip')
def test_incr_lsn_long_xact_1(self):
"""
"""

View File

@ -3451,7 +3451,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
# Clean after yourself
self.del_test_dir(module_name, fname)
# @unittest.expectedFailure
#TODO fix the test
@unittest.expectedFailure
# @unittest.skip("skip")
def test_validate_target_lsn(self):
"""