Skip to content

Commit c4e9056

Browse files
committed
Merge branch 'REL_2_5' into REL_2_6
2 parents 7235c3f + 73cce50 commit c4e9056

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

tests/auth_test.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def test_backup_via_unprivileged_user(self):
3333
node = self.make_simple_node(
3434
base_dir=os.path.join(self.module_name, self.fname, 'node'),
3535
set_replication=True,
36+
ptrack_enable=self.ptrack,
3637
initdb_params=['--data-checksums'])
3738

3839
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
@@ -41,6 +42,11 @@ def test_backup_via_unprivileged_user(self):
4142
self.set_archiving(backup_dir, 'node', node)
4243
node.slow_start()
4344

45+
if self.ptrack:
46+
node.safe_psql(
47+
"postgres",
48+
"CREATE EXTENSION ptrack")
49+
4450
node.safe_psql("postgres", "CREATE ROLE backup with LOGIN")
4551

4652
try:
@@ -139,8 +145,6 @@ def test_backup_via_unprivileged_user(self):
139145
node.safe_psql(
140146
"test1", "create table t1 as select generate_series(0,100)")
141147

142-
if self.ptrack:
143-
self.set_auto_conf(node, {'ptrack_enable': 'on'})
144148
node.stop()
145149
node.slow_start()
146150

@@ -153,9 +157,10 @@ def test_backup_via_unprivileged_user(self):
153157
backup_dir, 'node', node, options=['-U', 'backup'])
154158

155159
# PTRACK
156-
# self.backup_node(
157-
# backup_dir, 'node', node,
158-
# backup_type='ptrack', options=['-U', 'backup'])
160+
if self.ptrack:
161+
self.backup_node(
162+
backup_dir, 'node', node,
163+
backup_type='ptrack', options=['-U', 'backup'])
159164

160165

161166
class AuthTest(unittest.TestCase):

tests/catchup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ def test_unclean_delta_catchup(self):
972972
self.set_auto_conf(dst_pg, dst_options)
973973
dst_pg.slow_start()
974974
self.assertNotEqual(dst_pg.pid, 0, "Cannot detect pid of running postgres")
975-
os.kill(dst_pg.pid, signal.SIGKILL)
975+
dst_pg.kill()
976976

977977
# preparation 3: make changes on master (source)
978978
src_pg.pgbench_init(scale = 10)
@@ -1061,7 +1061,7 @@ def test_unclean_ptrack_catchup(self):
10611061
self.set_auto_conf(dst_pg, dst_options)
10621062
dst_pg.slow_start()
10631063
self.assertNotEqual(dst_pg.pid, 0, "Cannot detect pid of running postgres")
1064-
os.kill(dst_pg.pid, signal.SIGKILL)
1064+
dst_pg.kill()
10651065

10661066
# preparation 3: make changes on master (source)
10671067
src_pg.pgbench_init(scale = 10)

tests/helpers/ptrack_helpers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import gc
44
import unittest
55
from sys import exit, argv, version_info
6+
import signal
67
import subprocess
78
import shutil
89
import six
@@ -190,6 +191,14 @@ def stop(self, *args, **kwargs):
190191
self.is_started = False
191192
return result
192193

194+
def kill(self, someone = None):
195+
if self.is_started:
196+
sig = signal.SIGKILL if os.name != 'nt' else signal.SIGBREAK
197+
if someone == None:
198+
os.kill(self.pid, sig)
199+
else:
200+
os.kill(self.auxiliary_pids[someone][0], sig)
201+
self.is_started = False
193202

194203
class ProbackupTest(object):
195204
# Class attributes

tests/pgpro2068.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def test_minrecpoint_on_replica(self):
8585
# get pids of replica background workers
8686
startup_pid = replica.auxiliary_pids[ProcessType.Startup][0]
8787
checkpointer_pid = replica.auxiliary_pids[ProcessType.Checkpointer][0]
88-
bgwriter_pid = replica.auxiliary_pids[ProcessType.BackgroundWriter][0]
8988

9089
# break checkpointer on UpdateLastRemovedPtr
9190
gdb_checkpointer = self.gdb_attach(checkpointer_pid)
@@ -108,7 +107,7 @@ def test_minrecpoint_on_replica(self):
108107
pgbench.stdout.close()
109108

110109
# kill someone, we need a crash
111-
os.kill(int(bgwriter_pid), 9)
110+
replica.kill(someone=ProcessType.BackgroundWriter)
112111
gdb_recovery._execute('detach')
113112
gdb_checkpointer._execute('detach')
114113

0 commit comments

Comments
 (0)