1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-07-04 05:40:26 +02:00

Improve compatibility between different versions of binary and instance

This commit is contained in:
Grigory Smolkin
2019-09-18 09:08:16 +03:00
parent 3fa01d3236
commit b69e29bc0b
3 changed files with 23 additions and 4 deletions

View File

@ -571,7 +571,14 @@ readInstanceConfigFile(const char *instance_name)
if (compress_alg) if (compress_alg)
instance->compress_alg = parse_compress_alg(compress_alg); instance->compress_alg = parse_compress_alg(compress_alg);
#if PG_VERSION_NUM >= 110000
/* If for some reason xlog-seg-size is missing, then set it to 16MB */
if (!instance->xlog_seg_size)
instance->xlog_seg_size = DEFAULT_XLOG_SEG_SIZE;
#endif
return instance; return instance;
} }
static void static void

View File

@ -564,10 +564,18 @@ main(int argc, char *argv[])
#if PG_VERSION_NUM >= 110000 #if PG_VERSION_NUM >= 110000
/* Check xlog-seg-size option */ /* Check xlog-seg-size option */
if (instance_name && if (instance_name &&
backup_subcmd != INIT_CMD && backup_subcmd != SHOW_CMD && backup_subcmd != INIT_CMD &&
backup_subcmd != ADD_INSTANCE_CMD && backup_subcmd != SET_CONFIG_CMD && backup_subcmd != ADD_INSTANCE_CMD && backup_subcmd != SET_CONFIG_CMD &&
!IsValidWalSegSize(instance_config.xlog_seg_size)) !IsValidWalSegSize(instance_config.xlog_seg_size))
{
/* If we are working with instance of PG<11 using PG11 binary,
* then xlog_seg_size is equal to zero. Manually set it to 16MB.
*/
if (instance_config.xlog_seg_size == 0)
instance_config.xlog_seg_size = DEFAULT_XLOG_SEG_SIZE;
else
elog(ERROR, "Invalid WAL segment size %u", instance_config.xlog_seg_size); elog(ERROR, "Invalid WAL segment size %u", instance_config.xlog_seg_size);
}
#endif #endif
/* Sanity check of --backup-id option */ /* Sanity check of --backup-id option */

View File

@ -78,7 +78,11 @@ do_show(const char *instance_name, time_t requested_backup_id, bool show_archive
{ {
if (instance_name == NULL && if (instance_name == NULL &&
requested_backup_id != INVALID_BACKUP_ID) requested_backup_id != INVALID_BACKUP_ID)
elog(ERROR, "You must specify --instance to use --backup_id option"); elog(ERROR, "You must specify --instance to use (-i, --backup-id) option");
if (show_archive &&
requested_backup_id != INVALID_BACKUP_ID)
elog(ERROR, "You cannot specify --archive and (-i, --backup-id) options together");
/* /*
* if instance_name is not specified, * if instance_name is not specified,