1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Try again to fix accumulation of parallel worker instrumentation.

When a Gather or Gather Merge node is started and stopped multiple
times, accumulate instrumentation data only once, at the end, instead
of after each execution, to avoid recording inflated totals.

Commit 778e78ae9f, the previous attempt
at a fix, instead reset the state after every execution, which worked
for the general instrumentation data but had problems for the additional
instrumentation specific to Sort and Hash nodes.

Report by hubert depesz lubaczewski.  Analysis and fix by Amit Kapila,
following a design proposal from Thomas Munro, with a comment tweak
by me.

Discussion: http://postgr.es/m/20171127175631.GA405@depesz.com
This commit is contained in:
Robert Haas
2017-12-19 12:21:56 -05:00
parent 38fc54703e
commit 8526bcb2df
7 changed files with 96 additions and 49 deletions

View File

@ -1669,19 +1669,6 @@ ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt)
node->shared_info);
}
/*
* Reset shared state before beginning a fresh scan.
*/
void
ExecHashReInitializeDSM(HashState *node, ParallelContext *pcxt)
{
if (node->shared_info != NULL)
{
memset(node->shared_info->hinstrument, 0,
node->shared_info->num_workers * sizeof(HashInstrumentation));
}
}
/*
* Locate the DSM space for hash table instrumentation data that we'll write
* to at shutdown time.