Changeset: a921df054bbb for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a921df054bbb Modified Files: monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h monetdb5/optimizer/opt_xid.c Branch: xid Log Message:
Introduce synchronization points Wait for all arguments to be ready, before // decompresion is started. diffs (83 lines): 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 @@ -198,6 +198,7 @@ str stopRef; str strRef; str sumRef; str sunionRef; +str syncRef; str takeRef; str topn_minRef; str topn_maxRef; @@ -422,6 +423,7 @@ void optimizerInit(void){ strRef = putName("str",3); sumRef = putName("sum",3); sunionRef= putName("sunion",6); + syncRef= putName("sync",4); takeRef= putName("take",5); topn_minRef= putName("topn_min",8); topn_maxRef= putName("topn_max",8); 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 @@ -197,6 +197,7 @@ opt_export str stopRef; opt_export str strRef; opt_export str sumRef; opt_export str sunionRef; +opt_export str syncRef; opt_export str takeRef; opt_export str topn_minRef; opt_export str topn_maxRef; diff --git a/monetdb5/optimizer/opt_xid.c b/monetdb5/optimizer/opt_xid.c --- a/monetdb5/optimizer/opt_xid.c +++ b/monetdb5/optimizer/opt_xid.c @@ -25,9 +25,9 @@ int OPTxidImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { - int type, i, j, se,limit; + int type, i, j, se, limit, v; InstrPtr q, p=0, *old= mb->stmt; - int actions = 0; + int actions = 0, cnt; int *alias; Lifespan span; @@ -60,7 +60,36 @@ OPTxidImplementation(Client cntxt, MalBl } if( p->token == NOOPsymbol) continue; - /* decompress the arguments */ + /* decompress the arguments, it should be done just before they are consumed. + * This calls for waiting for all variables + */ + cnt = 0; + for ( j =p->retc; j< p->argc; j++) + if (alias[getArg(p,j)] ) cnt++; + /* at least one decompress needed */ + if ( cnt ){ + cnt = 0; + for ( j =p->retc; j< p->argc; j++) + if ( isaBatType(getVarType(mb,getArg(p,j))) ) cnt++; + } + cnt = 0; + /* at least two BATs used, synchronise their access */ + if ( cnt >= 2 ){ + q = newStmt(mb,languageRef,syncRef); + q->retc = q->argc = 0; + for ( j =p->retc; j< p->argc; j++) + if ( isaBatType(getVarType(mb, getArg(p,j))) ) { + v = newTmpVariable(mb, getVarType(mb, getArg(p,j))); + q= pushReturn(mb, q, v); + if ( alias[getArg(p,j)]) + q= pushArgument(mb,q, alias[getArg(p,j)]); + else + /* should avoid compressing non-compressed bats todo */ + q= pushArgument(mb, q, getArg(p,j)); + alias[getArg(p,j)] = v; + } + } + for ( j =p->retc; j< p->argc; j++) if ( alias[getArg(p,j)]){ q = newStmt(mb,"xid","decompress"); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list