Skip to content

PBCKP-145: added check of unlogged table is restored as empty table #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions tests/exclude.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,10 @@ def test_exclude_unlogged_tables_1(self):
# @unittest.skip("skip")
def test_exclude_unlogged_tables_2(self):
"""
make node, create unlogged, take FULL, check
that unlogged was not backed up
1. make node, create unlogged, take FULL, DELTA, PAGE,
check that unlogged table files was not backed up
2. restore FULL, DELTA, PAGE to empty db,
ensure unlogged table exist and is epmty
"""
fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
Expand All @@ -220,6 +222,8 @@ def test_exclude_unlogged_tables_2(self):
self.set_archiving(backup_dir, 'node', node)
node.slow_start()

backup_ids = []

for backup_type in ['full', 'delta', 'page']:

if backup_type == 'full':
Expand All @@ -231,14 +235,16 @@ def test_exclude_unlogged_tables_2(self):
'postgres',
'insert into test select generate_series(0,20050000)::text')

rel_path = node.safe_psql(
rel_path = node.execute(
'postgres',
"select pg_relation_filepath('test')").decode('utf-8').rstrip()
"select pg_relation_filepath('test')")[0][0]

backup_id = self.backup_node(
backup_dir, 'node', node,
backup_type=backup_type, options=['--stream'])

backup_ids.append(backup_id)

filelist = self.get_backup_filelist(
backup_dir, 'node', backup_id)

Expand All @@ -258,9 +264,25 @@ def test_exclude_unlogged_tables_2(self):
rel_path + '.3', filelist,
"Unlogged table was not excluded")

# ensure restoring retrieves back only empty unlogged table
for backup_id in backup_ids:
node.stop()
node.cleanup()

self.restore_node(backup_dir, 'node', node, backup_id=backup_id)

node.slow_start()

self.assertEqual(
node.execute(
'postgres',
'select count(*) from test')[0][0],
0)

# Clean after yourself
self.del_test_dir(module_name, fname)


# @unittest.skip("skip")
def test_exclude_log_dir(self):
"""
Expand Down