@@ -203,8 +203,10 @@ def test_exclude_unlogged_tables_1(self):
203
203
# @unittest.skip("skip")
204
204
def test_exclude_unlogged_tables_2 (self ):
205
205
"""
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
208
210
"""
209
211
fname = self .id ().split ('.' )[3 ]
210
212
backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
@@ -220,6 +222,8 @@ def test_exclude_unlogged_tables_2(self):
220
222
self .set_archiving (backup_dir , 'node' , node )
221
223
node .slow_start ()
222
224
225
+ backup_ids = []
226
+
223
227
for backup_type in ['full' , 'delta' , 'page' ]:
224
228
225
229
if backup_type == 'full' :
@@ -231,14 +235,16 @@ def test_exclude_unlogged_tables_2(self):
231
235
'postgres' ,
232
236
'insert into test select generate_series(0,20050000)::text' )
233
237
234
- rel_path = node .safe_psql (
238
+ rel_path = node .execute (
235
239
'postgres' ,
236
- "select pg_relation_filepath('test')" ). decode ( 'utf-8' ). rstrip ()
240
+ "select pg_relation_filepath('test')" )[ 0 ][ 0 ]
237
241
238
242
backup_id = self .backup_node (
239
243
backup_dir , 'node' , node ,
240
244
backup_type = backup_type , options = ['--stream' ])
241
245
246
+ backup_ids .append (backup_id )
247
+
242
248
filelist = self .get_backup_filelist (
243
249
backup_dir , 'node' , backup_id )
244
250
@@ -258,9 +264,25 @@ def test_exclude_unlogged_tables_2(self):
258
264
rel_path + '.3' , filelist ,
259
265
"Unlogged table was not excluded" )
260
266
267
+ # ensure restoring retrieves back only empty unlogged table
268
+ for backup_id in backup_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
+
261
282
# Clean after yourself
262
283
self .del_test_dir (module_name , fname )
263
284
285
+
264
286
# @unittest.skip("skip")
265
287
def test_exclude_log_dir (self ):
266
288
"""
0 commit comments