Changeset: 20e02dc22f1d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=20e02dc22f1d
Modified Files:
        monetdb5/mal/mal_recycle.c
        monetdb5/optimizer/opt_centipede.mx
        monetdb5/optimizer/opt_emptySet.mx
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        monetdb5/optimizer/opt_recycler.mx
Branch: default
Log Message:

Prepare centipede for recycler


diffs (175 lines):

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
@@ -233,11 +233,11 @@ static void extendQPat(void)
        QryStatPtr *old;
 
        if (recycleQPat == NULL)
-               RECYCLEinitQPat(20);
+               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/optimizer/opt_centipede.mx 
b/monetdb5/optimizer/opt_centipede.mx
--- a/monetdb5/optimizer/opt_centipede.mx
+++ b/monetdb5/optimizer/opt_centipede.mx
@@ -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;
 }
diff --git a/monetdb5/optimizer/opt_emptySet.mx 
b/monetdb5/optimizer/opt_emptySet.mx
--- a/monetdb5/optimizer/opt_emptySet.mx
+++ b/monetdb5/optimizer/opt_emptySet.mx
@@ -129,7 +129,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_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.mx 
b/monetdb5/optimizer/opt_recycler.mx
--- a/monetdb5/optimizer/opt_recycler.mx
+++ b/monetdb5/optimizer/opt_recycler.mx
@@ -88,19 +88,19 @@ comment "Recycler marking and code injec
  * @-
  * 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.
@@ -114,8 +114,8 @@ comment "Recycler marking and code injec
 #include "opt_recycler.h"
 #include "mal_instruction.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 */
 
 static int
 OPTrecycleImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
@@ -131,7 +131,6 @@ OPTrecycleImplementation(Client cntxt, M
        (void) cntxt;
        (void) stk;
 
-       /* watch out, instructions may introduce new variables */
        limit= mb->stop;
        old = mb->stmt;
 
@@ -150,7 +149,8 @@ OPTrecycleImplementation(Client cntxt, M
        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){
@@ -198,6 +198,7 @@ OPTrecycleImplementation(Client cntxt, M
                                        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) {
@@ -252,14 +253,14 @@ OPTrecycleImplementation(Client cntxt, M
                                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))
@@ -292,7 +293,7 @@ OPTrecycleImplementation(Client cntxt, M
                if(( getFunctionId(p)== selectRef || 
                     getFunctionId(p)== antiuselectRef ||
                     getFunctionId(p)== likeselectRef ||
-                    getFunctionId(p)== putName("like",4) || 
+                    getFunctionId(p)== likeRef || 
                 getFunctionId(p)== thetaselectRef ) &&
                 recycled[getArg(p,1)] ){
                        p->recycle = recycleMaxInterest;
@@ -353,7 +354,7 @@ OPTrecycleImplementation(Client cntxt, M
  * @-
  * The sql.bind instructions should be handled carefully
  * The delete and update BATs should not be recycled,
- * because they may lead to view dependencies that later interfere
+ * because they may lead to view dependencies that later interferes
  * with the transaction commits.
  */
 /* enable recycling of delta-bats
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to