Changeset: bc927f5eef71 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bc927f5eef71
Removed Files:
        sql/backends/monet5/sql_emptyset.c
        sql/backends/monet5/sql_emptyset.h
Modified Files:
        clients/Tests/exports.stable.out
        clients/mapiclient/Tests/stethoscope--help.stable.err
        monetdb5/mal/mal_dataflow.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_resource.c
        monetdb5/optimizer/opt_aliases.c
        monetdb5/optimizer/opt_costModel.c
        monetdb5/optimizer/opt_inline.c
        monetdb5/optimizer/opt_wrapper.c
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/datacell/basket.c
        sql/backends/monet5/datacell/petrinet.c
        sql/backends/monet5/sql.mx
        sql/backends/monet5/sql_optimizer.c
Branch: default
Log Message:

Merged from Feb2013


diffs (truncated from 983 to 300 lines):

diff --git a/clients/mapiclient/Tests/stethoscope--help.stable.err 
b/clients/mapiclient/Tests/stethoscope--help.stable.err
--- a/clients/mapiclient/Tests/stethoscope--help.stable.err
+++ b/clients/mapiclient/Tests/stethoscope--help.stable.err
@@ -10,10 +10,9 @@ stderr of test 'stethoscope--help` in di
 # 10:36:09 >  Mtimeout -timeout 60 stethoscope --help
 # 10:36:09 >  
 
-stethoscope [options] +[trace options] {<mod>.<fcn>}
+stethoscope [options] [dbname] +[trace options] {<mod>.<fcn>}
   -d | --dbname=<database_name>
   -u | --user=<user>
-  -P | --password=<password>
   -p | --port=<portnr>
   -h | --host=<hostname>
   -? | --help
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -331,8 +331,9 @@ DFLOWworker(void *t)
                        }
                MT_lock_unset(&flow->flowlock, "MALworker");
 
-               MALresourceFairness(flow->cntxt, flow->mb, usec);
                q_enqueue(flow->done, fe);
+               if ( fnxt == 0)
+                       MALresourceFairness(flow->cntxt, flow->mb, usec);
        }
        GDKfree(GDKerrbuf);
        GDKsetbuf(0);
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -694,7 +694,6 @@ setLifespan(MalBlkPtr mb)
        int *blk;
        Lifespan span= newLifespan(mb);
 
-       memset((char*) span,0, sizeof(LifespanRecord)* mb->vtop);
        prop = PropertyIndex("transparent");
 
        blk= (int *) GDKzalloc(sizeof(int)*mb->vtop);
diff --git a/monetdb5/mal/mal_resource.c b/monetdb5/mal/mal_resource.c
--- a/monetdb5/mal/mal_resource.c
+++ b/monetdb5/mal/mal_resource.c
@@ -189,20 +189,20 @@ MALresourceFairness(Client cntxt, MalBlk
        if ( rss < MEMORY_THRESHOLD * monet_memory)
                return;
 
-       clk = GDKusec();
        if ( usec )
                /* worker reporting time spent ! */
-               clk = (clk - usec) / 1000;
+               clk =  usec / 1000;
        else  {
                /* interpreter calling without timing */
                /* punish based on total duration of call */
-               clk = (clk-mb->starttime)/1000;
+               clk = (GDKusec() - mb->starttime)/1000;
                if ( clk <= TIMESLICE) 
                        /* use fake time for penalty */
                        clk = DELAYUNIT;
                }
 
        if ( clk >= DELAYUNIT ) {
+               PARDEBUG mnstr_printf(GDKstdout, "#delay %d initial "LLFMT"n", 
cntxt->idx, clk);
                while (clk > 0) {
                        /* always keep one running to avoid all waiting  */
                        if (running < 2)
diff --git a/monetdb5/optimizer/opt_aliases.c b/monetdb5/optimizer/opt_aliases.c
--- a/monetdb5/optimizer/opt_aliases.c
+++ b/monetdb5/optimizer/opt_aliases.c
@@ -74,7 +74,6 @@ OPTaliasesImplementation(Client cntxt, M
                mb->stmt[i]= NULL;
        mb->stop= k;
        /*
-        * @-
         * The second phase is constant alias replacement should be implemented.
         */
        GDKfree(span);
diff --git a/monetdb5/optimizer/opt_costModel.c 
b/monetdb5/optimizer/opt_costModel.c
--- a/monetdb5/optimizer/opt_costModel.c
+++ b/monetdb5/optimizer/opt_costModel.c
@@ -32,28 +32,6 @@
                varSetProp(mb, getArg(p,Z), rowsProp, op_eq, 
VALset(&v,TYPE_wrd,&k));\
 }
 /*
- * SQL specific back propagation of table size may be needed to avoid
- * the empty-set optimizer to through away a BAT we need.
- */
-static void
-OPTbackpropagate(MalBlkPtr mb, int i, int idx){
-       wrd rows;
-       InstrPtr p;
-
-        rows = getVarRows(mb, idx);
-       if (rows == -1)
-               return;
-       for( ; i > 0; i--){
-               p = getInstrPtr(mb,i);
-               if (getFunctionId(p) == setWriteModeRef){
-                       if (getVarRows(mb, getArg(p,1)) == 0) {
-                               ValRecord v, *vp = VALset(&v, TYPE_wrd, &rows);
-                               varSetProp(mb, getArg(p,1), rowsProp, op_eq, 
vp);
-                       }
-               }
-       }
-}
-/*
  * The cost will be used in many places to make decisions.
  * Access should be fast.
  * The SQL front-end also makes the BAT index available as the
@@ -69,9 +47,6 @@ OPTcostModelImplementation(Client cntxt,
        int i;
        wrd k, c1, c2;
        InstrPtr p;
-       str sortrevRef= putName("sortReverse",11);
-       str sortrevTailRef= putName("sortReverseTail",15);
-       str projectRef= putName("project",7);
 
        (void) cntxt;
        (void) stk;
@@ -83,13 +58,15 @@ OPTcostModelImplementation(Client cntxt,
        for (i = 0; i < mb->stop; i++) {
                p = getInstrPtr(mb, i);
                if (getModuleId(p)==algebraRef) {
-                       if (getFunctionId(p) == markTRef  ||
-                               getFunctionId(p) == markHRef  ||
+                        if (getFunctionId(p) == selectRef ||
+                               getFunctionId(p) == subselectRef ||
+                               getFunctionId(p) == thetaselectRef ||
+                               getFunctionId(p) == thetasubselectRef) {
+                               newRows(1,1, (c1 > 100 ? c1 / 2 +1: c1),0);
+                       } else if (
                                getFunctionId(p) == selectNotNilRef  ||
                                getFunctionId(p) == sortRef  ||
-                               getFunctionId(p) == sortTailRef  ||
-                               getFunctionId(p) == sortrevRef  ||
-                               getFunctionId(p) == sortrevTailRef  ||
+                               getFunctionId(p) == subsortRef  ||
                                getFunctionId(p) == projectRef  ){
                                newRows(1,1,c1,0);
                        } else if(getFunctionId(p) == unionRef ||
@@ -98,21 +75,22 @@ OPTcostModelImplementation(Client cntxt,
                        } else if (getFunctionId(p)== kdifferenceRef) {
                                newRows(1,2,(c1==0?0:c2==0?c1: c1 - c2 < 0 ? 1 
: c1 - c2+1),0);
                        } else if (getFunctionId(p) == joinRef ||
+                               getFunctionId(p) == leftfetchjoinRef ||
                                getFunctionId(p) == leftjoinRef ||
+                               getFunctionId(p) == bandjoinRef ||
+                               getFunctionId(p) == leftfetchjoinPathRef ||
                                getFunctionId(p) == leftjoinPathRef ) {
                                /* assume 1-1 joins */
                                newRows(1,2,(c1 < c2 ? c1 : c2),0);
-                       } else if (getFunctionId(p) == semijoinRef ) {
+                       } else if (getFunctionId(p) == semijoinRef ||
+                                               getFunctionId(p) == 
semijoinPathRef) {
                                /* assume 1-1 semijoins */
                                newRows(1,2,(c1 < c2? c1 : c2),0);
-                       } else if (getFunctionId(p) == selectRef ||
-                               getFunctionId(p) == uselectRef ||
-                               getFunctionId(p) == thetaselectRef ||
-                               getFunctionId(p) == thetauselectRef) {
-                               newRows(1,1, (c1 > 100 ? c1 / 2 +1: c1),0);
-                       } else if (getFunctionId(p) == crossRef) {
+                       } else
+                       if (getFunctionId(p) == crossRef) {
                                newRows(1,2,((log((double) c1) + log((double) 
c2) > log(INT_MAX) ? INT_MAX : c1 * c2 +1)),0);
-                       } else if (getFunctionId(p) == tuniqueRef ) {
+                       } else
+                       if (getFunctionId(p) == tuniqueRef ) {
                                newRows(1,1,( c1 < 50 ? c1 : c1 / 10+1),0);
                        }
                } else if (getModuleId(p) == batcalcRef) {
@@ -131,7 +109,6 @@ OPTcostModelImplementation(Client cntxt,
                                newRows(1,1, c1,0);
                } else if (getModuleId(p) == batRef) {
                        if (getFunctionId(p) == reverseRef ||
-                           getFunctionId(p) == setWriteModeRef  ||
                            getFunctionId(p) == hashRef  ||
                            getFunctionId(p) == mirrorRef) {
                                newRows(1,1, c1,0);
@@ -153,29 +130,23 @@ OPTcostModelImplementation(Client cntxt,
                                if( isaBatType(getArgType(mb,p,2)) ){
                                        /* insert BAT */
                                        newRows(1,2, (c1 + c2+1),1);
-                                       OPTbackpropagate(mb,i,getArg(p,1));
                                } else {
                                        /* insert scalars */
                                        newRows(1,1, (c1 +1),1);
-                                       OPTbackpropagate(mb,i,getArg(p,1));
                                }
                        } else if (getFunctionId(p) == deleteRef){
                                if( isaBatType(getArgType(mb,p,2)) ){
                                        /* delete BAT */
                                        newRows(1,2, (c1 - c2 ==0? 1: c1-c2),1);
-                                       OPTbackpropagate(mb,i,getArg(p,1));
                                } else {
                                        /* insert scalars */
                                        newRows(1,1, (c1==1?1: c1-1),1);
-                                       OPTbackpropagate(mb,i,getArg(p,1));
                                }
-                               OPTbackpropagate(mb,i,getArg(p,1));
                        } else if (getFunctionId(p) == insertRef){
                                newRows(1,1,( c1 + 1),0); /* faked */
-                               OPTbackpropagate(mb,i,getArg(p,1));
                        }
                } else if (getModuleId(p)==groupRef) {
-                       if (getFunctionId(p) ==newRef) {
+                       if (getFunctionId(p) ==subgroupRef ) {
                                newRows(1,1,( c1 / 10+1),0);
                        } else {
                                newRows(1,1, c1,0);
diff --git a/monetdb5/optimizer/opt_inline.c b/monetdb5/optimizer/opt_inline.c
--- a/monetdb5/optimizer/opt_inline.c
+++ b/monetdb5/optimizer/opt_inline.c
@@ -45,23 +45,18 @@ OPTinlineImplementation(Client cntxt, Ma
        int actions = 0;
 
        (void) p;
+       (void)stk;
 
        for (i = 1; i < mb->stop; i++) {
                q = getInstrPtr(mb, i);
                if( q->blk ){
                        sig = getInstrPtr(q->blk,0);
                        /*
-                        * @-
                         * Time for inlining functions that are used in 
multiplex operations.
                         * They are produced by SQL compiler.
                         */
-                       OPTDEBUGinline {
-                               mnstr_printf(cntxt->fdout,"#check inline 
statement\n");
-                               
printInstruction(cntxt->fdout,mb,0,q,LIST_MAL_ALL);
-                               
printInstruction(cntxt->fdout,q->blk,0,sig,LIST_MAL_ALL);
-                       }
-                       if( getModuleId(q) == malRef &&
-                               getFunctionId(q)== multiplexRef &&
+                       if( getFunctionId(q)== multiplexRef &&
+                               getModuleId(q) == malRef &&
                                OPTinlineMultiplex(cntxt,mb,q)){
 
                                OPTDEBUGinline {
@@ -72,7 +67,6 @@ OPTinlineImplementation(Client cntxt, Ma
                            varSetProp(mb, getArg(q,0), inlineProp, op_eq, 
NULL);
                        } else
                        /*
-                        * @-
                         * Check if the function definition is tagged as being 
inlined.
                         */
                        if (sig->token == FUNCTIONsymbol &&
@@ -84,10 +78,10 @@ OPTinlineImplementation(Client cntxt, Ma
                                OPTDEBUGinline {
                                        mnstr_printf(cntxt->fdout,"#inline 
function at %d\n",i);
                                        printFunction(cntxt->fdout, mb, 0, 
LIST_MAL_ALL);
+                                       
printInstruction(cntxt->fdout,q->blk,0,sig,LIST_MAL_ALL);
                                }
                        } else 
                        /*
-                        * @-
                         * Check if the local call is tagged as being inlined.
                         */
                        if (varGetProp(mb, getArg(q,0), inlineProp) != NULL) {
@@ -97,14 +91,11 @@ OPTinlineImplementation(Client cntxt, Ma
                                OPTDEBUGinline {
                                        mnstr_printf(cntxt->fdout,"#inlined 
called at %d\n",i);
                                        printFunction(cntxt->fdout, mb, 0, 
LIST_MAL_ALL);
+                                       
printInstruction(cntxt->fdout,q->blk,0,sig,LIST_MAL_ALL);
                                }
                        } 
                }
        }
-       (void)stk;
-       OPTDEBUGinline
-               mnstr_printf(cntxt->fdout,"#mal program: %d MAL instr %d vars 
(" SZFMT " K)\n",mb->stop,mb->vtop, 
-               ((sizeof( MalBlkRecord) +mb->ssize * sizeof(InstrRecord)+ 
mb->vtop* sizeof(VarRecord) + mb->vsize*sizeof(VarPtr)+1023)/1024));
        return actions;
 }
 
diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c
--- a/monetdb5/optimizer/opt_wrapper.c
+++ b/monetdb5/optimizer/opt_wrapper.c
@@ -183,7 +183,7 @@ str OPTwrapper (Client cntxt, MalBlkPtr 
                printFunction(cntxt->fdout,mb,0,LIST_MAL_STMT | LIST_MAPI);
        }
        DEBUGoptimizers
-               mnstr_printf(cntxt->fdout,"#optimizer %-11s %3d actions %5d MAL 
instructions (%3ld K) " LLFMT" ms\n", optimizer, actions, mb->stop, 
+               mnstr_printf(cntxt->fdout,"#optimizer %-11s %3d actions %5d MAL 
instructions ("SZFMT" K) " LLFMT" usec\n", optimizer, actions, mb->stop, 
                ((sizeof( MalBlkRecord) +mb->ssize * sizeof(InstrRecord)+ 
mb->vtop * sizeof(int) /* argv estimate */ +mb->vtop* sizeof(VarRecord) + 
mb->vsize*sizeof(VarPtr)+1023)/1024),
                t);
        QOTupdateStatistics(getModuleId(q),actions,t);
diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag
+++ b/sql/backends/monet5/Makefile.ag
@@ -44,8 +44,7 @@ lib__sql = {
                sql_gencode.c sql_gencode.h \
                sql_optimizer.c sql_optimizer.h \
                sql_result.c sql_result.h \
-               sql_readline.c sql_readline.h \
-               sql_emptyset.c sql_emptyset.h
+               sql_readline.c sql_readline.h 
        LIBS = ../../server/libsqlserver \
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to