Skip to content

Commit 249876a

Browse files
committed
[PBCKP-232] remove deprecated options (master-db, master-host, master-port, master-user, replica-timeout) part 2
1 parent a880b91 commit 249876a

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

src/configure.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ static void show_configure_json(ConfigOption *opt);
3434

3535
#define OPTION_INSTANCE_GROUP "Backup instance information"
3636
#define OPTION_CONN_GROUP "Connection parameters"
37-
#define OPTION_REPLICA_GROUP "Replica parameters"
3837
#define OPTION_ARCHIVE_GROUP "Archive parameters"
3938
#define OPTION_LOG_GROUP "Logging parameters"
4039
#define OPTION_RETENTION_GROUP "Retention parameters"
4140
#define OPTION_COMPRESS_GROUP "Compression parameters"
4241
#define OPTION_REMOTE_GROUP "Remote access parameters"
4342

43+
/* dummy placeholder for obsolete options to store in following instance_options[] */
44+
static char *obsolete_option_placeholder = NULL;
45+
4446
/*
4547
* Short name should be non-printable ASCII character.
4648
*/
@@ -90,6 +92,27 @@ ConfigOption instance_options[] =
9092
&instance_config.conn_opt.pguser, SOURCE_CMD, 0,
9193
OPTION_CONN_GROUP, 0, option_get_value
9294
},
95+
/* Obsolete options */
96+
{
97+
's', 202, "master-db",
98+
&obsolete_option_placeholder, SOURCE_FILE_STRICT, SOURCE_CONST, "", 0, option_get_value
99+
},
100+
{
101+
's', 203, "master-host",
102+
&obsolete_option_placeholder, SOURCE_FILE_STRICT, SOURCE_CONST, "", 0, option_get_value
103+
},
104+
{
105+
's', 204, "master-port",
106+
&obsolete_option_placeholder, SOURCE_FILE_STRICT, SOURCE_CONST, "", 0, option_get_value
107+
},
108+
{
109+
's', 205, "master-user",
110+
&obsolete_option_placeholder, SOURCE_FILE_STRICT, SOURCE_CONST, "", 0, option_get_value
111+
},
112+
{
113+
's', 206, "replica-timeout",
114+
&obsolete_option_placeholder, SOURCE_FILE_STRICT, SOURCE_CONST, "", 0, option_get_value
115+
},
93116
/* Archive options */
94117
{
95118
'u', 207, "archive-timeout",

tests/compatibility.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,3 +1482,51 @@ def test_compatibility_tablespace(self):
14821482

14831483
# Clean after yourself
14841484
self.del_test_dir(module_name, fname)
1485+
1486+
# @unittest.skip("skip")
1487+
def test_compatibility_master_options(self):
1488+
"""
1489+
Test correctness of handling of removed master-db, master-host, master-port,
1490+
master-user and replica-timeout options
1491+
"""
1492+
self.assertTrue(
1493+
self.version_to_num(self.old_probackup_version) <= self.version_to_num('2.6.0'),
1494+
'You need pg_probackup old_binary =< 2.6.0 for this test')
1495+
1496+
fname = self.id().split('.')[3]
1497+
node = self.make_simple_node(base_dir=os.path.join(module_name, fname, 'node'))
1498+
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
1499+
1500+
self.init_pb(backup_dir, old_binary=True)
1501+
self.add_instance(backup_dir, 'node', node, old_binary=True)
1502+
1503+
# add deprecated options (using probackup< 2.6) into pg_probackup.conf
1504+
# don't care about option values, we can use random values here
1505+
self.set_config(
1506+
backup_dir, 'node',
1507+
options=[
1508+
'--master-db=postgres',
1509+
'--master-host=localhost',
1510+
'--master-port=5432',
1511+
'--master-user={0}'.format(self.user),
1512+
'--replica-timeout=100500'],
1513+
old_binary=True)
1514+
1515+
# and try to show config with new binary (those options must be silently skipped)
1516+
self.show_config(backup_dir, 'node', old_binary=False)
1517+
1518+
# store config with new version (those options must disappear from config)
1519+
self.set_config(
1520+
backup_dir, 'node',
1521+
options=[],
1522+
old_binary=False)
1523+
1524+
# and check absence
1525+
config_options = self.show_config(backup_dir, 'node', old_binary=False)
1526+
self.assertFalse(
1527+
['master-db', 'master-host', 'master-port', 'master-user', 'replica-timeout'] & config_options.keys(),
1528+
'Obsolete options found in new config')
1529+
1530+
# Clean after yourself
1531+
self.del_test_dir(module_name, fname)
1532+

0 commit comments

Comments
 (0)