Changeset: ca22cc61abc1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ca22cc61abc1
Modified Files:
geom/monetdb5/geom.mx
monetdb5/mal/mal_recycle.c
monetdb5/modules/mal/remote.c
monetdb5/optimizer/opt_emptySet.c
monetdb5/optimizer/opt_joinpath.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_recycler.c
sql/backends/monet5/sql_gencode.c
Branch: headless
Log Message:
Merge with default branch.
diffs (truncated from 710 to 300 lines):
diff --git a/geom/monetdb5/geom.mx b/geom/monetdb5/geom.mx
--- a/geom/monetdb5/geom.mx
+++ b/geom/monetdb5/geom.mx
@@ -256,7 +256,7 @@ end @2;
@:ctypes(MultiSurface,multisurface,6)@
@:ctypes(MultiPoly,multipolygon,6)@
@:ctypes(Geom,geometry,7)@
-@:ctypes(GeomCollection,geometrycollection,7)@
+@:ctypes(GeomCollection,geomcollection,7)@
module geom;
command calc.isnil(v:wkb):bit
diff --git a/monetdb5/mal/mal_recycle.c b/monetdb5/mal/mal_recycle.c
--- a/monetdb5/mal/mal_recycle.c
+++ b/monetdb5/mal/mal_recycle.c
@@ -223,11 +223,11 @@ static void extendQPat(void)
QryStatPtr *old;
if (recycleQPat == NULL)
- RECYCLEinitQPat(20);
- if (recycleQPat->cnt < recycleQPat->sz)
+ RECYCLEinitQPat(1024);
+ if (recycleQPat->cnt < recycleQPat->sz)
return;
old = recycleQPat->ptrn;
- s = recycleQPat->sz * 2;
+ s = recycleQPat->sz +1024; /* lineare growth is enough */
recycleQPat->ptrn = (QryStatPtr *) GDKzalloc(s * sizeof(QryStatPtr));
for( i=0; i< recycleQPat->cnt; i++)
recycleQPat->ptrn[i] = old[i];
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -77,7 +77,7 @@
* used to issue a safe, but blocking get/put/exec/register request.
*/
-/* #define _DEBUG_REMOTE*/
+/* #define _DEBUG_REMOTE */
#define RMTT_L_ENDIAN 0<<1
#define RMTT_B_ENDIAN 1<<1
diff --git a/monetdb5/optimizer/opt_centipede.mx
b/monetdb5/optimizer/opt_centipede.mx
--- a/monetdb5/optimizer/opt_centipede.mx
+++ b/monetdb5/optimizer/opt_centipede.mx
@@ -80,7 +80,7 @@ typedef struct{
* TODO pack is expensive, move to mat.new
*/
static MalBlkPtr
-OPTplanCntrl(Client cntxt, MalBlkPtr mb, MalBlkPtr pmb, Slices *slices)
+OPTplanCntrl(Client cntxt, MalBlkPtr mb, MalBlkPtr pmb, Slices *slices, oid
plantag)
{
MalBlkPtr cmb;
Symbol s;
@@ -93,7 +93,7 @@ OPTplanCntrl(Client cntxt, MalBlkPtr mb,
printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT);
#endif
/* define the query controller */
- snprintf(nme,BUFSIZ,"%s_plan",getFunctionId( getInstrPtr(mb,0)));
+ snprintf(nme, BUFSIZ, "%s_plan"OIDFMT, getFunctionId(
getInstrPtr(mb,0)), plantag);
plan = putName(nme, strlen(nme));
snprintf(nme,BUFSIZ,"%s_stub",getFunctionId( getInstrPtr(mb,0)));
stub = putName(nme, strlen(nme));
@@ -259,7 +259,7 @@ OPTplanCntrl(Client cntxt, MalBlkPtr mb,
}
static MalBlkPtr
-OPTplanStub(Client cntxt, MalBlkPtr mb, MalBlkPtr pmb)
+OPTplanStub(Client cntxt, MalBlkPtr mb, MalBlkPtr pmb, oid plantag)
{
MalBlkPtr smb = 0;
Symbol s;
@@ -306,7 +306,7 @@ OPTplanStub(Client cntxt, MalBlkPtr mb,
}
/* (k1,...kn):= remote.exec(conn,srvpool,qry,version....) */
- snprintf(nme,BUFSIZ,"%s_plan",getFunctionId( getInstrPtr(mb,0)));
+ snprintf(nme, BUFSIZ, "%s_plan"OIDFMT, getFunctionId(
getInstrPtr(mb,0)), plantag);
q = newInstruction(smb,ASSIGNsymbol);
getModuleId(q) = remoteRef;
getFunctionId(q) = execRef;
@@ -385,10 +385,12 @@ OPTpreparePartition(MalBlkPtr nmb, Instr
q= pushArgument(nmb,q, getArg(p,0));
q= pushArgument(nmb,q, slices->lslices);
q= pushArgument(nmb,q, slices->hslices);
- setModuleId(q,centipedeRef);
- setFunctionId(q,materializeRef);
+ setModuleId(q,algebraRef);
+ setFunctionId(q,selectRef);
getArg(q,0)= slices->slice;
getArg(q,1) = getArg(p,0);
+ q= pushBit(nmb,q,TRUE);
+ q= pushBit(nmb,q,FALSE);
pushInstruction(nmb,q);
return parallel;
}
@@ -451,6 +453,8 @@ OPTsliceColumn(Client cntxt, MalBlkPtr n
* For example join(A,B) where A is fragmented and B is not can be done
elsewhere.
* In all cases we should ensure that the result of the remote execution can be
* simply unioned together.
+ * All plans should be uniquely tagged, because we have to avoid potential
conflicts
+ * when a connection is re-used by different client sessions.
*/
#define BLOCKED 1
#define REQUIRED 2
@@ -473,6 +477,7 @@ OPTplanFragment(Client cntxt, MalBlkPtr
str msg;
char nme[BUFSIZ];
char *head, *tail; /* oid reference to target table*/
+ oid plantag= OIDnew(1);
plan = GDKzalloc(mb->ssize * sizeof(int));
if( plan == 0)
@@ -483,7 +488,7 @@ OPTplanFragment(Client cntxt, MalBlkPtr
return 0;
}
- snprintf(nme,BUFSIZ,"%s_plan",getFunctionId( getInstrPtr(mb,0)));
+ snprintf(nme,BUFSIZ,"%s_plan"OIDFMT,getFunctionId( getInstrPtr(mb,0)),
plantag);
s = newFunction(userRef, putName(nme, strlen(nme)),FUNCTIONsymbol);
if ( s == NULL)
return 0;
@@ -747,17 +752,17 @@ OPTplanFragment(Client cntxt, MalBlkPtr
#endif
/* construct the remote stub plan */
- smb = OPTplanStub(cntxt, mb, nmb);
+ smb = OPTplanStub(cntxt, mb, nmb, plantag);
msg= optimizeMALBlock(cntxt, smb);
if ( smb)
chkProgram(cntxt->nspace, smb);
#ifdef _DEBUG_OPT_CENTIPEDE_
- mnstr_printf(cntxt->fdout,"#remote plan errors %d %s
\n",smb->errors,msg?msg:"");
+ mnstr_printf(cntxt->fdout,"#stub plan errors %d %s
\n",smb->errors,msg?msg:"");
printFunction(cntxt->fdout, smb, 0, LIST_MAL_STMT);
#endif
/* construct the control plan for local/remote execution */
- cmb = OPTplanCntrl(cntxt,mb,nmb, slices);
+ cmb = OPTplanCntrl(cntxt,mb,nmb, slices, plantag);
msg= optimizeMALBlock(cntxt, cmb);
if ( cmb)
chkProgram(cntxt->nspace, cmb);
diff --git a/monetdb5/optimizer/opt_emptySet.c
b/monetdb5/optimizer/opt_emptySet.c
--- a/monetdb5/optimizer/opt_emptySet.c
+++ b/monetdb5/optimizer/opt_emptySet.c
@@ -106,7 +106,6 @@ ESevaluate(Client cntxt, MalBlkPtr mb, c
{
int i, j, actions = 0;
InstrPtr p;
- str likeRef = putName("like", 4);
str existRef = putName("exist", 5);
str uniqueRef = putName("unique", 6);
str suniqueRef = putName("sunique", 7);
diff --git a/monetdb5/optimizer/opt_joinpath.c
b/monetdb5/optimizer/opt_joinpath.c
--- a/monetdb5/optimizer/opt_joinpath.c
+++ b/monetdb5/optimizer/opt_joinpath.c
@@ -312,18 +312,24 @@ OPTjoinPathImplementation(Client cntxt,
freeInstruction(q);
goto wrapup;
}
-/* Final type check. */
+ /*
+ * @-
+ * Final type check and hardwire the result type,
because that can not be inferred directly from the signature
+ */
for(j=1; j<q->argc-1; j++)
if( getArgType(mb,q,j).type !=
getArgType(mb,q,j+1).type || getArgType(mb,q,j).type != TYPE_oid ){
freeInstruction(q);
goto wrapup;
}
+ /* fix the type */
+ setVarUDFtype(mb, getArg(q,0));
+ setVarType(mb, getArg(q,0), newBatType(
getHeadType(getArgType(mb,q,q->retc)),
getTailType(getArgType(mb,q,q->argc-1))));
if ( q->argc > 3 && getFunctionId(q) == joinRef)
setFunctionId(q,joinPathRef);
else if ( q->argc > 3 && getFunctionId(q) ==
leftjoinRef)
setFunctionId(q,leftjoinPathRef);
- else if ( q->argc > 2 && getFunctionId(q) ==
semijoinRef)
+ else if ( q->argc > 2 && getFunctionId(q) ==
semijoinRef)
setFunctionId(q,semijoinPathRef);
freeInstruction(p);
p= q;
diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c
--- a/monetdb5/optimizer/opt_prelude.c
+++ b/monetdb5/optimizer/opt_prelude.c
@@ -110,6 +110,7 @@ str likeselectRef;
str ilikeselectRef;
str likeuselectRef;
str ilikeuselectRef;
+str likeRef;
str listRef;
str lockRef;
str lookupRef;
@@ -331,6 +332,7 @@ void optimizerInit(void){
likeuselectRef = putName("like_uselect",12);
ilikeuselectRef = putName("ilike_uselect",13);
listRef = putName("list",4);
+ likeRef = putName("like",4);
lockRef = putName("lock",4);
lookupRef = putName("lookup",6);
malRef = putName("mal", 3);
diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h
--- a/monetdb5/optimizer/opt_prelude.h
+++ b/monetdb5/optimizer/opt_prelude.h
@@ -110,6 +110,7 @@ opt_export str ilikeselectRef;
opt_export str likeuselectRef;
opt_export str ilikeuselectRef;
opt_export str listRef;
+opt_export str likeRef;
opt_export str lockRef;
opt_export str lookupRef;
opt_export str malRef;
diff --git a/monetdb5/optimizer/opt_recycler.c
b/monetdb5/optimizer/opt_recycler.c
--- a/monetdb5/optimizer/opt_recycler.c
+++ b/monetdb5/optimizer/opt_recycler.c
@@ -62,19 +62,19 @@
/*
* The variables are all checked for being eligible as a variable
* subject to recycling control. A variable may only be assigned
- * a value once. The function is a sql.bind(-,-,-,0) or all arguments
+ * a value once. The target function is a sql.bind(-,-,-,0) or all arguments
* are already recycle enabled or constant.
- *
- * The arguments of the function cannot be recycled.
+ *
+ * The arguments of a function call cannot be recycled.
* They change with each call. This does not mean
* that the instructions using them can not be a
* target of recycling.
- *
- * Just looking at a kept result target is not good enough.
+ *
+ * Just looking at a target result kept is not good enough.
* You have to sure that the arguments are also the same.
* This rules out function arguments.
- *
- * The recycler is targeted towards a query only database.
+ *
+ * The recycler is targeted towards a read-only database.
* The best effect is obtained for a single-user mode (sql_debug=32 )
* when the delta-bats are not processed which allows longer instruction
* chains to be recycled.
@@ -90,8 +90,8 @@
#include "mal_instruction.h"
#include "opt_statistics.h"
-static lng recycleSeq = 0;
-static bte baseTableMode = 0;
+static lng recycleSeq = 0; /* should become part of MAL block
basics */
+static bte baseTableMode = 0; /* only recycle base tables */
int
OPTrecyclerImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
p)
@@ -107,7 +107,6 @@ OPTrecyclerImplementation(Client cntxt,
(void) cntxt;
(void) stk;
- /* watch out, instructions may introduce new variables */
limit= mb->stop;
old = mb->stmt;
@@ -126,7 +125,8 @@ OPTrecyclerImplementation(Client cntxt,
if ( span == NULL)
return 0;
- recycled= GDKzalloc(sizeof(char)*mb->vtop*2);
+ /* watch out, newly created instructions may introduce new variables */
+ recycled= GDKzalloc(sizeof(char)*mb->vtop * 2);
if ( recycled == NULL)
return 0;
if ( newMalBlkStmt(mb, mb->ssize) < 0){
@@ -172,6 +172,7 @@ OPTrecyclerImplementation(Client cntxt,
actions++;
}
}
+ /* take care of SQL catalog update instructions */
if (getModuleId(p) == sqlRef && getFunctionId(p) ==
catalogRef ){
tp = *(int*) getVarValue(mb,getArg(p,1));
if (tp == 22 || tp == 25) {
@@ -226,14 +227,14 @@ OPTrecyclerImplementation(Client cntxt,
p->recycle = recycleMaxInterest;
marks++;
}
- /* In mode of base table recycling skip marking instructions
other than octopus.bind */
+ /* During base table recycling skip marking instructions other
than octopus.bind */
if( baseTableMode ){
pushInstruction(mb,p);
continue;
}
/* general rule: all arguments are constants or recycled,
- ignore C ponter arguments from mvc*/
+ ignore C pointer arguments from mvc*/
cnt = 0;
for (j=p->retc; j<p->argc; j++)
if( recycled[getArg(p,j)] || isVarConstant(mb,
getArg(p,j)) )
@@ -265,7 +266,7 @@ OPTrecyclerImplementation(Client cntxt,
if(( getFunctionId(p)== selectRef ||
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list