114 setenv(
"LC_MESSAGES",
"C", 1);
122 snprintf(cmd,
sizeof(cmd),
"\"%s/pg_controldata\" \"%s\"",
127 pg_fatal(
"could not get control data using %s: %m", cmd);
153 if (
strcmp(p,
"shut down in recovery") == 0)
156 pg_fatal(
"The source cluster was shut down while in recovery mode. To upgrade, use \"rsync\" as documented or shut it down as a primary.");
158 pg_fatal(
"The target cluster was shut down while in recovery mode. To upgrade, use \"rsync\" as documented or shut it down as a primary.");
160 else if (
strcmp(p,
"shut down") != 0)
163 pg_fatal(
"The source cluster was not shut down cleanly, state reported as: \"%s\"", p);
165 pg_fatal(
"The target cluster was not shut down cleanly, state reported as: \"%s\"", p);
173 pg_fatal(
"could not get control data using %s: %s",
179 pg_fatal(
"The source cluster lacks cluster state information:");
181 pg_fatal(
"The target cluster lacks cluster state information:");
185 snprintf(cmd,
sizeof(cmd),
"\"%s/%s \"%s\"",
187 live_check ?
"pg_controldata\"" :
"pg_resetwal\" -n",
192 pg_fatal(
"could not get control data using %s: %m", cmd);
251 else if ((p =
strstr(
bufin,
"Latest checkpoint's NextMultiXactId:")) !=
NULL)
262 else if ((p =
strstr(
bufin,
"Latest checkpoint's oldestXID:")) !=
NULL)
273 else if ((p =
strstr(
bufin,
"Latest checkpoint's oldestMultiXid:")) !=
NULL)
284 else if ((p =
strstr(
bufin,
"Latest checkpoint's NextMultiOffset:")) !=
NULL)
295 else if ((p =
strstr(
bufin,
"First log segment after reset:")) !=
NULL)
301 p =
strpbrk(p,
"0123456789ABCDEF");
306 if (
strspn(p,
"0123456789ABCDEF") != 24)
346 else if ((p =
strstr(
bufin,
"Blocks per segment of large relation:")) !=
NULL)
379 else if ((p =
strstr(
bufin,
"Maximum length of identifiers:")) !=
NULL)
401 else if ((p =
strstr(
bufin,
"Maximum size of a TOAST chunk:")) !=
NULL)
454 while (
isspace((
unsigned char) *p))
458 if (
strcmp(p,
"signed") != 0 &&
strcmp(p,
"unsigned") != 0)
461 cluster->controldata.default_char_signedness =
strcmp(p,
"signed") == 0;
468 pg_fatal(
"could not get control data using %s: %s",
517 cluster->controldata.default_char_signedness =
true;
519 cluster->controldata.default_char_signedness =
false;
538 "The source cluster lacks some required control information:");
541 "The target cluster lacks some required control information:");
605 pg_fatal(
"Cannot continue without required control information, terminating");
620 pg_fatal(
"old and new pg_controldata alignments are invalid or do not match.\n"
621 "Likely one cluster is a 32-bit install, the other 64-bit");
624 pg_fatal(
"old and new pg_controldata block sizes are invalid or do not match");
627 pg_fatal(
"old and new pg_controldata maximum relation segment sizes are invalid or do not match");
630 pg_fatal(
"old and new pg_controldata WAL block sizes are invalid or do not match");
633 pg_fatal(
"old and new pg_controldata WAL segment sizes are invalid or do not match");
636 pg_fatal(
"old and new pg_controldata maximum identifier lengths are invalid or do not match");
639 pg_fatal(
"old and new pg_controldata maximum indexed columns are invalid or do not match");
642 pg_fatal(
"old and new pg_controldata maximum TOAST chunk sizes are invalid or do not match");
644 if (
oldctrl->large_object == 0 ||
646 pg_fatal(
"old and new pg_controldata large-object chunk sizes are invalid or do not match");
649 pg_fatal(
"old and new pg_controldata date/time storage types do not match");
662 pg_fatal(
"checksums are being enabled in the old cluster");
670 pg_fatal(
"old cluster does not use data checksums but the new one does");
673 pg_fatal(
"old cluster uses data checksums but the new one does not");
674 else if (
oldctrl->data_checksum_version !=
newctrl->data_checksum_version)
675 pg_fatal(
"old and new cluster pg_controldata checksum versions do not match");
692 pg_fatal(
"could not rename file \"%s\" to \"%s\": %m",
699 "If you want to start the old cluster, you will need to remove\n"
700 "the \".old\" suffix from \"%s/%s.old\".\n"
701 "Because \"link\" mode was used, the old cluster cannot be safely\n"
702 "started once the new cluster has been started.",
706 "Because \"swap\" mode was used, the old cluster can no longer be\n"
709 pg_fatal(
"unrecognized transfer mode");
#define Assert(condition)
@ PG_DATA_CHECKSUM_VERSION
void get_control_data(ClusterInfo *cluster)
void check_control_data(ControlData *oldctrl, ControlData *newctrl)
void disable_old_cluster(transferMode transfer_mode)
char * pg_strdup(const char *in)
static char * lc_messages
static void check_ok(void)
static char * lc_monetary
void void unsigned int str2uint(const char *str)
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
#define DEFAULT_CHAR_SIGNEDNESS_CAT_VER
void prep_status(const char *fmt,...) pg_attribute_printf(1
size_t strlcpy(char *dst, const char *src, size_t siz)
int pg_strip_crlf(char *str)
char * wait_result_to_str(int exitstatus)
#define XLOG_CONTROL_FILE