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

Commit19f8936

Browse files
author
Maksim Milyutin
committed
Add changes for 10devel version
1 parent016b4ab commit19f8936

File tree

6 files changed

+44
-44
lines changed

6 files changed

+44
-44
lines changed

‎custom_signals.patch‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
2-
index0abde43..961d267 100644
2+
indexa3d6ac5..07270a9 100644
33
--- a/src/backend/storage/ipc/procsignal.c
44
+++ b/src/backend/storage/ipc/procsignal.c
5-
@@ -67,12 +67,17 @@ typedef struct
5+
@@ -59,12 +59,17 @@ typedef struct
66
*/
7-
boolset_latch_on_sigusr1;
7+
#define NumProcSignalSlots(MaxBackends + NUM_AUXPROCTYPES)
88

99
+static bool CustomSignalPendings[NUM_CUSTOM_PROCSIGNALS];
1010
+static ProcSignalHandler_type CustomHandlers[NUM_CUSTOM_PROCSIGNALS];
@@ -20,7 +20,7 @@ index 0abde43..961d267 100644
2020
/*
2121
* ProcSignalShmemSize
2222
*Compute space needed for procsignal's shared memory
23-
@@ -173,6 +178,57 @@ CleanupProcSignalState(int status, Datum arg)
23+
@@ -165,6 +170,57 @@ CleanupProcSignalState(int status, Datum arg)
2424
}
2525

2626
/*
@@ -78,7 +78,7 @@ index 0abde43..961d267 100644
7878
* SendProcSignal
7979
*Send a signal to a Postgres process
8080
*
81-
@@ -267,7 +323,8 @@ CheckProcSignal(ProcSignalReason reason)
81+
@@ -259,7 +315,8 @@ CheckProcSignal(ProcSignalReason reason)
8282
void
8383
procsignal_sigusr1_handler(SIGNAL_ARGS)
8484
{
@@ -88,18 +88,17 @@ index 0abde43..961d267 100644
8888

8989
if (CheckProcSignal(PROCSIG_CATCHUP_INTERRUPT))
9090
HandleCatchupInterrupt();
91-
@@ -296,6 +353,10 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
91+
@@ -288,9 +345,55 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
9292
if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN))
9393
RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
9494

9595
+for (reason = PROCSIG_CUSTOM_1; reason <= PROCSIG_CUSTOM_N; reason++)
9696
+if (CheckProcSignal(reason))
9797
+CustomSignalInterrupt(reason);
9898
+
99-
if (set_latch_on_sigusr1)
100-
SetLatch(MyLatch);
99+
SetLatch(MyLatch);
101100

102-
@@ -303,3 +364,45 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
101+
latch_sigusr1_handler();
103102

104103
errno = save_errno;
105104
}
@@ -146,10 +145,10 @@ index 0abde43..961d267 100644
146145
+}
147146
+}
148147
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
149-
indexf78321d..9ef7dd8 100644
148+
index98ccbbb..c5d649c 100644
150149
--- a/src/backend/tcop/postgres.c
151150
+++ b/src/backend/tcop/postgres.c
152-
@@ -3006,6 +3006,8 @@ ProcessInterrupts(void)
151+
@@ -3005,6 +3005,8 @@ ProcessInterrupts(void)
153152

154153
if (ParallelMessagePending)
155154
HandleParallelMessages();
@@ -159,7 +158,7 @@ index f78321d..9ef7dd8 100644
159158

160159

161160
diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h
162-
indexaf1a0cd..507a63c 100644
161+
indexf67b982..e941dcb 100644
163162
--- a/src/include/storage/procsignal.h
164163
+++ b/src/include/storage/procsignal.h
165164
@@ -17,6 +17,8 @@
@@ -215,5 +214,5 @@ index af1a0cd..507a63c 100644
215214
+extern void CheckAndHandleCustomSignals(void);
216215
+
217216
extern void procsignal_sigusr1_handler(SIGNAL_ARGS);
218-
extern PGDLLIMPORT bool set_latch_on_sigusr1;
219217

218+
#endif /* PROCSIGNAL_H */

‎executor_hooks.patch‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c
2-
index03c2feb..a33e645c 100644
2+
index554244f..ad06616 100644
33
--- a/src/backend/executor/execProcnode.c
44
+++ b/src/backend/executor/execProcnode.c
5-
@@ -115,7 +115,6 @@
6-
#include "executor/nodeWorktablescan.h"
5+
@@ -117,7 +117,6 @@
6+
#include "nodes/nodeFuncs.h"
77
#include "miscadmin.h"
88

99
-
1010
/* ------------------------------------------------------------------------
1111
*ExecInitNode
1212
*
13-
@@ -356,6 +355,9 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
13+
@@ -363,6 +362,9 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
1414
return result;
1515
}
1616

@@ -20,7 +20,7 @@ index 03c2feb..a33e645c 100644
2020

2121
/* ----------------------------------------------------------------
2222
*ExecProcNode
23-
@@ -374,7 +376,12 @@ ExecProcNode(PlanState *node)
23+
@@ -381,7 +383,12 @@ ExecProcNode(PlanState *node)
2424
ExecReScan(node);/* let ReScan handle this */
2525

2626
if (node->instrument)
@@ -33,7 +33,7 @@ index 03c2feb..a33e645c 100644
3333

3434
switch (nodeTag(node))
3535
{
36-
@@ -527,8 +534,13 @@ ExecProcNode(PlanState *node)
36+
@@ -538,8 +545,13 @@ ExecProcNode(PlanState *node)
3737
}
3838

3939
if (node->instrument)
@@ -48,7 +48,7 @@ index 03c2feb..a33e645c 100644
4848
}
4949

5050
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
51-
index110bc93..8801419 100644
51+
index39521ed..9acbff7 100644
5252
--- a/src/include/executor/executor.h
5353
+++ b/src/include/executor/executor.h
5454
@@ -95,6 +95,12 @@ extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook;

‎pg_query_state.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void_PG_fini(void);
5252

5353
/* hooks defined in this module */
5454
staticvoidqs_ExecutorStart(QueryDesc*queryDesc,inteflags);
55-
staticvoidqs_ExecutorRun(QueryDesc*queryDesc,ScanDirectiondirection,longcount);
55+
staticvoidqs_ExecutorRun(QueryDesc*queryDesc,ScanDirectiondirection,uint64count);
5656
staticvoidqs_ExecutorFinish(QueryDesc*queryDesc);
5757
staticvoidqs_ExecutorEnd(QueryDesc*queryDesc);
5858
staticvoidqs_postExecProcNode(PlanState*planstate,TupleTableSlot*result);
@@ -392,7 +392,7 @@ qs_ExecutorStart(QueryDesc *queryDesc, int eflags)
392392
* Catch any fatal signals
393393
*/
394394
staticvoid
395-
qs_ExecutorRun(QueryDesc*queryDesc,ScanDirectiondirection,longcount)
395+
qs_ExecutorRun(QueryDesc*queryDesc,ScanDirectiondirection,uint64count)
396396
{
397397
PG_TRY();
398398
{

‎runtime_explain.patch‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
2-
index11047f7..3f5c638 100644
2+
index82ba58e..bf7dfa6 100644
33
--- a/src/backend/commands/explain.c
44
+++ b/src/backend/commands/explain.c
5-
@@ -653,15 +653,35 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
5+
@@ -667,15 +667,35 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
66
Instrumentation *instr = rInfo->ri_TrigInstrument + nt;
77
char *relname;
88
char *conname = NULL;
@@ -41,7 +41,7 @@ index 11047f7..3f5c638 100644
4141
continue;
4242

4343
ExplainOpenGroup("Trigger", NULL, true, es);
44-
@@ -687,9 +707,9 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
44+
@@ -701,9 +721,9 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
4545
appendStringInfo(es->str, " on %s", relname);
4646
if (es->timing)
4747
appendStringInfo(es->str, ": time=%.3f calls=%.0f\n",
@@ -53,7 +53,7 @@ index 11047f7..3f5c638 100644
5353
}
5454
else
5555
{
56-
@@ -698,8 +718,8 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
56+
@@ -712,8 +732,8 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
5757
ExplainPropertyText("Constraint Name", conname, es);
5858
ExplainPropertyText("Relation", relname, es);
5959
if (es->timing)
@@ -64,7 +64,7 @@ index 11047f7..3f5c638 100644
6464
}
6565

6666
if (conname)
67-
@@ -1247,8 +1267,11 @@ ExplainNode(PlanState *planstate, List *ancestors,
67+
@@ -1225,8 +1245,11 @@ ExplainNode(PlanState *planstate, List *ancestors,
6868
* instrumentation results the user didn't ask for. But we do the
6969
* InstrEndLoop call anyway, if possible, to reduce the number of cases
7070
* auto_explain has to contend with.
@@ -77,7 +77,7 @@ index 11047f7..3f5c638 100644
7777
InstrEndLoop(planstate->instrument);
7878

7979
if (es->analyze &&
80-
@@ -1281,7 +1304,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
80+
@@ -1259,7 +1282,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
8181
ExplainPropertyFloat("Actual Loops", nloops, 0, es);
8282
}
8383
}
@@ -86,7 +86,7 @@ index 11047f7..3f5c638 100644
8686
{
8787
if (es->format == EXPLAIN_FORMAT_TEXT)
8888
appendStringInfoString(es->str, " (never executed)");
89-
@@ -1297,6 +1320,75 @@ ExplainNode(PlanState *planstate, List *ancestors,
89+
@@ -1275,6 +1298,75 @@ ExplainNode(PlanState *planstate, List *ancestors,
9090
}
9191
}
9292

@@ -162,7 +162,7 @@ index 11047f7..3f5c638 100644
162162
/* in text format, first line ends here */
163163
if (es->format == EXPLAIN_FORMAT_TEXT)
164164
appendStringInfoChar(es->str, '\n');
165-
@@ -2293,20 +2385,17 @@ show_instrumentation_count(const char *qlabel, int which,
165+
@@ -2269,20 +2361,17 @@ show_instrumentation_count(const char *qlabel, int which,
166166
if (!es->analyze || !planstate->instrument)
167167
return;
168168

@@ -189,7 +189,7 @@ index 11047f7..3f5c638 100644
189189
}
190190

191191
/*
192-
@@ -2658,14 +2747,28 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors,
192+
@@ -2754,14 +2843,28 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors,
193193
doubleinsert_path;
194194
doubleother_path;
195195

@@ -224,10 +224,10 @@ index 11047f7..3f5c638 100644
224224
}
225225
}
226226
diff --git a/src/backend/executor/instrument.c b/src/backend/executor/instrument.c
227-
indexf5351eb..591ea0f 100644
227+
index2614bf4..56d8a49 100644
228228
--- a/src/backend/executor/instrument.c
229229
+++ b/src/backend/executor/instrument.c
230-
@@ -118,6 +118,8 @@ InstrEndLoop(Instrumentation *instr)
230+
@@ -129,6 +129,8 @@ InstrEndLoop(Instrumentation *instr)
231231
instr->total += totaltime;
232232
instr->ntuples += instr->tuplecount;
233233
instr->nloops += 1;
@@ -236,17 +236,17 @@ index f5351eb..591ea0f 100644
236236

237237
/* Reset for next cycle (if any) */
238238
instr->running = false;
239-
@@ -125,6 +127,8 @@ InstrEndLoop(Instrumentation *instr)
239+
@@ -136,6 +138,8 @@ InstrEndLoop(Instrumentation *instr)
240240
INSTR_TIME_SET_ZERO(instr->counter);
241241
instr->firsttuple = 0;
242242
instr->tuplecount = 0;
243243
+instr->nfiltered1 = 0;
244244
+instr->nfiltered2 = 0;
245245
}
246246

247-
/*dst += add - sub */
247+
/*aggregate instrumentation information */
248248
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
249-
index26fcc5b..2ad3fb8 100644
249+
index3d0a5ab..1f0bde7 100644
250250
--- a/src/include/commands/explain.h
251251
+++ b/src/include/commands/explain.h
252252
@@ -35,6 +35,8 @@ typedef struct ExplainState
@@ -255,11 +255,11 @@ index 26fcc5b..2ad3fb8 100644
255255
ExplainFormat format;/* output format */
256256
+boolruntime;/* print intermediate state of query execution,
257257
+ not after completion */
258-
/*other states */
259-
PlannedStmt *pstmt;/*top of plan */
260-
List *rtable;/*range table */
258+
/*state for output formatting --- not reset for each new plan tree */
259+
intindent;/*current indentation level */
260+
List *grouping_stack;/*format-specific grouping state */
261261
diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h
262-
indexc9a2129..c53517f 100644
262+
index8e5f0ec..2a1b512 100644
263263
--- a/src/include/executor/instrument.h
264264
+++ b/src/include/executor/instrument.h
265265
@@ -52,14 +52,16 @@ typedef struct Instrumentation

‎tests/pg_qs_test_runner.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class TeardownException(Exception): pass
4848
test_timing,
4949
test_formats,
5050
test_timing_buffers_conflicts,
51-
]
51+
]
5252

5353
defsetup(con):
5454
''' Creates pg_query_state extension, creates tables for tests, fills it with data '''

‎tests/test_cases.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_deadlock(config):
8585

8686
n_close((acon1,acon2))
8787

88-
defquery_state(config,async_conn,query,steps,args={}):
88+
defquery_state(config,async_conn,query,steps,args={},num_workers=0):
8989
"""
9090
Get intermediate state of 'query' on connection 'async_conn' after number of 'steps'
9191
of node executions from start of query
@@ -96,6 +96,7 @@ def query_state(config, async_conn, query, steps, args={}):
9696
curs=conn.cursor()
9797

9898
set_guc(async_conn,'enable_mergejoin','off')
99+
set_guc(async_conn,'max_parallel_workers_per_gather',num_workers)
99100
set_guc(async_conn,'pg_query_state.executor_trace','on')
100101

101102
# execute 'query' specific number of 'steps'
@@ -275,7 +276,7 @@ def test_trigger(config):
275276
util_curs.execute(create_trigger)
276277
util_conn.commit()
277278

278-
qs=query_state(config,acon,query,num_steps, {'triggers':True})
279+
qs=query_state(config,acon,query,num_steps,{'triggers':True})
279280
assertlen(qs)==2 \
280281
andqs[0][0]==queryandqs[0][1]==expected_upper+'\n'+trigger_suffix \
281282
andqs[1][0]=='SELECT new.c1 in (select c1 from foo)'andqs[1][1]==expected_inner
@@ -298,7 +299,7 @@ def test_costs(config):
298299
acon,=n_async_connect(config)
299300
query='select count(*) from foo join bar on foo.c1=bar.c1'
300301
num_steps=10
301-
expected=r"""Aggregate \(cost=\d+.\d+..\d+.\d+ rows=\d+ width=0\) \(Current loop: actual rows=0, loop number=1\)
302+
expected=r"""Aggregate \(cost=\d+.\d+..\d+.\d+ rows=\d+ width=8\) \(Current loop: actual rows=0, loop number=1\)
302303
-> Hash Join \(cost=\d+.\d+..\d+.\d+ rows=\d+ width=0\) \(Current loop: actual rows=0, loop number=1\)
303304
Hash Cond: \(foo.c1 = bar.c1\)
304305
-> Seq Scan on foo \(cost=0.00..\d+.\d+ rows=\d+ width=4\) \(Current loop: actual rows=1, loop number=1\)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp