summaryrefslogtreecommitdiff
path: root/src/backend/bootstrap
diff options
context:
space:
mode:
authorAndres Freund2021-08-05 19:17:31 +0000
committerAndres Freund2021-08-05 19:18:15 +0000
commitf8dd4ecb0b7fc3420e199021375e622815cd326f (patch)
treeca13c83c356607ceb7f21c7d006bf43ca9cf947e /src/backend/bootstrap
parent0a692109dcc73178962069addf7478ac89950e4d (diff)
process startup: Remove bootstrap / checker modes from AuxProcType.
Neither is actually initialized as an auxiliary process, so it does not really make sense to reserve a PGPROC etc for them. This keeps checker mode implemented by exiting partway through bootstrap mode. That might be worth changing at some point, perhaps if we ever extend checker mode to be a more general tool. Author: Andres Freund <[email protected]> Reviewed-By: Kyotaro Horiguchi <[email protected]> Reviewed-By: Robert Haas <[email protected]> Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/bootstrap')
-rw-r--r--src/backend/bootstrap/bootstrap.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 80dc3b585f6..2e2f76a4716 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -193,9 +193,14 @@ CheckerModeMain(void)
* 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];
@@ -209,16 +214,14 @@ BootstrapModeMain(int argc, char *argv[])
/* 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)
{
@@ -250,16 +253,6 @@ BootstrapModeMain(int argc, char *argv[])
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);
@@ -338,7 +331,7 @@ BootstrapModeMain(int argc, char *argv[])
* 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();