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

Commit3947ef5

Browse files
akorotkovildus
authored andcommitted
Move all GUCs to private memory, PGC_POSTMASTER.
1 parent0d06faf commit3947ef5

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

‎contrib/pg_stat_wait/collector.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ shm_toc *toc;
2727
shm_mq*mq;
2828
staticvolatilesig_atomic_tshutdown_requested= false;
2929

30+
inthistorySize;
31+
inthistoryPeriod;
32+
boolhistorySkipLatch;
33+
3034
staticvoidhandle_sigterm(SIGNAL_ARGS);
3135
staticvoidcollector_main(Datummain_arg);
3236

@@ -66,20 +70,6 @@ AllocateCollectorMem(void)
6670

6771
mq_mem=shm_toc_allocate(toc,COLLECTOR_QUEUE_SIZE);
6872
shm_toc_insert(toc,1,mq_mem);
69-
70-
DefineCustomIntVariable("pg_stat_wait.history_size",
71-
"Sets size of waits history.",NULL,
72-
&hdr->historySize,5000,100,INT_MAX,
73-
PGC_SUSET,0,NULL,NULL,NULL);
74-
75-
DefineCustomIntVariable("pg_stat_wait.history_period",
76-
"Sets period of waits history sampling.",NULL,
77-
&hdr->historyPeriod,10,1,INT_MAX,
78-
PGC_SUSET,0,NULL,NULL,NULL);
79-
80-
DefineCustomBoolVariable("pg_stat_wait.history_skip_latch",
81-
"Skip latch events in waits history",NULL,
82-
&hdr->historySkipLatch, false,PGC_SUSET,0,NULL,NULL,NULL);
8373
}
8474
else
8575
{
@@ -185,7 +175,7 @@ write_waits_history(History *observations, TimestampTz current_ts)
185175

186176
if (stateOk)
187177
{
188-
if (hdr->historySkipLatch&&item.classId==WAIT_LATCH)
178+
if (historySkipLatch&&item.classId==WAIT_LATCH)
189179
continue;
190180

191181
item.ts=current_ts;
@@ -241,7 +231,7 @@ collector_main(Datum main_arg)
241231
ALLOCSET_DEFAULT_INITSIZE,
242232
ALLOCSET_DEFAULT_MAXSIZE);
243233
old_context=MemoryContextSwitchTo(collector_context);
244-
AllocHistory(&observations,hdr->historySize);
234+
AllocHistory(&observations,historySize);
245235
MemoryContextSwitchTo(old_context);
246236

247237
while (1)
@@ -258,7 +248,7 @@ collector_main(Datum main_arg)
258248

259249
rc=WaitLatch(&MyProc->procLatch,
260250
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,
261-
hdr->historyPeriod);
251+
historyPeriod);
262252

263253
if (rc&WL_POSTMASTER_DEATH)
264254
exit(1);

‎contrib/pg_stat_wait/pg_stat_wait.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,21 @@ _PG_init(void)
4949
return;
5050

5151
DefineCustomBoolVariable("pg_stat_wait.history","Collect waits history",
52-
NULL,&WaitsHistoryOn, false,PGC_SUSET,0,NULL,NULL,NULL);
52+
NULL,&WaitsHistoryOn, false,PGC_POSTMASTER,0,NULL,NULL,NULL);
53+
54+
DefineCustomIntVariable("pg_stat_wait.history_size",
55+
"Sets size of waits history.",NULL,
56+
&historySize,5000,100,INT_MAX,
57+
PGC_POSTMASTER,0,NULL,NULL,NULL);
58+
59+
DefineCustomIntVariable("pg_stat_wait.history_period",
60+
"Sets period of waits history sampling.",NULL,
61+
&historyPeriod,10,1,INT_MAX,
62+
PGC_POSTMASTER,0,NULL,NULL,NULL);
63+
64+
DefineCustomBoolVariable("pg_stat_wait.history_skip_latch",
65+
"Skip latch events in waits history",NULL,
66+
&historySkipLatch, false,PGC_POSTMASTER,0,NULL,NULL,NULL);
5367

5468
if (WaitsHistoryOn)
5569
{

‎contrib/pg_stat_wait/pg_stat_wait.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,17 @@ typedef struct
6262
{
6363
Latch*latch;
6464
SHMRequestrequest;
65-
inthistorySize;
66-
inthistoryPeriod;
67-
boolhistorySkipLatch;
6865
}CollectorShmqHeader;
6966

7067
externPGDLLIMPORTchar*WAIT_LOCK_NAMES[];
7168
externPGDLLIMPORTchar*WAIT_LWLOCK_NAMES[];
7269
externPGDLLIMPORTchar*WAIT_IO_NAMES[];
7370
externPGDLLIMPORTchar*WAIT_NETWORK_NAMES[];
7471
externPGDLLIMPORTconstintWAIT_OFFSETS[];
72+
externPGDLLIMPORTinthistorySize;
73+
externPGDLLIMPORTinthistoryPeriod;
74+
externPGDLLIMPORTboolhistorySkipLatch;
75+
7576

7677
SizeCollectorShmemSize(void);
7778
voidAllocateCollectorMem(void);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp