Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7be2e73

Browse files
authored
PBCKP-145: added check of unlogged table is restored as empty table (#490)
1 parent0b5b37e commit7be2e73

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

‎tests/exclude.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ def test_exclude_unlogged_tables_1(self):
203203
# @unittest.skip("skip")
204204
deftest_exclude_unlogged_tables_2(self):
205205
"""
206-
make node, create unlogged, take FULL, check
207-
that unlogged was not backed up
206+
1. make node, create unlogged, take FULL, DELTA, PAGE,
207+
check that unlogged table files was not backed up
208+
2. restore FULL, DELTA, PAGE to empty db,
209+
ensure unlogged table exist and is epmty
208210
"""
209211
fname=self.id().split('.')[3]
210212
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
@@ -220,6 +222,8 @@ def test_exclude_unlogged_tables_2(self):
220222
self.set_archiving(backup_dir,'node',node)
221223
node.slow_start()
222224

225+
backup_ids= []
226+
223227
forbackup_typein ['full','delta','page']:
224228

225229
ifbackup_type=='full':
@@ -231,14 +235,16 @@ def test_exclude_unlogged_tables_2(self):
231235
'postgres',
232236
'insert into test select generate_series(0,20050000)::text')
233237

234-
rel_path=node.safe_psql(
238+
rel_path=node.execute(
235239
'postgres',
236-
"select pg_relation_filepath('test')").decode('utf-8').rstrip()
240+
"select pg_relation_filepath('test')")[0][0]
237241

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

246+
backup_ids.append(backup_id)
247+
242248
filelist=self.get_backup_filelist(
243249
backup_dir,'node',backup_id)
244250

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

267+
# ensure restoring retrieves back only empty unlogged table
268+
forbackup_idinbackup_ids:
269+
node.stop()
270+
node.cleanup()
271+
272+
self.restore_node(backup_dir,'node',node,backup_id=backup_id)
273+
274+
node.slow_start()
275+
276+
self.assertEqual(
277+
node.execute(
278+
'postgres',
279+
'select count(*) from test')[0][0],
280+
0)
281+
261282
# Clean after yourself
262283
self.del_test_dir(module_name,fname)
263284

285+
264286
# @unittest.skip("skip")
265287
deftest_exclude_log_dir(self):
266288
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp