* The bootstrap mode is used to initialize the template database.
* The bootstrap backend doesn't speak SQL, but instead expects
* commands in a special bootstrap language.
+ *
+ * When check_only is true, startup is done only far enough to verify that
+ * the current configuration, particularly the passed in options pertaining
+ * to shared memory sizing, options work (or at least do not cause an error
+ * up to shared memory creation).
*/
void
-BootstrapModeMain(int argc, char *argv[])
+BootstrapModeMain(int argc, char *argv[], bool check_only)
{
int i;
char *progname = argv[0];
/* Set defaults, to be overridden by explicit options below */
InitializeGUCOptions();
- /* an initial --boot should be present */
+ /* an initial --boot or --check should be present */
Assert(argc == 1
- || strcmp(argv[1], "--boot") != 0);
+ || strcmp(argv[1], "--boot") != 0
+ || strcmp(argv[1], "--check") != 0);
argv++;
argc--;
- /* If no -x argument, we are a CheckerProcess */
- MyAuxProcType = CheckerProcess;
-
- while ((flag = getopt(argc, argv, "B:c:d:D:Fkr:x:X:-:")) != -1)
+ while ((flag = getopt(argc, argv, "B:c:d:D:Fkr:X:-:")) != -1)
{
switch (flag)
{
case 'r':
strlcpy(OutputFileName, optarg, MAXPGPATH);
break;
- case 'x':
- MyAuxProcType = atoi(optarg);
- if (MyAuxProcType != CheckerProcess &&
- MyAuxProcType != BootstrapProcess)
- {
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("-x %s is invalid", optarg)));
- }
- break;
case 'X':
{
int WalSegSz = strtoul(optarg, NULL, 0);
* point. Right now it seems like it'd cause more code duplication than
* it's worth.
*/
- if (MyAuxProcType == CheckerProcess)
+ if (check_only)
{
SetProcessingMode(NormalProcessing);
CheckerModeMain();
pgwin32_signal_initialize();
#endif
- if (argc > 1 && strcmp(argv[1], "--boot") == 0)
- BootstrapModeMain(argc, argv); /* does not return */
+ if (argc > 1 && strcmp(argv[1], "--check") == 0)
+ BootstrapModeMain(argc, argv, true);
+ else if (argc > 1 && strcmp(argv[1], "--boot") == 0)
+ BootstrapModeMain(argc, argv, false);
else if (argc > 1 && strcmp(argv[1], "--describe-config") == 0)
GucInfoMain(); /* does not return */
else if (argc > 1 && strcmp(argv[1], "--single") == 0)
printf(_("\nOptions for bootstrapping mode:\n"));
printf(_(" --boot selects bootstrapping mode (must be first argument)\n"));
+ printf(_(" --check selects check mode (must be first argument)\n"));
printf(_(" DBNAME database name (mandatory argument in bootstrapping mode)\n"));
printf(_(" -r FILENAME send stdout and stderr to given file\n"));
- printf(_(" -x NUM internal use\n"));
printf(_("\nPlease read the documentation for the complete list of run-time\n"
"configuration settings and how to set them on the command line or in\n"
switch (MyAuxProcType)
{
- case CheckerProcess:
- case BootstrapProcess:
- pg_unreachable();
- break;
-
case StartupProcess:
StartupProcessMain();
proc_exit(1);
test_buffs = MIN_BUFS_FOR_CONNS(test_conns);
snprintf(cmd, sizeof(cmd),
- "\"%s\" --boot -x0 %s %s "
+ "\"%s\" --check %s %s "
"-c max_connections=%d "
"-c shared_buffers=%d "
"-c dynamic_shared_memory_type=%s "
}
snprintf(cmd, sizeof(cmd),
- "\"%s\" --boot -x0 %s %s "
+ "\"%s\" --check %s %s "
"-c max_connections=%d "
"-c shared_buffers=%d "
"-c dynamic_shared_memory_type=%s "
unsetenv("PGCLIENTENCODING");
snprintf(cmd, sizeof(cmd),
- "\"%s\" --boot -x1 -X %u %s %s %s %s",
+ "\"%s\" --boot -X %u %s %s %s %s",
backend_exec,
wal_segment_size_mb * (1024 * 1024),
data_checksums ? "-k" : "",
extern int numattr;
-extern void BootstrapModeMain(int argc, char *argv[]) pg_attribute_noreturn();
+extern void BootstrapModeMain(int argc, char *argv[], bool check_only) pg_attribute_noreturn();
extern void closerel(char *name);
extern void boot_openrel(char *name);
typedef enum
{
NotAnAuxProcess = -1,
- CheckerProcess = 0,
- BootstrapProcess,
- StartupProcess,
+ StartupProcess = 0,
BgWriterProcess,
ArchiverProcess,
CheckpointerProcess,
extern AuxProcType MyAuxProcType;
-#define AmBootstrapProcess() (MyAuxProcType == BootstrapProcess)
#define AmStartupProcess() (MyAuxProcType == StartupProcess)
#define AmBackgroundWriterProcess() (MyAuxProcType == BgWriterProcess)
#define AmArchiverProcess() (MyAuxProcType == ArchiverProcess)