From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Marko Kreen <marko(at)l-t(dot)ee> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: use GUC for cmdline |
Date: | 2001-06-18 23:41:10 |
Message-ID: | 200106182341.f5INfBx05080@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Peter thinks no collision. Patch applied. Thanks.
>
> Here is Tomified version of my 2 pending patches.
> Dropped the set_.._real change as it is not needed.
> Desc would be:
>
> * use GUC for settings from cmdline
>
> --
> marko
>
>
> Index: src/backend/postmaster/postmaster.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
> retrieving revision 1.220
> diff -u -c -r1.220 postmaster.c
> *** src/backend/postmaster/postmaster.c 2001/06/14 19:59:24 1.220
> --- src/backend/postmaster/postmaster.c 2001/06/15 16:22:42
> ***************
> *** 426,439 ****
> #ifndef USE_ASSERT_CHECKING
> postmaster_error("Assert checking is not compiled in.");
> #else
> ! assert_enabled = atoi(optarg);
> #endif
> break;
> case 'a':
> /* Can no longer set authentication method. */
> break;
> case 'B':
> ! NBuffers = atoi(optarg);
> break;
> case 'b':
> /* Can no longer set the backend executable file to use. */
> --- 426,439 ----
> #ifndef USE_ASSERT_CHECKING
> postmaster_error("Assert checking is not compiled in.");
> #else
> ! SetConfigOption("debug_assertions", optarg, PGC_POSTMASTER, true);
> #endif
> break;
> case 'a':
> /* Can no longer set authentication method. */
> break;
> case 'B':
> ! SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, true);
> break;
> case 'b':
> /* Can no longer set the backend executable file to use. */
> ***************
> *** 447,469 ****
> * Turn on debugging for the postmaster and the backend
> * servers descended from it.
> */
> ! DebugLvl = atoi(optarg);
> break;
> case 'F':
> ! enableFsync = false;
> break;
> case 'h':
> ! VirtualHost = optarg;
> break;
> case 'i':
> ! NetServer = true;
> break;
> case 'k':
> ! UnixSocketDir = optarg;
> break;
> #ifdef USE_SSL
> case 'l':
> ! EnableSSL = true;
> break;
> #endif
> case 'm':
> --- 447,469 ----
> * Turn on debugging for the postmaster and the backend
> * servers descended from it.
> */
> ! SetConfigOption("debug_level", optarg, PGC_POSTMASTER, true);
> break;
> case 'F':
> ! SetConfigOption("enable_fsync", optarg, PGC_POSTMASTER, true);
> break;
> case 'h':
> ! SetConfigOption("virtual_host", optarg, PGC_POSTMASTER, true);
> break;
> case 'i':
> ! SetConfigOption("tcpip_socket", optarg, PGC_POSTMASTER, true);
> break;
> case 'k':
> ! SetConfigOption("unix_socket_directory", optarg, PGC_POSTMASTER, true);
> break;
> #ifdef USE_SSL
> case 'l':
> ! SetConfigOption("ssl", optarg, PGC_POSTMASTER, true);
> break;
> #endif
> case 'm':
> ***************
> *** 483,493 ****
> * The max number of backends to start. Can't set to less
> * than 1 or more than compiled-in limit.
> */
> ! MaxBackends = atoi(optarg);
> ! if (MaxBackends < 1)
> ! MaxBackends = 1;
> ! if (MaxBackends > MAXBACKENDS)
> ! MaxBackends = MAXBACKENDS;
> break;
> case 'n':
> /* Don't reinit shared mem after abnormal exit */
> --- 483,489 ----
> * The max number of backends to start. Can't set to less
> * than 1 or more than compiled-in limit.
> */
> ! SetConfigOption("max_connections", optarg, PGC_POSTMASTER, true);
> break;
> case 'n':
> /* Don't reinit shared mem after abnormal exit */
> ***************
> *** 504,510 ****
> strcpy(original_extraoptions, optarg);
> break;
> case 'p':
> ! PostPortNumber = atoi(optarg);
> break;
> case 'S':
>
> --- 500,506 ----
> strcpy(original_extraoptions, optarg);
> break;
> case 'p':
> ! SetConfigOption("port", optarg, PGC_POSTMASTER, true);
> break;
> case 'S':
>
> ***************
> *** 514,520 ****
> * it's most badly needed on SysV-derived systems like
> * SVR4 and HP-UX.
> */
> ! SilentMode = true;
> break;
> case 's':
>
> --- 510,516 ----
> * it's most badly needed on SysV-derived systems like
> * SVR4 and HP-UX.
> */
> ! SetConfigOption("silent_mode", optarg, PGC_POSTMASTER, true);
> break;
> case 's':
>
> Index: src/backend/tcop/postgres.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/tcop/postgres.c,v
> retrieving revision 1.220
> diff -u -c -r1.220 postgres.c
> *** src/backend/tcop/postgres.c 2001/06/12 22:54:06 1.220
> --- src/backend/tcop/postgres.c 2001/06/15 16:22:47
> ***************
> *** 1108,1113 ****
> --- 1108,1115 ----
> const char *DBName = NULL;
> bool secure = true;
> int errs = 0;
> + GucContext ctx;
> + char *tmp;
>
> int firstchar;
> StringInfo parser_input;
> ***************
> *** 1117,1122 ****
> --- 1119,1127 ----
>
> char *potential_DataDir = NULL;
>
> + /* all options are allowed if not under postmaster */
> + ctx = IsUnderPostmaster ? PGC_BACKEND : PGC_POSTMASTER;
> +
> /*
> * Catch standard options before doing much else. This even works on
> * systems without getopt_long.
> ***************
> *** 1188,1194 ****
> {
> case 'A':
> #ifdef USE_ASSERT_CHECKING
> ! assert_enabled = atoi(optarg);
> #else
> fprintf(stderr, "Assert checking is not compiled in\n");
> #endif
> --- 1193,1199 ----
> {
> case 'A':
> #ifdef USE_ASSERT_CHECKING
> ! SetConfigOption("debug_assertions", optarg, ctx, true);
> #else
> fprintf(stderr, "Assert checking is not compiled in\n");
> #endif
> ***************
> *** 1200,1206 ****
> * specify the size of buffer pool
> */
> if (secure)
> ! NBuffers = atoi(optarg);
> break;
>
> case 'C':
> --- 1205,1211 ----
> * specify the size of buffer pool
> */
> if (secure)
> ! SetConfigOption("shared_buffers", optarg, ctx, true);
> break;
>
> case 'C':
> ***************
> *** 1217,1233 ****
> break;
>
> case 'd': /* debug level */
> ! DebugLvl = atoi(optarg);
> if (DebugLvl >= 1);
> ! Log_connections = true;
> if (DebugLvl >= 2)
> ! Debug_print_query = true;
> if (DebugLvl >= 3)
> ! Debug_print_parse = true;
> if (DebugLvl >= 4)
> ! Debug_print_plan = true;
> if (DebugLvl >= 5)
> ! Debug_print_rewritten = true;
> break;
>
> case 'E':
> --- 1222,1239 ----
> break;
>
> case 'd': /* debug level */
> ! tmp = "true";
> ! SetConfigOption("debug_level", optarg, ctx, true);
> if (DebugLvl >= 1);
> ! SetConfigOption("log_connections", tmp, ctx, true);
> if (DebugLvl >= 2)
> ! SetConfigOption("debug_print_query", tmp, ctx, true);
> if (DebugLvl >= 3)
> ! SetConfigOption("debug_print_parse", tmp, ctx, true);
> if (DebugLvl >= 4)
> ! SetConfigOption("debug_print_plan", tmp, ctx, true);
> if (DebugLvl >= 5)
> ! SetConfigOption("debug_print_rewritten", tmp, ctx, true);
> break;
>
> case 'E':
> ***************
> *** 1252,1258 ****
> * turn off fsync
> */
> if (secure)
> ! enableFsync = false;
> break;
>
> case 'f':
> --- 1258,1264 ----
> * turn off fsync
> */
> if (secure)
> ! SetConfigOption("fsync", "true", ctx, true);
> break;
>
> case 'f':
> ***************
> *** 1260,1288 ****
> /*
> * f - forbid generation of certain plans
> */
> switch (optarg[0])
> {
> case 's': /* seqscan */
> ! enable_seqscan = false;
> break;
> case 'i': /* indexscan */
> ! enable_indexscan = false;
> break;
> case 't': /* tidscan */
> ! enable_tidscan = false;
> break;
> case 'n': /* nestloop */
> ! enable_nestloop = false;
> break;
> case 'm': /* mergejoin */
> ! enable_mergejoin = false;
> break;
> case 'h': /* hashjoin */
> ! enable_hashjoin = false;
> break;
> default:
> errs++;
> }
> break;
>
> case 'i':
> --- 1266,1297 ----
> /*
> * f - forbid generation of certain plans
> */
> + tmp = NULL;
> switch (optarg[0])
> {
> case 's': /* seqscan */
> ! tmp = "enable_seqscan";
> break;
> case 'i': /* indexscan */
> ! tmp = "enable_indexscan";
> break;
> case 't': /* tidscan */
> ! tmp = "enable_tidscan";
> break;
> case 'n': /* nestloop */
> ! tmp = "enable_nestloop";
> break;
> case 'm': /* mergejoin */
> ! tmp = "enable_mergejoin";
> break;
> case 'h': /* hashjoin */
> ! tmp = "enable_hashjoin";
> break;
> default:
> errs++;
> }
> + if (tmp)
> + SetConfigOption(tmp, "false", ctx, true);
> break;
>
> case 'i':
> ***************
> *** 1352,1364 ****
> /*
> * S - amount of sort memory to use in 1k bytes
> */
> ! {
> ! int S;
> !
> ! S = atoi(optarg);
> ! if (S >= 4 * BLCKSZ / 1024)
> ! SortMem = S;
> ! }
> break;
>
> case 's':
> --- 1361,1367 ----
> /*
> * S - amount of sort memory to use in 1k bytes
> */
> ! SetConfigOption("sort_mem", optarg, ctx, true);
> break;
>
> case 's':
> ***************
> *** 1366,1372 ****
> /*
> * s - report usage statistics (timings) after each query
> */
> ! Show_query_stats = 1;
> break;
>
> case 't':
> --- 1369,1375 ----
> /*
> * s - report usage statistics (timings) after each query
> */
> ! SetConfigOption("show_query_stats", optarg, ctx, true);
> break;
>
> case 't':
> ***************
> *** 1380,1402 ****
> * caution: -s can not be used together with -t.
> * ----------------
> */
> switch (optarg[0])
> {
> case 'p':
> if (optarg[1] == 'a')
> ! Show_parser_stats = 1;
> else if (optarg[1] == 'l')
> ! Show_planner_stats = 1;
> else
> errs++;
> break;
> case 'e':
> ! Show_executor_stats = 1;
> break;
> default:
> errs++;
> break;
> }
> break;
>
> case 'v':
> --- 1383,1408 ----
> * caution: -s can not be used together with -t.
> * ----------------
> */
> + tmp = NULL;
> switch (optarg[0])
> {
> case 'p':
> if (optarg[1] == 'a')
> ! tmp = "show_parser_stats";
> else if (optarg[1] == 'l')
> ! tmp = "show_planner_stats";
> else
> errs++;
> break;
> case 'e':
> ! tmp = "show_parser_stats";
> break;
> default:
> errs++;
> break;
> }
> + if (tmp)
> + SetConfigOption(tmp, "true", ctx, true);
> break;
>
> case 'v':
> ***************
> *** 1460,1468 ****
> elog(ERROR, "-c %s requires argument", optarg);
> }
>
> ! /* all options are allowed if not under postmaster */
> ! SetConfigOption(name, value,
> ! (IsUnderPostmaster) ? PGC_BACKEND : PGC_POSTMASTER, true);
> free(name);
> if (value)
> free(value);
> --- 1466,1472 ----
> elog(ERROR, "-c %s requires argument", optarg);
> }
>
> ! SetConfigOption(name, value, ctx, true);
> free(name);
> if (value)
> free(value);
> Index: src/backend/utils/misc/guc.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
> retrieving revision 1.38
> diff -u -c -r1.38 guc.c
> *** src/backend/utils/misc/guc.c 2001/06/12 22:54:06 1.38
> --- src/backend/utils/misc/guc.c 2001/06/15 16:22:49
> ***************
> *** 270,276 ****
> DEF_PGPORT, 1, 65535, NULL, NULL},
>
> {"sort_mem", PGC_USERSET, &SortMem,
> ! 512, 1, INT_MAX, NULL, NULL},
>
> {"debug_level", PGC_USERSET, &DebugLvl,
> 0, 0, 16, NULL, NULL},
> --- 270,276 ----
> DEF_PGPORT, 1, 65535, NULL, NULL},
>
> {"sort_mem", PGC_USERSET, &SortMem,
> ! 512, 4*BLCKSZ/1024, INT_MAX, NULL, NULL},
>
> {"debug_level", PGC_USERSET, &DebugLvl,
> 0, 0, 16, NULL, NULL},
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Itzinger, Oskar | 2001-06-19 08:32:36 | [Help] Temporary Table: Implicitely created index not shown in \d i |
Previous Message | Bruce Momjian | 2001-06-18 23:40:03 | Re: use GUC for cmdline |