Changeset: 386371c4359f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/386371c4359f Modified Files: monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_runtime.c sql/server/rel_exp.c sql/server/rel_optimizer.c sql/server/rel_propagate.c Branch: Jul2021 Log Message:
Merged with Oct2020 diffs (61 lines): diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -504,6 +504,7 @@ str runMALsequence(Client cntxt, MalBlkP runtimeProfileBegin(cntxt, mb, stk, getInstrPtr(mb,0), &runtimeProfileFunction); mb->starttime = GDKusec(); if (cntxt->sessiontimeout && mb->starttime - cntxt->session > cntxt->sessiontimeout) { + runtimeProfileFinish(cntxt, mb, stk); if ( backup != backups) GDKfree(backup); if ( garbage != garbages) GDKfree(garbage); throw(MAL, "mal.interpreter", SQLSTATE(HYT00) RUNTIME_SESSION_TIMEOUT); diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c --- a/monetdb5/mal/mal_runtime.c +++ b/monetdb5/mal/mal_runtime.c @@ -161,25 +161,28 @@ clearQRYqueue(size_t idx) static void advanceQRYqueue(void) { - qhead++; - if( qhead == qsize) - qhead = 0; - if( qtail == qhead) - qtail++; - if( qtail == qsize) - qtail = 0; - /* clean out the element */ - str s = QRYqueue[qhead].query; - if( s){ - /* don;t wipe them when they are still running, prepared, or paused */ - /* The upper layer has assured there is at least one slot available */ - if(QRYqueue[qhead].status != 0 && (QRYqueue[qhead].status[0] == 'r' || QRYqueue[qhead].status[0] == 'p')){ - advanceQRYqueue(); - return; + bool found_empty_slot = false; + + while (!found_empty_slot) { + qhead++; + if( qhead == qsize) + qhead = 0; + if( qtail == qhead) + qtail++; + if( qtail == qsize) + qtail = 0; + /* clean out the element */ + str s = QRYqueue[qhead].query; + if (!s || QRYqueue[qhead].status == 0 || (QRYqueue[qhead].status[0] != 'r' && QRYqueue[qhead].status[0] != 'p')) { + /* don't wipe them when they are still running, prepared, or paused */ + /* The upper layer has assured there is at least one slot available */ + if (s) { + GDKfree(s); + GDKfree(QRYqueue[qhead].username); + clearQRYqueue(qhead); + } + found_empty_slot = true; } - GDKfree(s); - GDKfree(QRYqueue[qhead].username); - clearQRYqueue(qhead); } } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list