105 if (
getenv(
"LC_MESSAGES"))
121 setenv(
"LC_MESSAGES",
"C", 1);
129 snprintf(cmd,
sizeof(cmd),
"\"%s/pg_controldata\" \"%s\"",
134 pg_fatal(
"could not get control data using %s: %m", cmd);
160 if (
strcmp(p,
"shut down in recovery") == 0)
163 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.");
165 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.");
167 else if (
strcmp(p,
"shut down") != 0)
170 pg_fatal(
"The source cluster was not shut down cleanly, state reported as: \"%s\"", p);
172 pg_fatal(
"The target cluster was not shut down cleanly, state reported as: \"%s\"", p);
180 pg_fatal(
"could not get control data using %s: %s",
186 pg_fatal(
"The source cluster lacks cluster state information:");
188 pg_fatal(
"The target cluster lacks cluster state information:");
197 snprintf(cmd,
sizeof(cmd),
"\"%s/%s \"%s\"",
204 pg_fatal(
"could not get control data using %s: %m", cmd);
240 else if ((p =
strstr(
bufin,
"Latest checkpoint's TimeLineID:")) !=
NULL)
251 else if ((p =
strstr(
bufin,
"First log file ID after reset:")) !=
NULL)
262 else if ((p =
strstr(
bufin,
"First log file segment after reset:")) !=
NULL)
314 else if ((p =
strstr(
bufin,
"Latest checkpoint's NextMultiXactId:")) !=
NULL)
325 else if ((p =
strstr(
bufin,
"Latest checkpoint's oldestXID:")) !=
NULL)
336 else if ((p =
strstr(
bufin,
"Latest checkpoint's oldestMultiXid:")) !=
NULL)
347 else if ((p =
strstr(
bufin,
"Latest checkpoint's NextMultiOffset:")) !=
NULL)
358 else if ((p =
strstr(
bufin,
"First log segment after reset:")) !=
NULL)
364 p =
strpbrk(p,
"01234567890ABCDEF");
369 if (
strspn(p,
"0123456789ABCDEF") != 24)
409 else if ((p =
strstr(
bufin,
"Blocks per segment of large relation:")) !=
NULL)
442 else if ((p =
strstr(
bufin,
"Maximum length of identifiers:")) !=
NULL)
464 else if ((p =
strstr(
bufin,
"Maximum size of a TOAST chunk:")) !=
NULL)
517 while (
isspace((
unsigned char) *p))
521 if (
strcmp(p,
"signed") != 0 &&
strcmp(p,
"unsigned") != 0)
524 cluster->controldata.default_char_signedness =
strcmp(p,
"signed") == 0;
531 pg_fatal(
"could not get control data using %s: %s",
596 cluster->controldata.default_char_signedness =
true;
598 cluster->controldata.default_char_signedness =
false;
619 "The source cluster lacks some required control information:");
622 "The target cluster lacks some required control information:");
688 pg_fatal(
"Cannot continue without required control information, terminating");
703 pg_fatal(
"old and new pg_controldata alignments are invalid or do not match.\n"
704 "Likely one cluster is a 32-bit install, the other 64-bit");
707 pg_fatal(
"old and new pg_controldata block sizes are invalid or do not match");
710 pg_fatal(
"old and new pg_controldata maximum relation segment sizes are invalid or do not match");
713 pg_fatal(
"old and new pg_controldata WAL block sizes are invalid or do not match");
716 pg_fatal(
"old and new pg_controldata WAL segment sizes are invalid or do not match");
719 pg_fatal(
"old and new pg_controldata maximum identifier lengths are invalid or do not match");
722 pg_fatal(
"old and new pg_controldata maximum indexed columns are invalid or do not match");
725 pg_fatal(
"old and new pg_controldata maximum TOAST chunk sizes are invalid or do not match");
728 if (
oldctrl->large_object != 0 &&
730 pg_fatal(
"old and new pg_controldata large-object chunk sizes are invalid or do not match");
733 pg_fatal(
"old and new pg_controldata date/time storage types do not match");
746 pg_fatal(
"checksums are being enabled in the old cluster");
754 pg_fatal(
"old cluster does not use data checksums but the new one does");
757 pg_fatal(
"old cluster uses data checksums but the new one does not");
758 else if (
oldctrl->data_checksum_version !=
newctrl->data_checksum_version)
759 pg_fatal(
"old and new cluster pg_controldata checksum versions do not match");
776 pg_fatal(
"could not rename file \"%s\" to \"%s\": %m",
783 "If you want to start the old cluster, you will need to remove\n"
784 "the \".old\" suffix from \"%s/%s.old\".\n"
785 "Because \"link\" mode was used, the old cluster cannot be safely\n"
786 "started once the new cluster has been started.",
790 "Because \"swap\" mode was used, the old cluster can no longer be\n"
793 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
#define LARGE_OBJECT_SIZE_PG_CONTROL_VER
#define MULTIXACT_FORMATCHANGE_CAT_VER
void void unsigned int str2uint(const char *str)
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
#define GET_MAJOR_VERSION(v)
#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