mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-03-21 21:47:17 +02:00
tests: add slow_start() method to PostgresNode
This commit is contained in:
parent
963eb2e2c6
commit
f98c91b3ba
@ -45,10 +45,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
|
|
||||||
self.restore_node(
|
self.restore_node(
|
||||||
backup_dir, 'node', node)
|
backup_dir, 'node', node)
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
sleep(1)
|
|
||||||
|
|
||||||
# Recreate backup calagoue
|
# Recreate backup calagoue
|
||||||
self.init_pb(backup_dir)
|
self.init_pb(backup_dir)
|
||||||
@ -64,10 +61,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.restore_node(
|
self.restore_node(
|
||||||
backup_dir, 'node', node,
|
backup_dir, 'node', node,
|
||||||
options=["--recovery-target-action=promote"])
|
options=["--recovery-target-action=promote"])
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
sleep(1)
|
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result, node.safe_psql("postgres", "SELECT * FROM t_heap"),
|
result, node.safe_psql("postgres", "SELECT * FROM t_heap"),
|
||||||
@ -115,10 +109,8 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.restore_node(
|
self.restore_node(
|
||||||
backup_dir, 'node', node,
|
backup_dir, 'node', node,
|
||||||
options=['--immediate', '--recovery-target-action=promote'])
|
options=['--immediate', '--recovery-target-action=promote'])
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
sleep(1)
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print(node.safe_psql(
|
print(node.safe_psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
@ -149,10 +141,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.restore_node(
|
self.restore_node(
|
||||||
backup_dir, 'node', node,
|
backup_dir, 'node', node,
|
||||||
options=['--immediate', '--recovery-target-action=promote'])
|
options=['--immediate', '--recovery-target-action=promote'])
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
sleep(1)
|
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print(
|
print(
|
||||||
@ -180,10 +169,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.restore_node(
|
self.restore_node(
|
||||||
backup_dir, 'node', node,
|
backup_dir, 'node', node,
|
||||||
options=['--immediate', '--recovery-target-action=promote'])
|
options=['--immediate', '--recovery-target-action=promote'])
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
sleep(1)
|
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print('Fourth timeline')
|
print('Fourth timeline')
|
||||||
@ -196,10 +182,8 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.restore_node(
|
self.restore_node(
|
||||||
backup_dir, 'node', node,
|
backup_dir, 'node', node,
|
||||||
options=['--immediate', '--recovery-target-action=promote'])
|
options=['--immediate', '--recovery-target-action=promote'])
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
sleep(1)
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print('Fifth timeline')
|
print('Fifth timeline')
|
||||||
print(node.safe_psql(
|
print(node.safe_psql(
|
||||||
@ -211,10 +195,8 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.restore_node(
|
self.restore_node(
|
||||||
backup_dir, 'node', node,
|
backup_dir, 'node', node,
|
||||||
options=['--immediate', '--recovery-target-action=promote'])
|
options=['--immediate', '--recovery-target-action=promote'])
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
sleep(1)
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print('Sixth timeline')
|
print('Sixth timeline')
|
||||||
print(node.safe_psql(
|
print(node.safe_psql(
|
||||||
@ -459,7 +441,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
# Settings for Replica
|
# Settings for Replica
|
||||||
self.restore_node(backup_dir, 'master', replica)
|
self.restore_node(backup_dir, 'master', replica)
|
||||||
self.set_replica(master, replica, synchronous=True)
|
self.set_replica(master, replica, synchronous=True)
|
||||||
exit(1)
|
|
||||||
self.add_instance(backup_dir, 'replica', replica)
|
self.add_instance(backup_dir, 'replica', replica)
|
||||||
self.set_archiving(backup_dir, 'replica', replica, replica=True)
|
self.set_archiving(backup_dir, 'replica', replica, replica=True)
|
||||||
replica.start()
|
replica.start()
|
||||||
@ -768,10 +750,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
# Check data correctness
|
# Check data correctness
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
self.restore_node(backup_dir, 'node', node)
|
self.restore_node(backup_dir, 'node', node)
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
sleep(1)
|
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result,
|
result,
|
||||||
@ -843,11 +822,7 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
|
|||||||
# Check data correctness
|
# Check data correctness
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
self.restore_node(backup_dir, 'node', node)
|
self.restore_node(backup_dir, 'node', node)
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
sleep(1)
|
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result, node.safe_psql("postgres", "SELECT * FROM t_heap"),
|
result, node.safe_psql("postgres", "SELECT * FROM t_heap"),
|
||||||
|
@ -83,7 +83,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(full_result, full_result_new)
|
self.assertEqual(full_result, full_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -98,7 +99,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(page_result, page_result_new)
|
self.assertEqual(page_result, page_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -113,7 +115,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
ptrack_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
ptrack_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(ptrack_result, ptrack_result_new)
|
self.assertEqual(ptrack_result, ptrack_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -187,7 +190,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(full_result, full_result_new)
|
self.assertEqual(full_result, full_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -202,7 +206,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(page_result, page_result_new)
|
self.assertEqual(page_result, page_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -217,7 +222,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
ptrack_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
ptrack_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(ptrack_result, ptrack_result_new)
|
self.assertEqual(ptrack_result, ptrack_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -294,7 +300,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(full_result, full_result_new)
|
self.assertEqual(full_result, full_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -309,7 +316,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(page_result, page_result_new)
|
self.assertEqual(page_result, page_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -324,7 +332,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
ptrack_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
ptrack_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(ptrack_result, ptrack_result_new)
|
self.assertEqual(ptrack_result, ptrack_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -401,7 +410,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(full_result, full_result_new)
|
self.assertEqual(full_result, full_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -416,7 +426,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(page_result, page_result_new)
|
self.assertEqual(page_result, page_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -431,7 +442,8 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
ptrack_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
ptrack_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(ptrack_result, ptrack_result_new)
|
self.assertEqual(ptrack_result, ptrack_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
|
@ -508,10 +508,7 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
|
|||||||
# START RESTORED NODE
|
# START RESTORED NODE
|
||||||
restored_node.append_conf(
|
restored_node.append_conf(
|
||||||
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
||||||
restored_node.start()
|
restored_node.slow_start()
|
||||||
while restored_node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
result_new = restored_node.safe_psql(
|
result_new = restored_node.safe_psql(
|
||||||
"postgres", "select * from pgbench_accounts")
|
"postgres", "select * from pgbench_accounts")
|
||||||
@ -946,11 +943,8 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
|
|||||||
# START RESTORED NODE
|
# START RESTORED NODE
|
||||||
node_restored.append_conf(
|
node_restored.append_conf(
|
||||||
'postgresql.auto.conf', 'port = {0}'.format(node_restored.port))
|
'postgresql.auto.conf', 'port = {0}'.format(node_restored.port))
|
||||||
node_restored.start()
|
node_restored.slow_start()
|
||||||
|
|
||||||
while node_restored.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
result_new = node_restored.safe_psql(
|
result_new = node_restored.safe_psql(
|
||||||
"postgres", "select * from t_heap")
|
"postgres", "select * from t_heap")
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ pg_probackup - utility to manage backup/recovery of PostgreSQL database.
|
|||||||
[--replica-timeout=timeout]
|
[--replica-timeout=timeout]
|
||||||
|
|
||||||
pg_probackup show-config -B backup-dir --instance=instance_name
|
pg_probackup show-config -B backup-dir --instance=instance_name
|
||||||
|
[--format=format]
|
||||||
|
|
||||||
pg_probackup backup -B backup-path -b backup-mode --instance=instance_name
|
pg_probackup backup -B backup-path -b backup-mode --instance=instance_name
|
||||||
[-C] [--stream [-S slot-name]] [--backup-pg-log]
|
[-C] [--stream [-S slot-name]] [--backup-pg-log]
|
||||||
@ -61,10 +62,12 @@ pg_probackup - utility to manage backup/recovery of PostgreSQL database.
|
|||||||
pg_probackup validate -B backup-dir [--instance=instance_name]
|
pg_probackup validate -B backup-dir [--instance=instance_name]
|
||||||
[-i backup-id] [--progress]
|
[-i backup-id] [--progress]
|
||||||
[--time=time|--xid=xid [--inclusive=boolean]]
|
[--time=time|--xid=xid [--inclusive=boolean]]
|
||||||
|
[--recovery-target-name=target-name]
|
||||||
[--timeline=timeline]
|
[--timeline=timeline]
|
||||||
|
|
||||||
pg_probackup show -B backup-dir
|
pg_probackup show -B backup-dir
|
||||||
[--instance=instance_name [-i backup-id]]
|
[--instance=instance_name [-i backup-id]]
|
||||||
|
[--format=format]
|
||||||
|
|
||||||
pg_probackup delete -B backup-dir --instance=instance_name
|
pg_probackup delete -B backup-dir --instance=instance_name
|
||||||
[--wal] [-i backup-id | --expired]
|
[--wal] [-i backup-id | --expired]
|
||||||
|
@ -191,7 +191,7 @@ class FalsePositive(ProbackupTest, unittest.TestCase):
|
|||||||
node.data_dir, ignore_ptrack=False)
|
node.data_dir, ignore_ptrack=False)
|
||||||
self.compare_pgdata(pgdata, pgdata_restored)
|
self.compare_pgdata(pgdata, pgdata_restored)
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
# Logical comparison
|
# Logical comparison
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result,
|
result,
|
||||||
@ -290,7 +290,7 @@ class FalsePositive(ProbackupTest, unittest.TestCase):
|
|||||||
node.data_dir, ignore_ptrack=False)
|
node.data_dir, ignore_ptrack=False)
|
||||||
self.compare_pgdata(pgdata, pgdata_restored)
|
self.compare_pgdata(pgdata, pgdata_restored)
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
# Logical comparison
|
# Logical comparison
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result,
|
result,
|
||||||
|
@ -112,6 +112,25 @@ class ProbackupException(Exception):
|
|||||||
return '\n ERROR: {0}\n CMD: {1}'.format(repr(self.message), self.cmd)
|
return '\n ERROR: {0}\n CMD: {1}'.format(repr(self.message), self.cmd)
|
||||||
|
|
||||||
|
|
||||||
|
def slow_start(self):
|
||||||
|
|
||||||
|
# wait for https://github.com/postgrespro/testgres/pull/50
|
||||||
|
# self.poll_query_until(
|
||||||
|
# "postgres",
|
||||||
|
# "SELECT not pg_is_in_recovery()",
|
||||||
|
# raise_operational_error=False)
|
||||||
|
|
||||||
|
self.start()
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
self.poll_query_until(
|
||||||
|
"postgres",
|
||||||
|
"SELECT not pg_is_in_recovery()")
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
class ProbackupTest(object):
|
class ProbackupTest(object):
|
||||||
# Class attributes
|
# Class attributes
|
||||||
enterprise = is_enterprise()
|
enterprise = is_enterprise()
|
||||||
@ -205,6 +224,8 @@ class ProbackupTest(object):
|
|||||||
os.makedirs(real_base_dir)
|
os.makedirs(real_base_dir)
|
||||||
|
|
||||||
node = testgres.get_new_node('test', base_dir=real_base_dir)
|
node = testgres.get_new_node('test', base_dir=real_base_dir)
|
||||||
|
# bound method slow_start() to 'node' class instance
|
||||||
|
node.slow_start = slow_start.__get__(node)
|
||||||
node.should_rm_dirs = True
|
node.should_rm_dirs = True
|
||||||
node.init(
|
node.init(
|
||||||
initdb_params=initdb_params, allow_streaming=set_replication)
|
initdb_params=initdb_params, allow_streaming=set_replication)
|
||||||
|
@ -3,7 +3,6 @@ import unittest
|
|||||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
module_name = 'page'
|
module_name = 'page'
|
||||||
@ -33,8 +32,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
node_restored = self.make_simple_node(
|
node_restored = self.make_simple_node(
|
||||||
base_dir="{0}/{1}/node_restored".format(module_name, fname),
|
base_dir="{0}/{1}/node_restored".format(module_name, fname))
|
||||||
)
|
|
||||||
|
|
||||||
self.init_pb(backup_dir)
|
self.init_pb(backup_dir)
|
||||||
self.add_instance(backup_dir, 'node', node)
|
self.add_instance(backup_dir, 'node', node)
|
||||||
@ -49,32 +47,27 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
"create table t_heap tablespace somedata as select i as id, "
|
"create table t_heap tablespace somedata as select i as id, "
|
||||||
"md5(i::text) as text, "
|
"md5(i::text) as text, "
|
||||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||||
"from generate_series(0,1024) i;"
|
"from generate_series(0,1024) i;")
|
||||||
)
|
|
||||||
node.safe_psql(
|
node.safe_psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"vacuum t_heap"
|
"vacuum t_heap")
|
||||||
)
|
|
||||||
|
|
||||||
self.backup_node(backup_dir, 'node', node)
|
self.backup_node(backup_dir, 'node', node)
|
||||||
|
|
||||||
node.safe_psql(
|
node.safe_psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"delete from t_heap where ctid >= '(11,0)'"
|
"delete from t_heap where ctid >= '(11,0)'")
|
||||||
)
|
|
||||||
node.safe_psql(
|
node.safe_psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"vacuum t_heap"
|
"vacuum t_heap")
|
||||||
)
|
|
||||||
|
|
||||||
self.backup_node(
|
self.backup_node(
|
||||||
backup_dir, 'node', node, backup_type='page',
|
backup_dir, 'node', node, backup_type='page',
|
||||||
options=['--log-level-file=verbose']
|
options=['--log-level-file=verbose'])
|
||||||
)
|
|
||||||
|
|
||||||
self.backup_node(
|
self.backup_node(
|
||||||
backup_dir, 'node', node, backup_type='page'
|
backup_dir, 'node', node, backup_type='page')
|
||||||
)
|
|
||||||
|
|
||||||
if self.paranoia:
|
if self.paranoia:
|
||||||
pgdata = self.pgdata_content(node.data_dir)
|
pgdata = self.pgdata_content(node.data_dir)
|
||||||
@ -87,8 +80,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
options=[
|
options=[
|
||||||
"-j", "4",
|
"-j", "4",
|
||||||
"-T", "{0}={1}".format(old_tablespace, new_tablespace),
|
"-T", "{0}={1}".format(old_tablespace, new_tablespace),
|
||||||
"--recovery-target-action=promote"]
|
"--recovery-target-action=promote"])
|
||||||
)
|
|
||||||
|
|
||||||
# Physical comparison
|
# Physical comparison
|
||||||
if self.paranoia:
|
if self.paranoia:
|
||||||
@ -97,21 +89,17 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
|
|
||||||
node_restored.append_conf(
|
node_restored.append_conf(
|
||||||
"postgresql.auto.conf", "port = {0}".format(node_restored.port))
|
"postgresql.auto.conf", "port = {0}".format(node_restored.port))
|
||||||
node_restored.start()
|
node_restored.slow_start()
|
||||||
|
|
||||||
while node_restored.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
# Logical comparison
|
# Logical comparison
|
||||||
result1 = node.safe_psql(
|
result1 = node.safe_psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"select * from t_heap"
|
"select * from t_heap")
|
||||||
)
|
|
||||||
result2 = node_restored.safe_psql(
|
result2 = node_restored.safe_psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
"select * from t_heap"
|
"select * from t_heap")
|
||||||
)
|
|
||||||
self.assertEqual(result1, result2)
|
self.assertEqual(result1, result2)
|
||||||
|
|
||||||
# Clean after yourself
|
# Clean after yourself
|
||||||
@ -175,7 +163,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
backup_id=full_backup_id, options=["-j", "4"]),
|
backup_id=full_backup_id, options=["-j", "4"]),
|
||||||
'\n Unexpected Error Message: {0}\n'
|
'\n Unexpected Error Message: {0}\n'
|
||||||
' CMD: {1}'.format(repr(self.output), self.cmd))
|
' CMD: {1}'.format(repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(full_result, full_result_new)
|
self.assertEqual(full_result, full_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -188,7 +176,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
backup_id=page_backup_id, options=["-j", "4"]),
|
backup_id=page_backup_id, options=["-j", "4"]),
|
||||||
'\n Unexpected Error Message: {0}\n'
|
'\n Unexpected Error Message: {0}\n'
|
||||||
' CMD: {1}'.format(repr(self.output), self.cmd))
|
' CMD: {1}'.format(repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(page_result, page_result_new)
|
self.assertEqual(page_result, page_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -254,7 +242,8 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
full_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(full_result, full_result_new)
|
self.assertEqual(full_result, full_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -271,7 +260,8 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
page_result_new = node.execute("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(page_result, page_result_new)
|
self.assertEqual(page_result, page_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -349,10 +339,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
# START RESTORED NODE
|
# START RESTORED NODE
|
||||||
restored_node.append_conf(
|
restored_node.append_conf(
|
||||||
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
||||||
restored_node.start()
|
restored_node.slow_start()
|
||||||
while restored_node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
result_new = restored_node.safe_psql(
|
result_new = restored_node.safe_psql(
|
||||||
"postgres", "select * from pgbench_accounts")
|
"postgres", "select * from pgbench_accounts")
|
||||||
|
@ -586,10 +586,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd)
|
repr(self.output), self.cmd)
|
||||||
)
|
)
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
time.sleep(1)
|
|
||||||
full_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
full_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(full_result, full_result_new)
|
self.assertEqual(full_result, full_result_new)
|
||||||
node.cleanup()
|
node.cleanup()
|
||||||
@ -611,10 +608,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
|||||||
node.data_dir, ignore_ptrack=False)
|
node.data_dir, ignore_ptrack=False)
|
||||||
self.compare_pgdata(pgdata, pgdata_restored)
|
self.compare_pgdata(pgdata, pgdata_restored)
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
time.sleep(1)
|
|
||||||
ptrack_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
ptrack_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(ptrack_result, ptrack_result_new)
|
self.assertEqual(ptrack_result, ptrack_result_new)
|
||||||
|
|
||||||
@ -691,11 +685,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd)
|
repr(self.output), self.cmd)
|
||||||
)
|
)
|
||||||
node.start()
|
node.slow_start()
|
||||||
|
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
full_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
full_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(full_result, full_result_new)
|
self.assertEqual(full_result, full_result_new)
|
||||||
@ -721,10 +711,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
|||||||
node.data_dir, ignore_ptrack=False)
|
node.data_dir, ignore_ptrack=False)
|
||||||
self.compare_pgdata(pgdata, pgdata_restored)
|
self.compare_pgdata(pgdata, pgdata_restored)
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
time.sleep(1)
|
|
||||||
ptrack_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
ptrack_result_new = node.safe_psql("postgres", "SELECT * FROM t_heap")
|
||||||
self.assertEqual(ptrack_result, ptrack_result_new)
|
self.assertEqual(ptrack_result, ptrack_result_new)
|
||||||
|
|
||||||
@ -1176,11 +1163,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
|||||||
# START RESTORED NODE
|
# START RESTORED NODE
|
||||||
node_restored.append_conf(
|
node_restored.append_conf(
|
||||||
'postgresql.auto.conf', 'port = {0}'.format(node_restored.port))
|
'postgresql.auto.conf', 'port = {0}'.format(node_restored.port))
|
||||||
node_restored.start()
|
node_restored.slow_start()
|
||||||
|
|
||||||
while node_restored.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
time.sleep(1)
|
|
||||||
result_new = node_restored.safe_psql(
|
result_new = node_restored.safe_psql(
|
||||||
"postgres", "select * from t_heap")
|
"postgres", "select * from t_heap")
|
||||||
|
|
||||||
@ -1412,10 +1396,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
|||||||
# START RESTORED NODE
|
# START RESTORED NODE
|
||||||
restored_node.append_conf(
|
restored_node.append_conf(
|
||||||
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
||||||
restored_node.start()
|
restored_node.slow_start()
|
||||||
while restored_node.psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()")[0] != 0:
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
# COMPARE LOGICAL CONTENT
|
# COMPARE LOGICAL CONTENT
|
||||||
result_new = restored_node.safe_psql(
|
result_new = restored_node.safe_psql(
|
||||||
@ -1450,11 +1431,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
|||||||
# START RESTORED NODE
|
# START RESTORED NODE
|
||||||
restored_node.append_conf(
|
restored_node.append_conf(
|
||||||
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
||||||
restored_node.start()
|
restored_node.slow_start()
|
||||||
while restored_node.psql(
|
|
||||||
"postgres",
|
|
||||||
"select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
result_new = restored_node.safe_psql(
|
result_new = restored_node.safe_psql(
|
||||||
"postgres", "select * from t_heap")
|
"postgres", "select * from t_heap")
|
||||||
@ -1553,11 +1530,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
|||||||
# START RESTORED NODE
|
# START RESTORED NODE
|
||||||
restored_node.append_conf(
|
restored_node.append_conf(
|
||||||
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
"postgresql.auto.conf", "port = {0}".format(restored_node.port))
|
||||||
restored_node.start()
|
restored_node.slow_start()
|
||||||
while restored_node.psql(
|
|
||||||
"postgres",
|
|
||||||
"select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
result_new = restored_node.safe_psql(
|
result_new = restored_node.safe_psql(
|
||||||
"postgres",
|
"postgres",
|
||||||
|
@ -53,10 +53,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
recovery_conf = os.path.join(node.data_dir, "recovery.conf")
|
recovery_conf = os.path.join(node.data_dir, "recovery.conf")
|
||||||
self.assertEqual(os.path.isfile(recovery_conf), True)
|
self.assertEqual(os.path.isfile(recovery_conf), True)
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
||||||
self.assertEqual(before, after)
|
self.assertEqual(before, after)
|
||||||
@ -104,10 +101,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
||||||
self.assertEqual(before, after)
|
self.assertEqual(before, after)
|
||||||
@ -149,11 +143,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start(params=['-t', '10'])
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
pgbench = node.pgbench(
|
pgbench = node.pgbench(
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||||
options=['-T', '10', '-c', '2', '--no-vacuum'])
|
options=['-T', '10', '-c', '2', '--no-vacuum'])
|
||||||
@ -181,11 +171,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
node)["recovery_target_timeline"]
|
node)["recovery_target_timeline"]
|
||||||
self.assertEqual(int(recovery_target_timeline), target_tli)
|
self.assertEqual(int(recovery_target_timeline), target_tli)
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
||||||
self.assertEqual(before, after)
|
self.assertEqual(before, after)
|
||||||
|
|
||||||
@ -234,11 +220,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
||||||
self.assertEqual(before, after)
|
self.assertEqual(before, after)
|
||||||
|
|
||||||
@ -297,11 +279,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
after = node.safe_psql("postgres", "SELECT * FROM pgbench_branches")
|
after = node.safe_psql("postgres", "SELECT * FROM pgbench_branches")
|
||||||
self.assertEqual(before, after)
|
self.assertEqual(before, after)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -366,11 +344,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
||||||
self.assertEqual(before, after)
|
self.assertEqual(before, after)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -420,11 +394,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
||||||
self.assertEqual(before, after)
|
self.assertEqual(before, after)
|
||||||
|
|
||||||
@ -479,11 +449,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
||||||
self.assertEqual(before, after)
|
self.assertEqual(before, after)
|
||||||
|
|
||||||
@ -535,11 +501,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
after = node.execute("postgres", "SELECT * FROM pgbench_branches")
|
||||||
self.assertEqual(before, after)
|
self.assertEqual(before, after)
|
||||||
|
|
||||||
@ -602,11 +564,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
bbalance = node.execute(
|
bbalance = node.execute(
|
||||||
"postgres", "SELECT sum(bbalance) FROM pgbench_branches")
|
"postgres", "SELECT sum(bbalance) FROM pgbench_branches")
|
||||||
delta = node.execute(
|
delta = node.execute(
|
||||||
@ -674,11 +632,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
options=["-j", "4", "--recovery-target-action=promote"]),
|
options=["-j", "4", "--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
bbalance = node.execute(
|
bbalance = node.execute(
|
||||||
"postgres", "SELECT sum(bbalance) FROM pgbench_branches")
|
"postgres", "SELECT sum(bbalance) FROM pgbench_branches")
|
||||||
delta = node.execute(
|
delta = node.execute(
|
||||||
@ -769,10 +723,8 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
result = node.execute("postgres", "SELECT id FROM test")
|
result = node.execute("postgres", "SELECT id FROM test")
|
||||||
self.assertEqual(result[0][0], 1)
|
self.assertEqual(result[0][0], 1)
|
||||||
|
|
||||||
@ -802,10 +754,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
result = node.execute("postgres", "SELECT id FROM test OFFSET 1")
|
result = node.execute("postgres", "SELECT id FROM test OFFSET 1")
|
||||||
self.assertEqual(result[0][0], 2)
|
self.assertEqual(result[0][0], 2)
|
||||||
|
|
||||||
@ -881,10 +830,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-action=promote"]),
|
"--recovery-target-action=promote"]),
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
count = node.execute("postgres", "SELECT count(*) FROM tbl")
|
count = node.execute("postgres", "SELECT count(*) FROM tbl")
|
||||||
self.assertEqual(count[0][0], 4)
|
self.assertEqual(count[0][0], 4)
|
||||||
@ -935,10 +881,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
result = node.psql("postgres", 'select * from t_heap')
|
result = node.psql("postgres", 'select * from t_heap')
|
||||||
self.assertTrue('does not exist' in result[2].decode("utf-8"))
|
self.assertTrue('does not exist' in result[2].decode("utf-8"))
|
||||||
@ -987,11 +930,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
result = node.psql("postgres", 'select * from t_heap')
|
result = node.psql("postgres", 'select * from t_heap')
|
||||||
self.assertTrue('does not exist' in result[2].decode("utf-8"))
|
self.assertTrue('does not exist' in result[2].decode("utf-8"))
|
||||||
|
|
||||||
@ -1039,10 +978,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(self.output), self.cmd))
|
repr(self.output), self.cmd))
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
result = node.psql("postgres", 'select * from t_heap')
|
result = node.psql("postgres", 'select * from t_heap')
|
||||||
self.assertEqual(True, 'does not exist' in result[2].decode("utf-8"))
|
self.assertEqual(True, 'does not exist' in result[2].decode("utf-8"))
|
||||||
@ -1097,10 +1033,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
pgdata_restored = self.pgdata_content(node.data_dir)
|
pgdata_restored = self.pgdata_content(node.data_dir)
|
||||||
self.compare_pgdata(pgdata, pgdata_restored)
|
self.compare_pgdata(pgdata, pgdata_restored)
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
result = node.psql("postgres", 'select * from t_heap')
|
result = node.psql("postgres", 'select * from t_heap')
|
||||||
self.assertTrue('does not exist' in result[2].decode("utf-8"))
|
self.assertTrue('does not exist' in result[2].decode("utf-8"))
|
||||||
@ -1149,10 +1082,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
"--recovery-target-name=savepoint",
|
"--recovery-target-name=savepoint",
|
||||||
"--recovery-target-action=promote"])
|
"--recovery-target-action=promote"])
|
||||||
|
|
||||||
node.start()
|
node.slow_start()
|
||||||
while node.safe_psql(
|
|
||||||
"postgres", "select pg_is_in_recovery()") == 't\n':
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
result_new = node.safe_psql("postgres", "select * from t_heap")
|
result_new = node.safe_psql("postgres", "select * from t_heap")
|
||||||
res = node.psql("postgres", "select * from t_heap_1")
|
res = node.psql("postgres", "select * from t_heap_1")
|
||||||
|
@ -1320,7 +1320,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.restore_node(backup_dir, 'node1', data_dir=node2.data_dir)
|
self.restore_node(backup_dir, 'node1', data_dir=node2.data_dir)
|
||||||
node2.append_conf(
|
node2.append_conf(
|
||||||
'postgresql.auto.conf', 'port = {0}'.format(node2.port))
|
'postgresql.auto.conf', 'port = {0}'.format(node2.port))
|
||||||
node2.start()
|
node2.slow_start()
|
||||||
|
|
||||||
timeline_node1 = node1.get_control_data()["Latest checkpoint's TimeLineID"]
|
timeline_node1 = node1.get_control_data()["Latest checkpoint's TimeLineID"]
|
||||||
timeline_node2 = node2.get_control_data()["Latest checkpoint's TimeLineID"]
|
timeline_node2 = node2.get_control_data()["Latest checkpoint's TimeLineID"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user