1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-09-16 09:26:30 +02:00

tests: check _ptrack files absense in restored pgdata

This commit is contained in:
Grigory Smolkin
2018-03-01 22:25:43 +03:00
parent 9fd5a22506
commit f8f9e47cbf
3 changed files with 37 additions and 26 deletions

View File

@@ -884,7 +884,7 @@ class ProbackupTest(object):
except:
pass
def pgdata_content(self, directory):
def pgdata_content(self, directory, ignore_ptrack=True):
""" return dict with directory content. "
" TAKE IT AFTER CHECKPOINT or BACKUP"""
dirs_to_ignore = [
@@ -897,9 +897,9 @@ class ProbackupTest(object):
'backup_label', 'tablespace_map', 'recovery.conf',
'ptrack_control', 'ptrack_init', 'pg_control'
]
suffixes_to_ignore = (
'_ptrack'
)
# suffixes_to_ignore = (
# '_ptrack'
# )
directory_dict = {}
directory_dict['pgdata'] = directory
directory_dict['files'] = {}
@@ -908,7 +908,7 @@ class ProbackupTest(object):
for file in files:
if (
file in files_to_ignore or
file.endswith(suffixes_to_ignore)
(ignore_ptrack and file.endswith('_ptrack'))
):
continue

View File

@@ -250,12 +250,20 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
"""Make node, create table with multiple segments, write some data to it, check page and data correctness"""
fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
node = self.make_simple_node(base_dir="{0}/{1}/node".format(module_name, fname),
node = self.make_simple_node(
base_dir="{0}/{1}/node".format(module_name, fname),
set_replication=True,
initdb_params=['--data-checksums'],
pg_options={'wal_level': 'replica', 'max_wal_senders': '2',
'ptrack_enable': 'on', 'fsync': 'off', 'shared_buffers': '1GB',
'maintenance_work_mem': '1GB', 'autovacuum': 'off', 'full_page_writes': 'off'}
pg_options={
'wal_level': 'replica',
'max_wal_senders': '2',
'ptrack_enable': 'on',
'fsync': 'off',
'shared_buffers': '1GB',
'maintenance_work_mem': '1GB',
'autovacuum': 'off',
'full_page_writes': 'off'
}
)
self.init_pb(backup_dir)
@@ -271,7 +279,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
self.backup_node(backup_dir, 'node', node)
# PGBENCH STUFF
pgbench = node.pgbench(options=['-T', '150', '-c', '2', '--no-vacuum'])
pgbench = node.pgbench(options=['-T', '50', '-c', '1', '--no-vacuum'])
pgbench.wait()
node.safe_psql("postgres", "checkpoint")

View File

@@ -172,7 +172,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# Physical comparison
if self.paranoia:
pgdata_restored = self.pgdata_content(node_restored.data_dir)
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
node_restored.append_conf(
@@ -268,7 +268,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# Physical comparison
if self.paranoia:
pgdata_restored = self.pgdata_content(node_restored.data_dir)
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
node_restored.append_conf(
@@ -358,7 +358,10 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# Physical comparison
if self.paranoia:
pgdata_restored = self.pgdata_content(node_restored.data_dir)
pgdata_restored = self.pgdata_content(
node_restored.data_dir,
ignore_ptrack=False
)
self.compare_pgdata(pgdata, pgdata_restored)
node_restored.append_conf(
@@ -427,7 +430,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# Physical comparison
if self.paranoia:
pgdata_restored = self.pgdata_content(node_restored.data_dir)
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
node_restored.append_conf(
@@ -500,7 +503,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# Physical comparison
if self.paranoia:
pgdata_restored = self.pgdata_content(node.data_dir)
pgdata_restored = self.pgdata_content(node.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
node.start()
@@ -584,7 +587,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# Physical comparison
if self.paranoia:
pgdata_restored = self.pgdata_content(node.data_dir)
pgdata_restored = self.pgdata_content(node.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
node.start()
@@ -682,7 +685,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# Physical comparison
if self.paranoia:
pgdata_restored = self.pgdata_content(node.data_dir)
pgdata_restored = self.pgdata_content(node.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
node.start()
@@ -783,7 +786,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
)
if self.paranoia:
pgdata_restored = self.pgdata_content(node.data_dir)
pgdata_restored = self.pgdata_content(node.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
node.start()
@@ -885,7 +888,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
)
if self.paranoia:
pgdata_restored = self.pgdata_content(node.data_dir)
pgdata_restored = self.pgdata_content(node.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
node.start()
@@ -1191,7 +1194,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# COMPARE PHYSICAL CONTENT
if self.paranoia:
pgdata_restored = self.pgdata_content(node_restored.data_dir)
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
# START RESTORED NODE
@@ -1220,7 +1223,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# COMPARE PHYSICAL CONTENT
if self.paranoia:
pgdata_restored = self.pgdata_content(node_restored.data_dir)
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
# START RESTORED NODE
@@ -1324,7 +1327,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# GET RESTORED PGDATA AND COMPARE
if self.paranoia:
pgdata_restored = self.pgdata_content(node_restored.data_dir)
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
# START RESTORED NODE
@@ -1402,7 +1405,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# GET PHYSICAL CONTENT and COMPARE PHYSICAL CONTENT
if self.paranoia:
pgdata_restored = self.pgdata_content(node_restored.data_dir)
pgdata_restored = self.pgdata_content(node_restored.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
# START RESTORED NODE
@@ -1551,7 +1554,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# GET PHYSICAL CONTENT FROM RESTORED NODE and COMPARE PHYSICAL CONTENT
if self.paranoia:
pgdata_restored = self.pgdata_content(restored_node.data_dir)
pgdata_restored = self.pgdata_content(restored_node.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
# START RESTORED NODE
@@ -1587,7 +1590,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# GET PHYSICAL CONTENT FROM RESTORED NODE and COMPARE PHYSICAL CONTENT
if self.paranoia:
pgdata_restored = self.pgdata_content(restored_node.data_dir)
pgdata_restored = self.pgdata_content(restored_node.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
# START RESTORED NODE
@@ -1684,7 +1687,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
# GET PHYSICAL CONTENT FROM NODE_RESTORED
if self.paranoia:
pgdata_restored = self.pgdata_content(restored_node.data_dir)
pgdata_restored = self.pgdata_content(restored_node.data_dir, ignore_ptrack=False)
self.compare_pgdata(pgdata, pgdata_restored)
# START RESTORED NODE