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

Commit3709a5a

Browse files
committed
RESET ALL secondary patch:
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 cmdlineMarko Kreen
1 parent0ed7864 commit3709a5a

File tree

3 files changed

+49
-49
lines changed

3 files changed

+49
-49
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
*
3030
* IDENTIFICATION
31-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.221 2001/06/16 22:58:12 tgl Exp $
31+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.222 2001/06/18 23:42:32 momjian Exp $
3232
*
3333
* NOTES
3434
*
@@ -426,14 +426,14 @@ PostmasterMain(int argc, char *argv[])
426426
#ifndefUSE_ASSERT_CHECKING
427427
postmaster_error("Assert checking is not compiled in.");
428428
#else
429-
assert_enabled=atoi(optarg);
429+
SetConfigOption("debug_assertions",optarg,PGC_POSTMASTER, true);
430430
#endif
431431
break;
432432
case'a':
433433
/* Can no longer set authentication method. */
434434
break;
435435
case'B':
436-
NBuffers=atoi(optarg);
436+
SetConfigOption("shared_buffers",optarg,PGC_POSTMASTER, true);
437437
break;
438438
case'b':
439439
/* Can no longer set the backend executable file to use. */
@@ -447,23 +447,23 @@ PostmasterMain(int argc, char *argv[])
447447
* Turn on debugging for the postmaster and the backend
448448
* servers descended from it.
449449
*/
450-
DebugLvl=atoi(optarg);
450+
SetConfigOption("debug_level",optarg,PGC_POSTMASTER, true);
451451
break;
452452
case'F':
453-
enableFsync= false;
453+
SetConfigOption("enable_fsync",optarg,PGC_POSTMASTER, true);
454454
break;
455455
case'h':
456-
VirtualHost=optarg;
456+
SetConfigOption("virtual_host",optarg,PGC_POSTMASTER, true);
457457
break;
458458
case'i':
459-
NetServer=true;
459+
SetConfigOption("tcpip_socket",optarg,PGC_POSTMASTER,true);
460460
break;
461461
case'k':
462-
UnixSocketDir=optarg;
462+
SetConfigOption("unix_socket_directory",optarg,PGC_POSTMASTER, true);
463463
break;
464464
#ifdefUSE_SSL
465465
case'l':
466-
EnableSSL=true;
466+
SetConfigOption("ssl",optarg,PGC_POSTMASTER,true);
467467
break;
468468
#endif
469469
case'm':
@@ -483,11 +483,7 @@ PostmasterMain(int argc, char *argv[])
483483
* The max number of backends to start. Can't set to less
484484
* than 1 or more than compiled-in limit.
485485
*/
486-
MaxBackends=atoi(optarg);
487-
if (MaxBackends<1)
488-
MaxBackends=1;
489-
if (MaxBackends>MAXBACKENDS)
490-
MaxBackends=MAXBACKENDS;
486+
SetConfigOption("max_connections",optarg,PGC_POSTMASTER, true);
491487
break;
492488
case'n':
493489
/* Don't reinit shared mem after abnormal exit */
@@ -504,7 +500,7 @@ PostmasterMain(int argc, char *argv[])
504500
strcpy(original_extraoptions,optarg);
505501
break;
506502
case'p':
507-
PostPortNumber=atoi(optarg);
503+
SetConfigOption("port",optarg,PGC_POSTMASTER, true);
508504
break;
509505
case'S':
510506

@@ -514,7 +510,7 @@ PostmasterMain(int argc, char *argv[])
514510
* it's most badly needed on SysV-derived systems like
515511
* SVR4 and HP-UX.
516512
*/
517-
SilentMode=true;
513+
SetConfigOption("silent_mode",optarg,PGC_POSTMASTER,true);
518514
break;
519515
case's':
520516

‎src/backend/tcop/postgres.c

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.220 2001/06/12 22:54:06 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.221 2001/06/18 23:42:32 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1108,6 +1108,8 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11081108
constchar*DBName=NULL;
11091109
boolsecure= true;
11101110
interrs=0;
1111+
GucContextctx;
1112+
char*tmp;
11111113

11121114
intfirstchar;
11131115
StringInfoparser_input;
@@ -1117,6 +1119,9 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11171119

11181120
char*potential_DataDir=NULL;
11191121

1122+
/* all options are allowed if not under postmaster */
1123+
ctx=IsUnderPostmaster ?PGC_BACKEND :PGC_POSTMASTER;
1124+
11201125
/*
11211126
* Catch standard options before doing much else. This even works on
11221127
* systems without getopt_long.
@@ -1188,7 +1193,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11881193
{
11891194
case'A':
11901195
#ifdefUSE_ASSERT_CHECKING
1191-
assert_enabled=atoi(optarg);
1196+
SetConfigOption("debug_assertions",optarg,ctx, true);
11921197
#else
11931198
fprintf(stderr,"Assert checking is not compiled in\n");
11941199
#endif
@@ -1200,7 +1205,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12001205
* specify the size of buffer pool
12011206
*/
12021207
if (secure)
1203-
NBuffers=atoi(optarg);
1208+
SetConfigOption("shared_buffers",optarg,ctx, true);
12041209
break;
12051210

12061211
case'C':
@@ -1217,17 +1222,18 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12171222
break;
12181223

12191224
case'd':/* debug level */
1220-
DebugLvl=atoi(optarg);
1225+
tmp="true";
1226+
SetConfigOption("debug_level",optarg,ctx, true);
12211227
if (DebugLvl >=1);
1222-
Log_connections=true;
1228+
SetConfigOption("log_connections",tmp,ctx,true);
12231229
if (DebugLvl >=2)
1224-
Debug_print_query=true;
1230+
SetConfigOption("debug_print_query",tmp,ctx,true);
12251231
if (DebugLvl >=3)
1226-
Debug_print_parse=true;
1232+
SetConfigOption("debug_print_parse",tmp,ctx,true);
12271233
if (DebugLvl >=4)
1228-
Debug_print_plan=true;
1234+
SetConfigOption("debug_print_plan",tmp,ctx,true);
12291235
if (DebugLvl >=5)
1230-
Debug_print_rewritten=true;
1236+
SetConfigOption("debug_print_rewritten",tmp,ctx,true);
12311237
break;
12321238

12331239
case'E':
@@ -1252,37 +1258,40 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
12521258
* turn off fsync
12531259
*/
12541260
if (secure)
1255-
enableFsync= false;
1261+
SetConfigOption("fsync","true",ctx, true);
12561262
break;
12571263

12581264
case'f':
12591265

12601266
/*
12611267
* f - forbid generation of certain plans
12621268
*/
1269+
tmp=NULL;
12631270
switch (optarg[0])
12641271
{
12651272
case's':/* seqscan */
1266-
enable_seqscan=false;
1273+
tmp="enable_seqscan";
12671274
break;
12681275
case'i':/* indexscan */
1269-
enable_indexscan=false;
1276+
tmp="enable_indexscan";
12701277
break;
12711278
case't':/* tidscan */
1272-
enable_tidscan=false;
1279+
tmp="enable_tidscan";
12731280
break;
12741281
case'n':/* nestloop */
1275-
enable_nestloop=false;
1282+
tmp="enable_nestloop";
12761283
break;
12771284
case'm':/* mergejoin */
1278-
enable_mergejoin=false;
1285+
tmp="enable_mergejoin";
12791286
break;
12801287
case'h':/* hashjoin */
1281-
enable_hashjoin=false;
1288+
tmp="enable_hashjoin";
12821289
break;
12831290
default:
12841291
errs++;
12851292
}
1293+
if (tmp)
1294+
SetConfigOption(tmp,"false",ctx, true);
12861295
break;
12871296

12881297
case'i':
@@ -1352,21 +1361,15 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
13521361
/*
13531362
* S - amount of sort memory to use in 1k bytes
13541363
*/
1355-
{
1356-
intS;
1357-
1358-
S=atoi(optarg);
1359-
if (S >=4*BLCKSZ /1024)
1360-
SortMem=S;
1361-
}
1364+
SetConfigOption("sort_mem",optarg,ctx, true);
13621365
break;
13631366

13641367
case's':
13651368

13661369
/*
13671370
* s - report usage statistics (timings) after each query
13681371
*/
1369-
Show_query_stats=1;
1372+
SetConfigOption("show_query_stats",optarg,ctx, true);
13701373
break;
13711374

13721375
case't':
@@ -1380,23 +1383,26 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
13801383
*caution: -s can not be used together with -t.
13811384
* ----------------
13821385
*/
1386+
tmp=NULL;
13831387
switch (optarg[0])
13841388
{
13851389
case'p':
13861390
if (optarg[1]=='a')
1387-
Show_parser_stats=1;
1391+
tmp="show_parser_stats";
13881392
elseif (optarg[1]=='l')
1389-
Show_planner_stats=1;
1393+
tmp="show_planner_stats";
13901394
else
13911395
errs++;
13921396
break;
13931397
case'e':
1394-
Show_executor_stats=1;
1398+
tmp="show_parser_stats";
13951399
break;
13961400
default:
13971401
errs++;
13981402
break;
13991403
}
1404+
if (tmp)
1405+
SetConfigOption(tmp,"true",ctx, true);
14001406
break;
14011407

14021408
case'v':
@@ -1460,9 +1466,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
14601466
elog(ERROR,"-c %s requires argument",optarg);
14611467
}
14621468

1463-
/* all options are allowed if not under postmaster */
1464-
SetConfigOption(name,value,
1465-
(IsUnderPostmaster) ?PGC_BACKEND :PGC_POSTMASTER, true);
1469+
SetConfigOption(name,value,ctx, true);
14661470
free(name);
14671471
if (value)
14681472
free(value);
@@ -1709,7 +1713,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
17091713
if (!IsUnderPostmaster)
17101714
{
17111715
puts("\nPOSTGRES backend interactive interface ");
1712-
puts("$Revision: 1.220 $ $Date: 2001/06/12 22:54:06 $\n");
1716+
puts("$Revision: 1.221 $ $Date: 2001/06/18 23:42:32 $\n");
17131717
}
17141718

17151719
/*

‎src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Support for grand unified configuration scheme, including SET
55
* command, configuration file, and command line options.
66
*
7-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.39 2001/06/1816:14:43 momjian Exp $
7+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.40 2001/06/1823:42:32 momjian Exp $
88
*
99
* Copyright 2000 by PostgreSQL Global Development Group
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
@@ -276,7 +276,7 @@ static struct config_int
276276
DEF_PGPORT,1,65535,NULL,NULL},
277277

278278
{"sort_mem",PGC_USERSET,&SortMem,
279-
512,1,INT_MAX,NULL,NULL},
279+
512,4*BLCKSZ/1024,INT_MAX,NULL,NULL},
280280

281281
{"debug_level",PGC_USERSET,&DebugLvl,
282282
0,0,16,NULL,NULL},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp