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

Commitd9d873b

Browse files
committed
Clean up some inconsistencies with GUC declarations
This is similar to7d25958, and this commit takes care of all theremaining inconsistencies between the initial value used in the Cvariable associated to a GUC and its default value stored in the GUCtables (as of pg_settings.boot_val).Some of the initial values of the GUCs updated rely on a compile-timedefault. These are refactored so as the GUC table and its C declarationuse the same values. This makes everything consistent with otherplaces, backend_flush_after, bgwriter_flush_after, port,checkpoint_flush_after doing so already, for example.Extracted from a larger patch by Peter Smith. The spots updated in themodules are from me.Author: Peter Smith, Michael PaquierReviewed-by: Nathan Bossart, Tom Lane, Justin PryzbyDiscussion:https://postgr.es/m/CAHut+PtHE0XSfjjRQ6D4v7+dqzCw=d+1a64ujra4EX8aoc_Z+w@mail.gmail.com
1 parenta9f8ca6 commitd9d873b

File tree

19 files changed

+70
-58
lines changed

19 files changed

+70
-58
lines changed

‎contrib/auth_delay/auth_delay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
PG_MODULE_MAGIC;
2222

2323
/* GUC Variables */
24-
staticintauth_delay_milliseconds;
24+
staticintauth_delay_milliseconds=0;
2525

2626
/* Original Hook */
2727
staticClientAuthentication_hook_typeoriginal_client_auth_hook=NULL;

‎contrib/pg_prewarm/autoprewarm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static AutoPrewarmSharedState *apw_state = NULL;
103103

104104
/* GUC variables. */
105105
staticboolautoprewarm= true;/* start worker? */
106-
staticintautoprewarm_interval;/* dump interval */
106+
staticintautoprewarm_interval=300;/* dump interval */
107107

108108
/*
109109
* Module load callback.

‎contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,12 @@ static const struct config_enum_entry track_options[] =
283283
{NULL,0, false}
284284
};
285285

286-
staticintpgss_max;/* max # statements to track */
287-
staticintpgss_track;/* tracking level */
288-
staticboolpgss_track_utility;/* whether to track utility commands */
289-
staticboolpgss_track_planning;/* whether to track planning duration */
290-
staticboolpgss_save;/* whether to save stats across shutdown */
286+
staticintpgss_max=5000;/* max # statements to track */
287+
staticintpgss_track=PGSS_TRACK_TOP;/* tracking level */
288+
staticboolpgss_track_utility= true;/* whether to track utility commands */
289+
staticboolpgss_track_planning= false;/* whether to track planning
290+
* duration */
291+
staticboolpgss_save= true;/* whether to save stats across shutdown */
291292

292293

293294
#definepgss_enabled(level) \

‎contrib/pg_trgm/trgm_op.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ _PG_init(void)
6868
"Sets the threshold used by the % operator.",
6969
"Valid range is 0.0 .. 1.0.",
7070
&similarity_threshold,
71-
0.3,
71+
0.3f,
7272
0.0,
7373
1.0,
7474
PGC_USERSET,
@@ -80,7 +80,7 @@ _PG_init(void)
8080
"Sets the threshold used by the <% operator.",
8181
"Valid range is 0.0 .. 1.0.",
8282
&word_similarity_threshold,
83-
0.6,
83+
0.6f,
8484
0.0,
8585
1.0,
8686
PGC_USERSET,
@@ -92,7 +92,7 @@ _PG_init(void)
9292
"Sets the threshold used by the <<% operator.",
9393
"Valid range is 0.0 .. 1.0.",
9494
&strict_word_similarity_threshold,
95-
0.5,
95+
0.5f,
9696
0.0,
9797
1.0,
9898
PGC_USERSET,

‎contrib/sepgsql/hooks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static sepgsql_context_info_t sepgsql_context_info;
5757
/*
5858
* GUC: sepgsql.permissive = (on|off)
5959
*/
60-
staticboolsepgsql_permissive;
60+
staticboolsepgsql_permissive= false;
6161

6262
bool
6363
sepgsql_get_permissive(void)
@@ -68,7 +68,7 @@ sepgsql_get_permissive(void)
6868
/*
6969
* GUC: sepgsql.debug_audit = (on|off)
7070
*/
71-
staticboolsepgsql_debug_audit;
71+
staticboolsepgsql_debug_audit= false;
7272

7373
bool
7474
sepgsql_get_debug_audit(void)

‎src/backend/access/transam/xact.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
*User-tweakable parameters
7676
*/
7777
intDefaultXactIsoLevel=XACT_READ_COMMITTED;
78-
intXactIsoLevel;
78+
intXactIsoLevel=XACT_READ_COMMITTED;
7979

8080
boolDefaultXactReadOnly= false;
8181
boolXactReadOnly;

‎src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ boolwal_init_zero = true;
131131
boolwal_recycle= true;
132132
boollog_checkpoints= true;
133133
intsync_method=DEFAULT_SYNC_METHOD;
134-
intwal_level=WAL_LEVEL_MINIMAL;
134+
intwal_level=WAL_LEVEL_REPLICA;
135135
intCommitDelay=0;/* precommit delay in microseconds */
136136
intCommitSiblings=5;/* # concurrent xacts needed to sleep */
137137
intwal_retrieve_retry_interval=5000;

‎src/backend/libpq/be-secure.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ char *SSLECDHCurve;
5858
/* GUC variable: if false, prefer client ciphers */
5959
boolSSLPreferServerCiphers;
6060

61-
intssl_min_protocol_version;
62-
intssl_max_protocol_version;
61+
intssl_min_protocol_version=PG_TLS1_2_VERSION;
62+
intssl_max_protocol_version=PG_TLS_ANY;
6363

6464
/* ------------------------------------------------------------ */
6565
/* Procedures common to all secure sessions*/

‎src/backend/postmaster/postmaster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ BackgroundWorker *MyBgworkerEntry = NULL;
196196

197197

198198
/* The socket number we are listening for connections on */
199-
intPostPortNumber;
199+
intPostPortNumber=DEF_PGPORT;
200200

201201
/* The directory names for Unix socket(s) */
202202
char*Unix_socket_directories;

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,22 @@ booltrack_io_timing = false;
142142
* for buffers not belonging to tablespaces that have their
143143
* effective_io_concurrency parameter set.
144144
*/
145-
inteffective_io_concurrency=0;
145+
inteffective_io_concurrency=DEFAULT_EFFECTIVE_IO_CONCURRENCY;
146146

147147
/*
148148
* Like effective_io_concurrency, but used by maintenance code paths that might
149149
* benefit from a higher setting because they work on behalf of many sessions.
150150
* Overridden by the tablespace setting of the same name.
151151
*/
152-
intmaintenance_io_concurrency=0;
152+
intmaintenance_io_concurrency=DEFAULT_MAINTENANCE_IO_CONCURRENCY;
153153

154154
/*
155155
* GUC variables about triggering kernel writeback for buffers written; OS
156156
* dependent defaults are set via the GUC mechanism.
157157
*/
158-
intcheckpoint_flush_after=0;
159-
intbgwriter_flush_after=0;
160-
intbackend_flush_after=0;
158+
intcheckpoint_flush_after=DEFAULT_CHECKPOINT_FLUSH_AFTER;
159+
intbgwriter_flush_after=DEFAULT_BGWRITER_FLUSH_AFTER;
160+
intbackend_flush_after=DEFAULT_BACKEND_FLUSH_AFTER;
161161

162162
/* local state for StartBufferIO and related functions */
163163
staticBufferDesc*InProgressBuf=NULL;

‎src/backend/storage/ipc/dsm_impl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const struct config_enum_entry dynamic_shared_memory_options[] = {
109109
};
110110

111111
/* Implementation selector. */
112-
intdynamic_shared_memory_type;
112+
intdynamic_shared_memory_type=DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE;
113113

114114
/* Amount of space reserved for DSM segments in the main area. */
115115
intmin_dynamic_shared_memory;

‎src/backend/utils/adt/xml.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494

9595

9696
/* GUC variables */
97-
intxmlbinary;
98-
intxmloption;
97+
intxmlbinary=XMLBINARY_BASE64;
98+
intxmloption=XMLOPTION_CONTENT;
9999

100100
#ifdefUSE_LIBXML
101101

‎src/backend/utils/cache/plancache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static void PlanCacheObjectCallback(Datum arg, int cacheid, uint32 hashvalue);
116116
staticvoidPlanCacheSysCallback(Datumarg,intcacheid,uint32hashvalue);
117117

118118
/* GUC parameter */
119-
intplan_cache_mode;
119+
intplan_cache_mode=PLAN_CACHE_MODE_AUTO;
120120

121121
/*
122122
* InitPlanCache: initialize module during InitPostgres.

‎src/backend/utils/error/elog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ extern bool redirection_done;
107107
emit_log_hook_typeemit_log_hook=NULL;
108108

109109
/* GUC parameters */
110-
intLog_error_verbosity=PGERROR_VERBOSE;
110+
intLog_error_verbosity=PGERROR_DEFAULT;
111111
char*Log_line_prefix=NULL;/* format for extra log line info */
112112
intLog_destination=LOG_DESTINATION_STDERR;
113113
char*Log_destination_string=NULL;

‎src/backend/utils/init/globals.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ intmax_parallel_maintenance_workers = 2;
133133
* MaxBackends is computed by PostmasterMain after modules have had a chance to
134134
* register background workers.
135135
*/
136-
intNBuffers=1000;
137-
intMaxConnections=90;
136+
intNBuffers=16384;
137+
intMaxConnections=100;
138138
intmax_worker_processes=8;
139139
intmax_parallel_workers=8;
140140
intMaxBackends=0;

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

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ intssl_renegotiation_limit;
526526
* This really belongs in pg_shmem.c, but is defined here so that it doesn't
527527
* need to be duplicated in all the different implementations of pg_shmem.c.
528528
*/
529-
inthuge_pages;
529+
inthuge_pages=HUGE_PAGES_TRY;
530530
inthuge_page_size;
531531

532532
/*
@@ -543,7 +543,14 @@ static char *locale_ctype;
543543
staticchar*server_encoding_string;
544544
staticchar*server_version_string;
545545
staticintserver_version_num;
546-
staticintsyslog_facility;
546+
547+
#ifdefHAVE_SYSLOG
548+
#defineDEFAULT_SYSLOG_FACILITY LOG_LOCAL0
549+
#else
550+
#defineDEFAULT_SYSLOG_FACILITY 0
551+
#endif
552+
staticintsyslog_facility=DEFAULT_SYSLOG_FACILITY;
553+
547554
staticchar*timezone_string;
548555
staticchar*log_timezone_string;
549556
staticchar*timezone_abbreviations_string;
@@ -559,7 +566,14 @@ static intshared_memory_size_in_huge_pages;
559566
staticintwal_block_size;
560567
staticbooldata_checksums;
561568
staticboolinteger_datetimes;
562-
staticboolassert_enabled;
569+
570+
#ifdefUSE_ASSERT_CHECKING
571+
#defineDEFAULT_ASSERT_ENABLED true
572+
#else
573+
#defineDEFAULT_ASSERT_ENABLED false
574+
#endif
575+
staticboolassert_enabled=DEFAULT_ASSERT_ENABLED;
576+
563577
staticchar*recovery_target_timeline_string;
564578
staticchar*recovery_target_string;
565579
staticchar*recovery_target_xid_string;
@@ -1181,11 +1195,7 @@ struct config_bool ConfigureNamesBool[] =
11811195
GUC_NOT_IN_SAMPLE |GUC_DISALLOW_IN_FILE
11821196
},
11831197
&assert_enabled,
1184-
#ifdefUSE_ASSERT_CHECKING
1185-
true,
1186-
#else
1187-
false,
1188-
#endif
1198+
DEFAULT_ASSERT_ENABLED,
11891199
NULL,NULL,NULL
11901200
},
11911201

@@ -1357,11 +1367,7 @@ struct config_bool ConfigureNamesBool[] =
13571367
gettext_noop("Enables updating of the process title every time a new SQL command is received by the server.")
13581368
},
13591369
&update_process_title,
1360-
#ifdefWIN32
1361-
false,
1362-
#else
1363-
true,
1364-
#endif
1370+
DEFAULT_UPDATE_PROCESS_TITLE,
13651371
NULL,NULL,NULL
13661372
},
13671373

@@ -2888,11 +2894,7 @@ struct config_int ConfigureNamesInt[] =
28882894
GUC_EXPLAIN
28892895
},
28902896
&effective_io_concurrency,
2891-
#ifdefUSE_PREFETCH
2892-
1,
2893-
#else
2894-
0,
2895-
#endif
2897+
DEFAULT_EFFECTIVE_IO_CONCURRENCY,
28962898
0,MAX_IO_CONCURRENCY,
28972899
check_effective_io_concurrency,NULL,NULL
28982900
},
@@ -2906,11 +2908,7 @@ struct config_int ConfigureNamesInt[] =
29062908
GUC_EXPLAIN
29072909
},
29082910
&maintenance_io_concurrency,
2909-
#ifdefUSE_PREFETCH
2910-
10,
2911-
#else
2912-
0,
2913-
#endif
2911+
DEFAULT_MAINTENANCE_IO_CONCURRENCY,
29142912
0,MAX_IO_CONCURRENCY,
29152913
check_maintenance_io_concurrency,assign_maintenance_io_concurrency,
29162914
NULL
@@ -4613,11 +4611,7 @@ struct config_enum ConfigureNamesEnum[] =
46134611
NULL
46144612
},
46154613
&syslog_facility,
4616-
#ifdefHAVE_SYSLOG
4617-
LOG_LOCAL0,
4618-
#else
4619-
0,
4620-
#endif
4614+
DEFAULT_SYSLOG_FACILITY,
46214615
syslog_facility_options,
46224616
NULL,assign_syslog_facility,NULL
46234617
},

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030
#include"utils/ps_status.h"
3131

3232
externchar**environ;
33-
boolupdate_process_title= true;
3433

34+
/* GUC variable */
35+
boolupdate_process_title=DEFAULT_UPDATE_PROCESS_TITLE;
3536

3637
/*
3738
* Alternative ways of updating ps display:

‎src/include/storage/bufmgr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ extern PGDLLIMPORT bool zero_damaged_pages;
6969
externPGDLLIMPORTintbgwriter_lru_maxpages;
7070
externPGDLLIMPORTdoublebgwriter_lru_multiplier;
7171
externPGDLLIMPORTbooltrack_io_timing;
72+
73+
/* only applicable when prefetching is available */
74+
#ifdefUSE_PREFETCH
75+
#defineDEFAULT_EFFECTIVE_IO_CONCURRENCY 1
76+
#defineDEFAULT_MAINTENANCE_IO_CONCURRENCY 10
77+
#else
78+
#defineDEFAULT_EFFECTIVE_IO_CONCURRENCY 0
79+
#defineDEFAULT_MAINTENANCE_IO_CONCURRENCY 0
80+
#endif
7281
externPGDLLIMPORTinteffective_io_concurrency;
7382
externPGDLLIMPORTintmaintenance_io_concurrency;
7483

‎src/include/utils/ps_status.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
#ifndefPS_STATUS_H
1313
#definePS_STATUS_H
1414

15+
/* disabled on Windows as the performance overhead can be significant */
16+
#ifdefWIN32
17+
#defineDEFAULT_UPDATE_PROCESS_TITLE false
18+
#else
19+
#defineDEFAULT_UPDATE_PROCESS_TITLE true
20+
#endif
21+
1522
externPGDLLIMPORTboolupdate_process_title;
1623

1724
externchar**save_ps_display_args(intargc,char**argv);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp