mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-25 09:01:48 +02:00
tests: minor fixes
This commit is contained in:
parent
4aab7c488b
commit
75b0ff2881
@ -485,7 +485,7 @@ class CompatibilityTest(ProbackupTest, unittest.TestCase):
|
||||
def test_backward_compatibility_merge(self):
|
||||
"""
|
||||
Create node, take FULL and PAGE backups with old binary,
|
||||
merge them with
|
||||
merge them with new binary
|
||||
"""
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
@ -520,7 +520,7 @@ class CompatibilityTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
self.merge_backup(backup_dir, "node", backup_id)
|
||||
|
||||
print(self.show_pb(backup_dir, as_text=True))
|
||||
print(self.show_pb(backup_dir, as_text=True, as_json=False))
|
||||
|
||||
# restore OLD FULL with new binary
|
||||
node_restored = self.make_simple_node(
|
||||
|
@ -1224,28 +1224,23 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
||||
"postgres",
|
||||
"create table t_heap as select i as id,"
|
||||
" md5(i::text) as text, md5(i::text)::tsvector as tsvector"
|
||||
" from generate_series(0,1000) i"
|
||||
)
|
||||
" from generate_series(0,1000) i")
|
||||
|
||||
# DELTA BACKUP
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node, backup_type='delta'
|
||||
)
|
||||
backup_dir, 'node', node, backup_type='delta')
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"delete from t_heap"
|
||||
)
|
||||
"delete from t_heap")
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"vacuum t_heap"
|
||||
)
|
||||
"vacuum t_heap")
|
||||
|
||||
# DELTA BACKUP
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node, backup_type='delta'
|
||||
)
|
||||
backup_dir, 'node', node, backup_type='delta')
|
||||
|
||||
if self.paranoia:
|
||||
pgdata = self.pgdata_content(node.data_dir)
|
||||
@ -1285,6 +1280,59 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
||||
def test_merge_different_compression_algo(self):
|
||||
"""
|
||||
Check that backups with different compression algorihtms can be merged
|
||||
"""
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
node = self.make_simple_node(
|
||||
base_dir=os.path.join(module_name, fname, 'node'),
|
||||
set_replication=True,
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={'wal_level': 'replica'})
|
||||
|
||||
self.init_pb(backup_dir)
|
||||
self.add_instance(backup_dir, 'node', node)
|
||||
self.set_archiving(backup_dir, 'node', node)
|
||||
node.slow_start()
|
||||
|
||||
# FULL backup
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node, options=['--compress-algorithm=zlib'])
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"create table t_heap as select i as id,"
|
||||
" md5(i::text) as text, md5(i::text)::tsvector as tsvector"
|
||||
" from generate_series(0,1000) i")
|
||||
|
||||
# DELTA BACKUP
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node,
|
||||
backup_type='delta', options=['--compress-algorithm=pglz'])
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"delete from t_heap")
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"vacuum t_heap")
|
||||
|
||||
# DELTA BACKUP
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node, backup_type='delta')
|
||||
|
||||
if self.paranoia:
|
||||
pgdata = self.pgdata_content(node.data_dir)
|
||||
|
||||
backup_id = self.show_pb(backup_dir, "node")[2]["id"]
|
||||
|
||||
self.merge_backup(backup_dir, "node", backup_id)
|
||||
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
||||
# 1. always use parent link when merging (intermediates may be from different chain)
|
||||
# 2. page backup we are merging with may disappear after failed merge,
|
||||
# it should not be possible to continue merge after that
|
||||
|
Loading…
Reference in New Issue
Block a user