1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-03-17 21:18:00 +02:00

PBCKP-732 ignore PGDATA setting in catchup mode as we use --source-pgdata instead

This commit is contained in:
Sergey Fukanchik 2023-09-18 18:12:06 +03:00 committed by s.fukanchik
parent a29e378f34
commit 9762426ce9
2 changed files with 40 additions and 1 deletions

View File

@ -682,7 +682,7 @@ main(int argc, char *argv[])
if (instance_config.pgdata != NULL)
canonicalize_path(instance_config.pgdata);
if (instance_config.pgdata != NULL &&
backup_subcmd != ARCHIVE_GET_CMD &&
(backup_subcmd != ARCHIVE_GET_CMD && backup_subcmd != CATCHUP_CMD) &&
!is_absolute_path(instance_config.pgdata))
elog(ERROR, "-D, --pgdata must be an absolute path");

View File

@ -1585,3 +1585,42 @@ class CatchupTest(ProbackupTest, unittest.TestCase):
# Cleanup
src_pg.stop()
def test_pgdata_is_ignored(self):
""" In catchup we still allow PGDATA to be set either from command line
or from the env var. This test that PGDATA is actually ignored and
--source-pgadta is used instead
"""
node = self.make_simple_node('node',
set_replication = True
)
node.slow_start()
# do full catchup
dest = self.make_empty_node('dst')
self.catchup_node(
backup_mode = 'FULL',
source_pgdata = node.data_dir,
destination_node = dest,
options = ['-d', 'postgres', '-p', str(node.port), '--stream', '--pgdata=xxx']
)
self.compare_pgdata(
self.pgdata_content(node.data_dir),
self.pgdata_content(dest.data_dir)
)
os.environ['PGDATA']='xxx'
dest2 = self.make_empty_node('dst')
self.catchup_node(
backup_mode = 'FULL',
source_pgdata = node.data_dir,
destination_node = dest2,
options = ['-d', 'postgres', '-p', str(node.port), '--stream']
)
self.compare_pgdata(
self.pgdata_content(node.data_dir),
self.pgdata_content(dest2.data_dir)
)