Definition at line 39 of file controldata.c.
40{
44 char *p;
75 int rc;
77
78
79
80
81
100
106#ifndef WIN32
108#else
109
111#endif
114 setenv(
"LC_MESSAGES",
"C", 1);
115
116
117
118
120 {
121
122 snprintf(cmd,
sizeof(cmd),
"\"%s/pg_controldata\" \"%s\"",
125
127 pg_fatal(
"could not get control data using %s: %m", cmd);
128
129
131 {
133 {
135
138
139 p++;
140
141
142
143
144
145
146
147
148
149
151 while (*p == ' ')
152 p++;
153 if (
strcmp(p,
"shut down in recovery") == 0)
154 {
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.");
157 else
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.");
159 }
160 else if (
strcmp(p,
"shut down") != 0)
161 {
163 pg_fatal(
"The source cluster was not shut down cleanly, state reported as: \"%s\"", p);
164 else
165 pg_fatal(
"The target cluster was not shut down cleanly, state reported as: \"%s\"", p);
166 }
168 }
169 }
170
172 if (rc != 0)
173 pg_fatal(
"could not get control data using %s: %s",
175
177 {
179 pg_fatal(
"The source cluster lacks cluster state information:");
180 else
181 pg_fatal(
"The target cluster lacks cluster state information:");
182 }
183 }
184
185 snprintf(cmd,
sizeof(cmd),
"\"%s/%s \"%s\"",
187 live_check ? "pg_controldata\"" : "pg_resetwal\" -n",
190
192 pg_fatal(
"could not get control data using %s: %m", cmd);
193
194
196 {
197
200
202 {
204
207
208 p++;
210 }
212 {
214
217
218 p++;
220 }
222 {
224
227
228 p++;
230
232
235
236 p++;
239 }
241 {
243
246
247 p++;
250 }
251 else if ((p =
strstr(
bufin,
"Latest checkpoint's NextMultiXactId:")) !=
NULL)
252 {
254
257
258 p++;
261 }
262 else if ((p =
strstr(
bufin,
"Latest checkpoint's oldestXID:")) !=
NULL)
263 {
265
268
269 p++;
272 }
273 else if ((p =
strstr(
bufin,
"Latest checkpoint's oldestMultiXid:")) !=
NULL)
274 {
276
279
280 p++;
283 }
284 else if ((p =
strstr(
bufin,
"Latest checkpoint's NextMultiOffset:")) !=
NULL)
285 {
287
290
291 p++;
294 }
295 else if ((p =
strstr(
bufin,
"First log segment after reset:")) !=
NULL)
296 {
297
301 p =
strpbrk(p,
"0123456789ABCDEF");
304
305
306 if (
strspn(p,
"0123456789ABCDEF") != 24)
308
311 }
313 {
315
318
319 p++;
320
323 }
325 {
327
330
331 p++;
334 }
336 {
338
341
342 p++;
345 }
346 else if ((p =
strstr(
bufin,
"Blocks per segment of large relation:")) !=
NULL)
347 {
349
352
353 p++;
356 }
358 {
360
363
364 p++;
367 }
369 {
371
374
375 p++;
378 }
379 else if ((p =
strstr(
bufin,
"Maximum length of identifiers:")) !=
NULL)
380 {
382
385
386 p++;
389 }
391 {
393
396
397 p++;
400 }
401 else if ((p =
strstr(
bufin,
"Maximum size of a TOAST chunk:")) !=
NULL)
402 {
404
407
408 p++;
411 }
413 {
415
418
419 p++;
422 }
424 {
426
429
430 p++;
433 }
435 {
437
440
441 p++;
444 }
446 {
448
451
452
453 p++;
454 while (
isspace((
unsigned char) *p))
455 p++;
456
457
458 if (
strcmp(p,
"signed") != 0 &&
strcmp(p,
"unsigned") != 0)
460
461 cluster->controldata.default_char_signedness =
strcmp(p,
"signed") == 0;
463 }
464 }
465
467 if (rc != 0)
468 pg_fatal(
"could not get control data using %s: %s",
470
471
472
473
474
485 if (lang)
487 else
495 else
497
507
508
509
510
511
512
514 {
516#if CHAR_MIN != 0
517 cluster->controldata.default_char_signedness =
true;
518#else
519 cluster->controldata.default_char_signedness =
false;
520#endif
521 }
522
523
535 {
538 "The source cluster lacks some required control information:");
539 else
541 "The target cluster lacks some required control information:");
542
545
548
551
554
557
560
563
566
569
572
575
578
581
584
587
590
593
596
597
600
601
604
605 pg_fatal(
"Cannot continue without required control information, terminating");
606 }
607}
#define Assert(condition)
char * pg_strdup(const char *in)
static char * lc_messages
static char * lc_monetary
void void unsigned int str2uint(const char *str)
#define DEFAULT_CHAR_SIGNEDNESS_CAT_VER
size_t strlcpy(char *dst, const char *src, size_t siz)
int pg_strip_crlf(char *str)
char * wait_result_to_str(int exitstatus)
References Assert, DEFAULT_CHAR_SIGNEDNESS_CAT_VER, fb(), lc_collate, lc_ctype, lc_messages, lc_monetary, lc_numeric, lc_time, UserOpts::live_check, MAX_STRING, MAXPGPATH, new_cluster, old_cluster, output, pg_fatal, pg_free(), pg_log(), PG_REPORT, pg_strdup(), pg_strip_crlf(), PG_VERBOSE, setenv, snprintf, str2uint(), strlcpy(), unsetenv, user_opts, and wait_result_to_str().
Referenced by check_cluster_compatibility().