Skip to content

Commit b69e29b

Browse files
committed
Improve compatibility between different versions of binary and instance
1 parent 3fa01d3 commit b69e29b

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/configure.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,14 @@ readInstanceConfigFile(const char *instance_name)
571571
if (compress_alg)
572572
instance->compress_alg = parse_compress_alg(compress_alg);
573573

574+
#if PG_VERSION_NUM >= 110000
575+
/* If for some reason xlog-seg-size is missing, then set it to 16MB */
576+
if (!instance->xlog_seg_size)
577+
instance->xlog_seg_size = DEFAULT_XLOG_SEG_SIZE;
578+
#endif
579+
574580
return instance;
581+
575582
}
576583

577584
static void

src/pg_probackup.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,18 @@ main(int argc, char *argv[])
564564
#if PG_VERSION_NUM >= 110000
565565
/* Check xlog-seg-size option */
566566
if (instance_name &&
567-
backup_subcmd != INIT_CMD && backup_subcmd != SHOW_CMD &&
567+
backup_subcmd != INIT_CMD &&
568568
backup_subcmd != ADD_INSTANCE_CMD && backup_subcmd != SET_CONFIG_CMD &&
569569
!IsValidWalSegSize(instance_config.xlog_seg_size))
570-
elog(ERROR, "Invalid WAL segment size %u", instance_config.xlog_seg_size);
570+
{
571+
/* If we are working with instance of PG<11 using PG11 binary,
572+
* then xlog_seg_size is equal to zero. Manually set it to 16MB.
573+
*/
574+
if (instance_config.xlog_seg_size == 0)
575+
instance_config.xlog_seg_size = DEFAULT_XLOG_SEG_SIZE;
576+
else
577+
elog(ERROR, "Invalid WAL segment size %u", instance_config.xlog_seg_size);
578+
}
571579
#endif
572580

573581
/* Sanity check of --backup-id option */

src/show.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ do_show(const char *instance_name, time_t requested_backup_id, bool show_archive
7878
{
7979
if (instance_name == NULL &&
8080
requested_backup_id != INVALID_BACKUP_ID)
81-
elog(ERROR, "You must specify --instance to use --backup_id option");
81+
elog(ERROR, "You must specify --instance to use (-i, --backup-id) option");
82+
83+
if (show_archive &&
84+
requested_backup_id != INVALID_BACKUP_ID)
85+
elog(ERROR, "You cannot specify --archive and (-i, --backup-id) options together");
8286

8387
/*
8488
* if instance_name is not specified,
@@ -105,7 +109,7 @@ do_show(const char *instance_name, time_t requested_backup_id, bool show_archive
105109

106110
return 0;
107111
}
108-
/* always use */
112+
/* always use */
109113
else if (show_format == SHOW_JSON ||
110114
requested_backup_id == INVALID_BACKUP_ID)
111115
{

0 commit comments

Comments
 (0)