You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2026-04-26 21:22:39 +02:00
Merge branch 'REL_2_5' into REL_2_6
This commit is contained in:
+10
-5
@@ -33,6 +33,7 @@ class SimpleAuthTest(ProbackupTest, unittest.TestCase):
|
||||
node = self.make_simple_node(
|
||||
base_dir=os.path.join(self.module_name, self.fname, 'node'),
|
||||
set_replication=True,
|
||||
ptrack_enable=self.ptrack,
|
||||
initdb_params=['--data-checksums'])
|
||||
|
||||
backup_dir = os.path.join(self.tmp_path, self.module_name, self.fname, 'backup')
|
||||
@@ -41,6 +42,11 @@ class SimpleAuthTest(ProbackupTest, unittest.TestCase):
|
||||
self.set_archiving(backup_dir, 'node', node)
|
||||
node.slow_start()
|
||||
|
||||
if self.ptrack:
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"CREATE EXTENSION ptrack")
|
||||
|
||||
node.safe_psql("postgres", "CREATE ROLE backup with LOGIN")
|
||||
|
||||
try:
|
||||
@@ -139,8 +145,6 @@ class SimpleAuthTest(ProbackupTest, unittest.TestCase):
|
||||
node.safe_psql(
|
||||
"test1", "create table t1 as select generate_series(0,100)")
|
||||
|
||||
if self.ptrack:
|
||||
self.set_auto_conf(node, {'ptrack_enable': 'on'})
|
||||
node.stop()
|
||||
node.slow_start()
|
||||
|
||||
@@ -153,9 +157,10 @@ class SimpleAuthTest(ProbackupTest, unittest.TestCase):
|
||||
backup_dir, 'node', node, options=['-U', 'backup'])
|
||||
|
||||
# PTRACK
|
||||
# self.backup_node(
|
||||
# backup_dir, 'node', node,
|
||||
# backup_type='ptrack', options=['-U', 'backup'])
|
||||
if self.ptrack:
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node,
|
||||
backup_type='ptrack', options=['-U', 'backup'])
|
||||
|
||||
|
||||
class AuthTest(unittest.TestCase):
|
||||
|
||||
+2
-2
@@ -972,7 +972,7 @@ class CatchupTest(ProbackupTest, unittest.TestCase):
|
||||
self.set_auto_conf(dst_pg, dst_options)
|
||||
dst_pg.slow_start()
|
||||
self.assertNotEqual(dst_pg.pid, 0, "Cannot detect pid of running postgres")
|
||||
os.kill(dst_pg.pid, signal.SIGKILL)
|
||||
dst_pg.kill()
|
||||
|
||||
# preparation 3: make changes on master (source)
|
||||
src_pg.pgbench_init(scale = 10)
|
||||
@@ -1061,7 +1061,7 @@ class CatchupTest(ProbackupTest, unittest.TestCase):
|
||||
self.set_auto_conf(dst_pg, dst_options)
|
||||
dst_pg.slow_start()
|
||||
self.assertNotEqual(dst_pg.pid, 0, "Cannot detect pid of running postgres")
|
||||
os.kill(dst_pg.pid, signal.SIGKILL)
|
||||
dst_pg.kill()
|
||||
|
||||
# preparation 3: make changes on master (source)
|
||||
src_pg.pgbench_init(scale = 10)
|
||||
|
||||
@@ -3,6 +3,7 @@ import os
|
||||
import gc
|
||||
import unittest
|
||||
from sys import exit, argv, version_info
|
||||
import signal
|
||||
import subprocess
|
||||
import shutil
|
||||
import six
|
||||
@@ -190,6 +191,14 @@ class PostgresNodeExtended(testgres.PostgresNode):
|
||||
self.is_started = False
|
||||
return result
|
||||
|
||||
def kill(self, someone = None):
|
||||
if self.is_started:
|
||||
sig = signal.SIGKILL if os.name != 'nt' else signal.SIGBREAK
|
||||
if someone == None:
|
||||
os.kill(self.pid, sig)
|
||||
else:
|
||||
os.kill(self.auxiliary_pids[someone][0], sig)
|
||||
self.is_started = False
|
||||
|
||||
class ProbackupTest(object):
|
||||
# Class attributes
|
||||
|
||||
+1
-2
@@ -85,7 +85,6 @@ class BugTest(ProbackupTest, unittest.TestCase):
|
||||
# get pids of replica background workers
|
||||
startup_pid = replica.auxiliary_pids[ProcessType.Startup][0]
|
||||
checkpointer_pid = replica.auxiliary_pids[ProcessType.Checkpointer][0]
|
||||
bgwriter_pid = replica.auxiliary_pids[ProcessType.BackgroundWriter][0]
|
||||
|
||||
# break checkpointer on UpdateLastRemovedPtr
|
||||
gdb_checkpointer = self.gdb_attach(checkpointer_pid)
|
||||
@@ -108,7 +107,7 @@ class BugTest(ProbackupTest, unittest.TestCase):
|
||||
pgbench.stdout.close()
|
||||
|
||||
# kill someone, we need a crash
|
||||
os.kill(int(bgwriter_pid), 9)
|
||||
replica.kill(someone=ProcessType.BackgroundWriter)
|
||||
gdb_recovery._execute('detach')
|
||||
gdb_checkpointer._execute('detach')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user