Skip to content

Commit fc80022

Browse files
committed
A couple of bugfixes here: don't enable statement timeout in parallel worker and minor DSM cache fix.
1 parent de8cb2a commit fc80022

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

‎learn_cache.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ init_with_dsm(OkNNrdata *data, dsm_block_hdr *hdr, List **reloids)
227227
Assert(LWLockHeldByMeInMode(&aqo_state->lock, LW_EXCLUSIVE) ||
228228
LWLockHeldByMeInMode(&aqo_state->lock, LW_SHARED));
229229
Assert(hdr->magic == AQO_SHARED_MAGIC);
230-
Assert(hdr && ptr);
230+
Assert(hdr && ptr && hdr->rows > 0);
231231

232232
data->rows = hdr->rows;
233233
data->cols = hdr->cols;
@@ -245,6 +245,12 @@ init_with_dsm(OkNNrdata *data, dsm_block_hdr *hdr, List **reloids)
245245
}
246246
}
247247

248+
/*
249+
* Kludge code. But we should rewrite this code because now all knowledge
250+
* base lives in non-transactional shared memory.
251+
*/
252+
ptr = (char *) hdr + sizeof(dsm_block_hdr) + (sizeof(double) * data->cols * aqo_K);
253+
248254
memcpy(data->targets, ptr, sizeof(double) * hdr->rows);
249255
ptr += sizeof(double) * aqo_K;
250256
memcpy(data->rfactors, ptr, sizeof(double) * hdr->rows);
@@ -261,7 +267,7 @@ init_with_dsm(OkNNrdata *data, dsm_block_hdr *hdr, List **reloids)
261267
return calculate_size(hdr->cols, *reloids);
262268
}
263269

264-
/* It is just read operation. No any interest in size calculation. */
270+
/* It is just a read operation. No any interest in size calculation. */
265271
return 0;
266272
}
267273

‎postprocessing.c

+7
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,13 @@ set_timeout_if_need(QueryDesc *queryDesc)
638638
{
639639
TimestampTz fin_time;
640640

641+
if (IsParallelWorker())
642+
/*
643+
* AQO timeout should stop only main worker. Other workers would be
644+
* terminated by a regular ERROR machinery.
645+
*/
646+
return false;
647+
641648
if (!get_timeout_active(STATEMENT_TIMEOUT) || !aqo_learn_statement_timeout)
642649
return false;
643650

0 commit comments

Comments
 (0)