Changeset: 0ab1bb99d0ea for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0ab1bb99d0ea
Modified Files:
sql/backends/monet5/sql_optimizer.c
Branch: default
Log Message:
HACK to prevent double optimization of a MAL plan.
Optimizing a plan twice can result in a race condition where two
statements both assign to the same MAL variable, and this variable is
used by another statement. If things happen in the wrong order, the
MAL variable may not have been properly initialized and the third
statement will then fail.
In particular, this can happen when the third statement is
algebra.projectionpath which is only produced by the first
optimization run.
diffs (18 lines):
diff --git a/sql/backends/monet5/sql_optimizer.c
b/sql/backends/monet5/sql_optimizer.c
--- a/sql/backends/monet5/sql_optimizer.c
+++ b/sql/backends/monet5/sql_optimizer.c
@@ -213,6 +213,14 @@ SQLoptimizeQuery(Client c, MalBlkPtr mb)
str msg = 0;
str pipe;
+ if (mb->stop > 0 &&
+ mb->stmt[mb->stop-1]->token == REMsymbol &&
+ mb->stmt[mb->stop-1]->argc > 0 &&
+ mb->var[mb->stmt[mb->stop-1]->argv[0]]->value.vtype == TYPE_str &&
+ mb->var[mb->stmt[mb->stop-1]->argv[0]]->value.val.sval &&
+ strncmp(mb->var[mb->stmt[mb->stop-1]->argv[0]]->value.val.sval,
"total", 5) == 0)
+ return MAL_SUCCEED; /* already optimized */
+
be = (backend *) c->sqlcontext;
assert(be && be->mvc); /* SQL clients should always have their state
set */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list