Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit48a2c83

Browse files
committed
[PBCKP-153] Added a test for the waldir option for the restore command
1 parent4185570 commit48a2c83

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

‎tests/restore.py‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,3 +3916,59 @@ def test_restore_issue_313(self):
39163916

39173917
# Clean after yourself
39183918
self.del_test_dir(module_name,fname)
3919+
3920+
# @unittest.skip("skip")
3921+
deftest_restore_with_waldir(self):
3922+
"""recovery using tablespace-mapping option and page backup"""
3923+
fname=self.id().split('.')[3]
3924+
node=self.make_simple_node(
3925+
base_dir=os.path.join(module_name,fname,'node'),
3926+
initdb_params=['--data-checksums'])
3927+
3928+
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
3929+
self.init_pb(backup_dir)
3930+
self.add_instance(backup_dir,'node',node)
3931+
self.set_archiving(backup_dir,'node',node)
3932+
node.slow_start()
3933+
3934+
3935+
withnode.connect("postgres")ascon:
3936+
con.execute(
3937+
"CREATE TABLE tbl AS SELECT * "
3938+
"FROM generate_series(0,3) AS integer")
3939+
con.commit()
3940+
3941+
# Full backup
3942+
backup_id=self.backup_node(backup_dir,'node',node)
3943+
3944+
node.stop()
3945+
node.cleanup()
3946+
3947+
# Create waldir
3948+
waldir_path=os.path.join(node.base_dir,"waldir")
3949+
os.makedirs(waldir_path)
3950+
3951+
# Test recovery from latest
3952+
self.assertIn(
3953+
"INFO: Restore of backup {0} completed.".format(backup_id),
3954+
self.restore_node(
3955+
backup_dir,'node',node,
3956+
options=[
3957+
"-X","%s"% (waldir_path)]),
3958+
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
3959+
repr(self.output),self.cmd))
3960+
node.slow_start()
3961+
3962+
count=node.execute("postgres","SELECT count(*) FROM tbl")
3963+
self.assertEqual(count[0][0],4)
3964+
3965+
# check pg_wal is symlink
3966+
ifnode.major_version>=10:
3967+
wal_path=os.path.join(node.data_dir,"pg_wal")
3968+
else:
3969+
wal_path=os.path.join(node.data_dir,"pg_xlog")
3970+
3971+
self.assertEqual(os.path.islink(wal_path),True)
3972+
3973+
# Clean after yourself
3974+
self.del_test_dir(module_name,fname)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp