@@ -29,20 +29,12 @@ def test_restore_to_latest_1(self):
29
29
with open (path .join (node .logs_dir , "backup_1.log" ), "wb" ) as backup_log :
30
30
backup_log .write (self .backup_pb (node , options = ["--verbose" ]))
31
31
32
- node .pg_ctl ("stop" , {
33
- "-D" : node .data_dir ,
34
- "-w" : None ,
35
- "-m" : "immediate"
36
- })
32
+ node .stop ({"-m" : "immediate" })
37
33
38
34
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
39
35
restore_log .write (self .restore_pb (node , options = ["-j" , "4" , "--verbose" ]))
40
36
41
- node .pg_ctl ("start" , {
42
- "-D" : node .data_dir ,
43
- "-w" : None ,
44
- "-t" : "600"
45
- })
37
+ node .start ({"-t" : "600" })
46
38
47
39
after = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
48
40
self .assertEqual (before , after )
@@ -68,20 +60,12 @@ def test_restore_to_latest_2(self):
68
60
69
61
before = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
70
62
71
- node .pg_ctl ("stop" , {
72
- "-D" : node .data_dir ,
73
- "-w" : None ,
74
- "-m" : "immediate"
75
- })
63
+ node .stop ({"-m" : "immediate" })
76
64
77
65
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
78
66
restore_log .write (self .restore_pb (node , options = ["-j" , "4" , "--verbose" ]))
79
67
80
- node .pg_ctl ("start" , {
81
- "-D" : node .data_dir ,
82
- "-w" : None ,
83
- "-t" : "600"
84
- })
68
+ node .start ({"-t" : "600" })
85
69
86
70
after = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
87
71
self .assertEqual (before , after )
@@ -101,20 +85,12 @@ def test_restore_to_timeline_3(self):
101
85
backup_log .write (self .backup_pb (node , backup_type = "full" , options = ["--verbose" ]))
102
86
103
87
target_tli = int (self .get_control_data (node )[six .b ("Latest checkpoint's TimeLineID" )])
104
- node .pg_ctl ("stop" , {
105
- "-D" : node .data_dir ,
106
- "-w" : None ,
107
- "-m" : "immediate"
108
- })
88
+ node .stop ({"-m" : "immediate" })
109
89
110
90
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
111
91
restore_log .write (self .restore_pb (node , options = ["-j" , "4" , "--verbose" ]))
112
92
113
- node .pg_ctl ("start" , {
114
- "-D" : node .data_dir ,
115
- "-w" : None ,
116
- "-t" : "600"
117
- })
93
+ node .start ({"-t" : "600" })
118
94
119
95
pgbench = node .pgbench (stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
120
96
pgbench .wait ()
@@ -123,11 +99,7 @@ def test_restore_to_timeline_3(self):
123
99
with open (path .join (node .logs_dir , "backup_2.log" ), "wb" ) as backup_log :
124
100
backup_log .write (self .backup_pb (node , backup_type = "full" , options = ["--verbose" ]))
125
101
126
- node .pg_ctl ("stop" , {
127
- "-D" : node .data_dir ,
128
- "-w" : None ,
129
- "-m" : "immediate"
130
- })
102
+ node .stop ({"-m" : "immediate" })
131
103
132
104
with open (path .join (node .logs_dir , "restore_2.log" ), "wb" ) as restore_log :
133
105
restore_log .write (self .restore_pb (
@@ -138,11 +110,7 @@ def test_restore_to_timeline_3(self):
138
110
recovery_target_timeline = self .get_recovery_conf (node )["recovery_target_timeline" ]
139
111
self .assertEqual (int (recovery_target_timeline ), target_tli )
140
112
141
- node .pg_ctl ("start" , {
142
- "-D" : node .data_dir ,
143
- "-w" : None ,
144
- "-t" : "600"
145
- })
113
+ node .start ({"-t" : "600" })
146
114
147
115
after = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
148
116
self .assertEqual (before , after )
@@ -166,23 +134,15 @@ def test_restore_to_time_4(self):
166
134
pgbench .wait ()
167
135
pgbench .stdout .close ()
168
136
169
- node .pg_ctl ("stop" , {
170
- "-D" : node .data_dir ,
171
- "-w" : None ,
172
- "-m" : "immediate"
173
- })
137
+ node .stop ({"-m" : "immediate" })
174
138
175
139
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
176
140
restore_log .write (self .restore_pb (
177
141
node ,
178
142
options = ["-j" , "4" , "--verbose" , '--time="%s"' % target_time ]
179
143
))
180
144
181
- node .pg_ctl ("start" , {
182
- "-D" : node .data_dir ,
183
- "-w" : None ,
184
- "-t" : "600"
185
- })
145
+ node .start ({"-t" : "600" })
186
146
187
147
after = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
188
148
self .assertEqual (before , after )
@@ -221,23 +181,15 @@ def test_restore_to_xid_5(self):
221
181
# been archived up to the xmin point saved earlier without that.
222
182
node .execute ("postgres" , "SELECT pg_switch_xlog()" )
223
183
224
- node .pg_ctl ("stop" , {
225
- "-D" : node .data_dir ,
226
- "-w" : None ,
227
- "-m" : "fast"
228
- })
184
+ node .stop ({"-m" : "fast" })
229
185
230
186
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
231
187
restore_log .write (self .restore_pb (
232
188
node ,
233
189
options = ["-j" , "4" , "--verbose" , '--xid=%s' % target_xid ]
234
190
))
235
191
236
- node .pg_ctl ("start" , {
237
- "-D" : node .data_dir ,
238
- "-w" : None ,
239
- "-t" : "600"
240
- })
192
+ node .start ({"-t" : "600" })
241
193
242
194
after = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
243
195
self .assertEqual (before , after )
@@ -271,20 +223,12 @@ def test_restore_full_ptrack_6(self):
271
223
272
224
before = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
273
225
274
- node .pg_ctl ("stop" , {
275
- "-D" : node .data_dir ,
276
- "-w" : None ,
277
- "-m" : "immediate"
278
- })
226
+ node .stop ({"-m" : "immediate" })
279
227
280
228
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
281
229
restore_log .write (self .restore_pb (node , options = ["-j" , "4" , "--verbose" ]))
282
230
283
- node .pg_ctl ("start" , {
284
- "-D" : node .data_dir ,
285
- "-w" : None ,
286
- "-t" : "600"
287
- })
231
+ node .start ({"-t" : "600" })
288
232
289
233
after = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
290
234
self .assertEqual (before , after )
@@ -325,20 +269,12 @@ def test_restore_full_ptrack_ptrack_7(self):
325
269
326
270
before = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
327
271
328
- node .pg_ctl ("stop" , {
329
- "-D" : node .data_dir ,
330
- "-w" : None ,
331
- "-m" : "immediate"
332
- })
272
+ node .stop ({"-m" : "immediate" })
333
273
334
274
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
335
275
restore_log .write (self .restore_pb (node , options = ["-j" , "4" , "--verbose" ]))
336
276
337
- node .pg_ctl ("start" , {
338
- "-D" : node .data_dir ,
339
- "-w" : None ,
340
- "-t" : "600"
341
- })
277
+ node .start ({"-t" : "600" })
342
278
343
279
after = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
344
280
self .assertEqual (before , after )
@@ -372,20 +308,12 @@ def test_restore_full_ptrack_stream_8(self):
372
308
373
309
before = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
374
310
375
- node .pg_ctl ("stop" , {
376
- "-D" : node .data_dir ,
377
- "-w" : None ,
378
- "-m" : "immediate"
379
- })
311
+ node .stop ({"-m" : "immediate" })
380
312
381
313
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
382
314
restore_log .write (self .restore_pb (node , options = ["-j" , "4" , "--verbose" ]))
383
315
384
- node .pg_ctl ("start" , {
385
- "-D" : node .data_dir ,
386
- "-w" : None ,
387
- "-t" : "600"
388
- })
316
+ node .start ({"-t" : "600" })
389
317
390
318
after = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
391
319
self .assertEqual (before , after )
@@ -429,20 +357,12 @@ def test_restore_full_ptrack_under_load_9(self):
429
357
430
358
self .assertEqual (bbalance , delta )
431
359
432
- node .pg_ctl ("stop" , {
433
- "-D" : node .data_dir ,
434
- "-w" : None ,
435
- "-m" : "immediate"
436
- })
360
+ node .stop ({"-m" : "immediate" })
437
361
438
362
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
439
363
restore_log .write (self .restore_pb (node , options = ["-j" , "4" , "--verbose" ]))
440
364
441
- node .pg_ctl ("start" , {
442
- "-D" : node .data_dir ,
443
- "-w" : None ,
444
- "-t" : "600"
445
- })
365
+ node .start ({"-t" : "600" })
446
366
447
367
bbalance = node .execute ("postgres" , "SELECT sum(bbalance) FROM pgbench_branches" )
448
368
delta = node .execute ("postgres" , "SELECT sum(delta) FROM pgbench_history" )
@@ -488,20 +408,12 @@ def test_restore_full_under_load_ptrack_10(self):
488
408
489
409
self .assertEqual (bbalance , delta )
490
410
491
- node .pg_ctl ("stop" , {
492
- "-D" : node .data_dir ,
493
- "-w" : None ,
494
- "-m" : "immediate"
495
- })
411
+ node .stop ({"-m" : "immediate" })
496
412
497
413
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
498
414
restore_log .write (self .restore_pb (node , options = ["-j" , "4" , "--verbose" ]))
499
415
500
- node .pg_ctl ("start" , {
501
- "-D" : node .data_dir ,
502
- "-w" : None ,
503
- "-t" : "600"
504
- })
416
+ node .start ({"-t" : "600" })
505
417
506
418
bbalance = node .execute ("postgres" , "SELECT sum(bbalance) FROM pgbench_branches" )
507
419
delta = node .execute ("postgres" , "SELECT sum(delta) FROM pgbench_history" )
@@ -542,11 +454,7 @@ def test_restore_to_xid_inclusive_11(self):
542
454
# been archived up to the xmin point saved earlier without that.
543
455
node .execute ("postgres" , "SELECT pg_switch_xlog()" )
544
456
545
- node .pg_ctl ("stop" , {
546
- "-D" : node .data_dir ,
547
- "-w" : None ,
548
- "-m" : "fast"
549
- })
457
+ node .stop ({"-m" : "fast" })
550
458
551
459
with open (path .join (node .logs_dir , "restore_1.log" ), "wb" ) as restore_log :
552
460
restore_log .write (self .restore_pb (
@@ -559,11 +467,7 @@ def test_restore_to_xid_inclusive_11(self):
559
467
]
560
468
))
561
469
562
- node .pg_ctl ("start" , {
563
- "-D" : node .data_dir ,
564
- "-w" : None ,
565
- "-t" : "600"
566
- })
470
+ node .start ({"-t" : "600" })
567
471
568
472
after = node .execute ("postgres" , "SELECT * FROM pgbench_branches" )
569
473
self .assertEqual (before , after )
0 commit comments