Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit51f1955

Browse files
committed
Save source of GUC settings, allowing different sources to be processed in
any order without affecting results.
1 parentab786f6 commit51f1955

File tree

7 files changed

+201
-191
lines changed

7 files changed

+201
-191
lines changed

‎src/backend/bootstrap/bootstrap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.120 2002/01/10 01:11:45 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.121 2002/02/23 01:31:34 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -262,7 +262,7 @@ BootstrapMain(int argc, char *argv[])
262262
* parsing */
263263
break;
264264
case'F':
265-
SetConfigOption("fsync","false",PGC_POSTMASTER,true);
265+
SetConfigOption("fsync","false",PGC_POSTMASTER,PGC_S_ARGV);
266266
break;
267267
case'o':
268268
StrNCpy(OutputFileName,optarg,MAXPGPATH);
@@ -274,7 +274,7 @@ BootstrapMain(int argc, char *argv[])
274274
/* indicates fork from postmaster */
275275
break;
276276
case'B':
277-
SetConfigOption("shared_buffers",optarg,PGC_POSTMASTER,true);
277+
SetConfigOption("shared_buffers",optarg,PGC_POSTMASTER,PGC_S_ARGV);
278278
break;
279279
default:
280280
usage();

‎src/backend/commands/variable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.57 2001/12/09 04:37:50 thomas Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.58 2002/02/23 01:31:35 petere Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -780,7 +780,7 @@ SetPGVariable(const char *name, List *args)
780780
if (strcasecmp(name,"session_authorization")==0)
781781
SetSessionAuthorization(value);
782782
else
783-
SetConfigOption(name,value,superuser() ?PGC_SUSET :PGC_USERSET,false);
783+
SetConfigOption(name,value,superuser() ?PGC_SUSET :PGC_USERSET,PGC_S_SESSION);
784784
}
785785
return;
786786
}
@@ -846,5 +846,5 @@ ResetPGVariable(const char *name)
846846
else
847847
SetConfigOption(name,NULL,
848848
superuser() ?PGC_SUSET :PGC_USERSET,
849-
false);
849+
PGC_S_SESSION);
850850
}

‎src/backend/postmaster/postmaster.c

Lines changed: 34 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.266 2002/02/19 20:45:04 tgl Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.267 2002/02/23 01:31:35 petere Exp $
4141
*
4242
* NOTES
4343
*
@@ -396,75 +396,29 @@ PostmasterMain(int argc, char *argv[])
396396
ALLOCSET_DEFAULT_MAXSIZE);
397397
MemoryContextSwitchTo(PostmasterContext);
398398

399+
IgnoreSystemIndexes(false);
400+
399401
/*
400402
* Options setup
401403
*/
402404
ResetAllOptions(true);
403405

404406
/* PGPORT environment variable, if set, overrides GUC setting */
405407
if (getenv("PGPORT"))
406-
SetConfigOption("port",getenv("PGPORT"),PGC_POSTMASTER, true);
408+
SetConfigOption("port",getenv("PGPORT"),
409+
PGC_POSTMASTER,PGC_S_ARGV/*sortof*/);
407410

408411
potential_DataDir=getenv("PGDATA");/* default value */
409412

410-
/*
411-
* First we must scan for a -D argument to get the data dir. Then read
412-
* the config file. Finally, scan all the other arguments. (Command
413-
* line switches override config file.)
414-
*
415-
* Note: The two lists of options must be exactly the same, even though
416-
* perhaps the first one would only have to be "D:" with opterr turned
417-
* off. But some versions of getopt (notably GNU) are going to
418-
* arbitrarily permute some "non-options" (according to the local
419-
* world view) which will result in some switches being associated
420-
* with the wrong argument. Death and destruction will occur.
421-
*/
422413
opterr=1;
423-
while ((opt=getopt(argc,argv,"A:a:B:b:c:D:d:Fh:ik:lm:MN:no:p:Ss-:"))!=-1)
424-
{
425-
switch (opt)
426-
{
427-
case'D':
428-
potential_DataDir=optarg;
429-
break;
430-
431-
case'?':
432-
fprintf(stderr,gettext("Try '%s --help' for more information.\n"),progname);
433-
ExitPostmaster(1);
434-
}
435-
}
436-
437-
/*
438-
* Postmaster accepts no non-option switch arguments.
439-
*/
440-
if (optind<argc)
441-
{
442-
postmaster_error("invalid argument -- %s",argv[optind]);
443-
fprintf(stderr,gettext("Try '%s --help' for more information.\n"),
444-
progname);
445-
ExitPostmaster(1);
446-
}
447-
448-
checkDataDir(potential_DataDir);/* issues error messages */
449-
SetDataDir(potential_DataDir);
450-
451-
ProcessConfigFile(PGC_POSTMASTER);
452-
453-
IgnoreSystemIndexes(false);
454-
455-
/* reset getopt(3) to rescan arguments */
456-
optind=1;
457-
#ifdefHAVE_INT_OPTRESET
458-
optreset=1;/* some systems need this too */
459-
#endif
460414

461415
while ((opt=getopt(argc,argv,"A:a:B:b:c:D:d:Fh:ik:lm:MN:no:p:Ss-:"))!=-1)
462416
{
463417
switch (opt)
464418
{
465419
case'A':
466420
#ifdefUSE_ASSERT_CHECKING
467-
SetConfigOption("debug_assertions",optarg,PGC_POSTMASTER,true);
421+
SetConfigOption("debug_assertions",optarg,PGC_POSTMASTER,PGC_S_ARGV);
468422
#else
469423
postmaster_error("Assert checking is not compiled in.");
470424
#endif
@@ -473,37 +427,37 @@ PostmasterMain(int argc, char *argv[])
473427
/* Can no longer set authentication method. */
474428
break;
475429
case'B':
476-
SetConfigOption("shared_buffers",optarg,PGC_POSTMASTER,true);
430+
SetConfigOption("shared_buffers",optarg,PGC_POSTMASTER,PGC_S_ARGV);
477431
break;
478432
case'b':
479433
/* Can no longer set the backend executable file to use. */
480434
break;
481435
case'D':
482-
/* already done above */
436+
potential_DataDir=optarg;
483437
break;
484438
case'd':
485439

486440
/*
487441
* Turn on debugging for the postmaster and the backend
488442
* servers descended from it.
489443
*/
490-
SetConfigOption("debug_level",optarg,PGC_POSTMASTER,true);
444+
SetConfigOption("debug_level",optarg,PGC_POSTMASTER,PGC_S_ARGV);
491445
break;
492446
case'F':
493-
SetConfigOption("fsync","false",PGC_POSTMASTER,true);
447+
SetConfigOption("fsync","false",PGC_POSTMASTER,PGC_S_ARGV);
494448
break;
495449
case'h':
496-
SetConfigOption("virtual_host",optarg,PGC_POSTMASTER,true);
450+
SetConfigOption("virtual_host",optarg,PGC_POSTMASTER,PGC_S_ARGV);
497451
break;
498452
case'i':
499-
SetConfigOption("tcpip_socket","true",PGC_POSTMASTER,true);
453+
SetConfigOption("tcpip_socket","true",PGC_POSTMASTER,PGC_S_ARGV);
500454
break;
501455
case'k':
502-
SetConfigOption("unix_socket_directory",optarg,PGC_POSTMASTER,true);
456+
SetConfigOption("unix_socket_directory",optarg,PGC_POSTMASTER,PGC_S_ARGV);
503457
break;
504458
#ifdefUSE_SSL
505459
case'l':
506-
SetConfigOption("ssl","true",PGC_POSTMASTER,true);
460+
SetConfigOption("ssl","true",PGC_POSTMASTER,PGC_S_ARGV);
507461
break;
508462
#endif
509463
case'm':
@@ -519,7 +473,7 @@ PostmasterMain(int argc, char *argv[])
519473
break;
520474
case'N':
521475
/* The max number of backends to start. */
522-
SetConfigOption("max_connections",optarg,PGC_POSTMASTER,true);
476+
SetConfigOption("max_connections",optarg,PGC_POSTMASTER,PGC_S_ARGV);
523477
break;
524478
case'n':
525479
/* Don't reinit shared mem after abnormal exit */
@@ -536,7 +490,7 @@ PostmasterMain(int argc, char *argv[])
536490
strcpy(original_extraoptions,optarg);
537491
break;
538492
case'p':
539-
SetConfigOption("port",optarg,PGC_POSTMASTER,true);
493+
SetConfigOption("port",optarg,PGC_POSTMASTER,PGC_S_ARGV);
540494
break;
541495
case'S':
542496

@@ -546,7 +500,7 @@ PostmasterMain(int argc, char *argv[])
546500
* it's most badly needed on SysV-derived systems like
547501
* SVR4 and HP-UX.
548502
*/
549-
SetConfigOption("silent_mode","true",PGC_POSTMASTER,true);
503+
SetConfigOption("silent_mode","true",PGC_POSTMASTER,PGC_S_ARGV);
550504
break;
551505
case's':
552506

@@ -573,20 +527,30 @@ PostmasterMain(int argc, char *argv[])
573527
elog(ERROR,"-c %s requires argument",optarg);
574528
}
575529

576-
SetConfigOption(name,value,PGC_POSTMASTER,true);
530+
SetConfigOption(name,value,PGC_POSTMASTER,PGC_S_ARGV);
577531
free(name);
578532
if (value)
579533
free(value);
580534
break;
581535
}
582536

583537
default:
584-
/* shouldn't get here */
585538
fprintf(stderr,gettext("Try '%s --help' for more information.\n"),progname);
586539
ExitPostmaster(1);
587540
}
588541
}
589542

543+
/*
544+
* Postmaster accepts no non-option switch arguments.
545+
*/
546+
if (optind<argc)
547+
{
548+
postmaster_error("invalid argument -- %s",argv[optind]);
549+
fprintf(stderr,gettext("Try '%s --help' for more information.\n"),
550+
progname);
551+
ExitPostmaster(1);
552+
}
553+
590554
/*
591555
* Check for invalid combinations of switches
592556
*/
@@ -601,6 +565,11 @@ PostmasterMain(int argc, char *argv[])
601565
ExitPostmaster(1);
602566
}
603567

568+
checkDataDir(potential_DataDir);/* issues error messages */
569+
SetDataDir(potential_DataDir);
570+
571+
ProcessConfigFile(PGC_POSTMASTER);
572+
604573
/*
605574
* Now that we are done processing the postmaster arguments, reset
606575
* getopt(3) library so that it will work correctly in subprocesses.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp