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

Commit1d6fb35

Browse files
committed
Revert "Fix accumulation of parallel worker instrumentation."
This reverts commit2c09a5c. Perfurther discussion, that doesn't seem to be the best possible fix.Discussion:http://postgr.es/m/CAA4eK1LW2aFKzY3=vwvc=t-juzPPVWP2uT1bpx_MeyEqnM+p8g@mail.gmail.com
1 parent9fa6f00 commit1d6fb35

File tree

3 files changed

+13
-66
lines changed

3 files changed

+13
-66
lines changed

‎src/backend/executor/execParallel.c

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -819,19 +819,6 @@ ExecParallelReinitialize(PlanState *planstate,
819819
/* Old workers must already be shut down */
820820
Assert(pei->finished);
821821

822-
/* Clear the instrumentation space from the last round. */
823-
if (pei->instrumentation)
824-
{
825-
Instrumentation*instrument;
826-
SharedExecutorInstrumentation*sh_instr;
827-
inti;
828-
829-
sh_instr=pei->instrumentation;
830-
instrument=GetInstrumentationArray(sh_instr);
831-
for (i=0;i<sh_instr->num_workers*sh_instr->num_plan_nodes;++i)
832-
InstrInit(&instrument[i],pei->planstate->state->es_instrument);
833-
}
834-
835822
/* Force parameters we're going to pass to workers to be evaluated. */
836823
ExecEvalParamExecParams(sendParams,estate);
837824

@@ -953,33 +940,21 @@ ExecParallelRetrieveInstrumentation(PlanState *planstate,
953940
for (n=0;n<instrumentation->num_workers;++n)
954941
InstrAggNode(planstate->instrument,&instrument[n]);
955942

956-
if (!planstate->worker_instrument)
957-
{
958-
/*
959-
* Allocate space for the per-worker detail.
960-
*
961-
* Worker instrumentation should be allocated in the same context as
962-
* the regular instrumentation information, which is the per-query
963-
* context. Switch into per-query memory context.
964-
*/
965-
oldcontext=MemoryContextSwitchTo(planstate->state->es_query_cxt);
966-
ibytes=
967-
mul_size(instrumentation->num_workers,sizeof(Instrumentation));
968-
planstate->worker_instrument=
969-
palloc(ibytes+ offsetof(WorkerInstrumentation,instrument));
970-
MemoryContextSwitchTo(oldcontext);
971-
972-
for (n=0;n<instrumentation->num_workers;++n)
973-
InstrInit(&planstate->worker_instrument->instrument[n],
974-
planstate->state->es_instrument);
975-
}
943+
/*
944+
* Also store the per-worker detail.
945+
*
946+
* Worker instrumentation should be allocated in the same context as the
947+
* regular instrumentation information, which is the per-query context.
948+
* Switch into per-query memory context.
949+
*/
950+
oldcontext=MemoryContextSwitchTo(planstate->state->es_query_cxt);
951+
ibytes=mul_size(instrumentation->num_workers,sizeof(Instrumentation));
952+
planstate->worker_instrument=
953+
palloc(ibytes+ offsetof(WorkerInstrumentation,instrument));
954+
MemoryContextSwitchTo(oldcontext);
976955

977956
planstate->worker_instrument->num_workers=instrumentation->num_workers;
978-
979-
/* Accumulate the per-worker detail. */
980-
for (n=0;n<instrumentation->num_workers;++n)
981-
InstrAggNode(&planstate->worker_instrument->instrument[n],
982-
&instrument[n]);
957+
memcpy(&planstate->worker_instrument->instrument,instrument,ibytes);
983958

984959
/* Perform any node-type-specific work that needs to be done. */
985960
switch (nodeTag(planstate))

‎src/test/regress/expected/select_parallel.out

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -465,28 +465,7 @@ select count(*) from bmscantest where a>1;
465465
99999
466466
(1 row)
467467

468-
-- test accumulation of stats for parallel node
469468
reset enable_seqscan;
470-
alter table tenk2 set (parallel_workers = 0);
471-
explain (analyze, timing off, summary off, costs off)
472-
select count(*) from tenk1, tenk2 where tenk1.hundred > 1
473-
and tenk2.thousand=0;
474-
QUERY PLAN
475-
--------------------------------------------------------------------------
476-
Aggregate (actual rows=1 loops=1)
477-
-> Nested Loop (actual rows=98000 loops=1)
478-
-> Seq Scan on tenk2 (actual rows=10 loops=1)
479-
Filter: (thousand = 0)
480-
Rows Removed by Filter: 9990
481-
-> Gather (actual rows=9800 loops=10)
482-
Workers Planned: 4
483-
Workers Launched: 4
484-
-> Parallel Seq Scan on tenk1 (actual rows=1960 loops=50)
485-
Filter: (hundred > 1)
486-
Rows Removed by Filter: 40
487-
(11 rows)
488-
489-
alter table tenk2 reset (parallel_workers);
490469
reset enable_indexscan;
491470
reset enable_hashjoin;
492471
reset enable_mergejoin;

‎src/test/regress/sql/select_parallel.sql

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,7 @@ insert into bmscantest select r, 'fooooooooooooooooooooooooooooooooooooooooooooo
179179
createindexi_bmtestON bmscantest(a);
180180
selectcount(*)from bmscantestwhere a>1;
181181

182-
-- test accumulation of stats for parallel node
183182
reset enable_seqscan;
184-
altertable tenk2set (parallel_workers=0);
185-
explain (analyze, timing off, summary off, costs off)
186-
selectcount(*)from tenk1, tenk2wheretenk1.hundred>1
187-
andtenk2.thousand=0;
188-
altertable tenk2 reset (parallel_workers);
189-
190183
reset enable_indexscan;
191184
reset enable_hashjoin;
192185
reset enable_mergejoin;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp