Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6b80f92

Browse files
author
Alexandra Pervushina
committed
Add early termination detection to aqo postprocessing
1 parent e0f0d38 commit 6b80f92

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

postprocessing.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,27 @@ should_learn(PlanState *ps, AQOPlanNode *node, aqo_obj_stat *ctx,
342342
}
343343
else if (ctx->learn)
344344
{
345-
*rfactor = RELIABILITY_MAX;
345+
bool early_term = false;
346+
if (ps->worker_instrument)
347+
{
348+
int i;
349+
350+
for (i = 0; i < ps->worker_instrument->num_workers; i++)
351+
{
352+
if (ps->worker_instrument->instrument[i].finished == TS_IN_ACTION)
353+
{
354+
early_term = true;
355+
break;
356+
}
357+
}
358+
}
359+
else if (ps->instrument->finished == TS_IN_ACTION)
360+
{
361+
early_term = true;
362+
}
363+
if (early_term)
364+
elog(NOTICE, "Early termination");
365+
*rfactor = early_term ? RELIABILITY_MIN : RELIABILITY_MAX;
346366
return true;
347367
}
348368

0 commit comments

Comments
 (0)