pull/8029/merge
Karina 2025-06-23 18:59:12 +03:00 committed by GitHub
commit 0de18065da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 27 deletions

View File

@ -167,23 +167,19 @@ CitusExecutorRun(QueryDesc *queryDesc,
*/
executorBoundParams = queryDesc->params;
/*
* We do some potentially time consuming operations ourself now before we hand off
* control to postgres' executor. To make sure that time spent is accurately measured
* we remove the totaltime instrumentation from the queryDesc. Instead we will start
* and stop the instrumentation of the total time and put it back on the queryDesc
* before returning (or rethrowing) from this function.
*/
Instrumentation *volatile totalTime = queryDesc->totaltime;
queryDesc->totaltime = NULL;
PG_TRY();
{
ExecutorLevel++;
if (totalTime)
/*
* We do some potentially time consuming operations our self now before we hand of
* control to postgres' executor. To make sure that time spent is accurately measured
* we start and stop totaltime instrumentation from the queryDesc to mesure this
* time consuming operations before postgres' executor.
*/
if (queryDesc->totaltime)
{
InstrStartNode(totalTime);
InstrStartNode(queryDesc->totaltime);
}
/*
@ -202,13 +198,16 @@ CitusExecutorRun(QueryDesc *queryDesc,
*/
if (AlterTableConstraintCheck(queryDesc))
{
EState *estate = queryDesc->estate;
estate->es_processed = 0;
/* start and shutdown tuple receiver to simulate empty result */
dest->rStartup(queryDesc->dest, CMD_SELECT, queryDesc->tupDesc);
dest->rShutdown(dest);
queryDesc->estate->es_processed = 0;
if (queryDesc->totaltime)
{
InstrStopNode(queryDesc->totaltime, 0);
}
}
else
{
@ -235,13 +234,12 @@ CitusExecutorRun(QueryDesc *queryDesc,
/* postgres will switch here again and will restore back on its own */
MemoryContextSwitchTo(oldcontext);
standard_ExecutorRun(queryDesc, direction, count, execute_once);
}
if (queryDesc->totaltime)
{
InstrStopNode(queryDesc->totaltime, 0);
}
if (totalTime)
{
InstrStopNode(totalTime, queryDesc->estate->es_processed);
queryDesc->totaltime = totalTime;
standard_ExecutorRun(queryDesc, direction, count, execute_once);
}
executorBoundParams = savedBoundParams;
@ -269,11 +267,6 @@ CitusExecutorRun(QueryDesc *queryDesc,
}
PG_CATCH();
{
if (totalTime)
{
queryDesc->totaltime = totalTime;
}
executorBoundParams = savedBoundParams;
ExecutorLevel--;