Changeset: 6e14be232131 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6e14be232131
Modified Files:
monetdb5/optimizer/opt_octopus.c
monetdb5/scheduler/run_octopus.mx
Branch: headless
Log Message:
Merge with default branch.
diffs (169 lines):
diff --git a/monetdb5/optimizer/opt_octopus.c b/monetdb5/optimizer/opt_octopus.c
--- a/monetdb5/optimizer/opt_octopus.c
+++ b/monetdb5/optimizer/opt_octopus.c
@@ -612,9 +612,12 @@
}
/* barrier (go,version):= scheduler.octopus(timeout); */
+ q = newStmt(mb, octopusRef, putName("getVersion",10));
+ setDestVar(q,v2);
+
q = newStmt(mb, schedulerRef, octopusRef);
setArgType(mb, q, 0, TYPE_bit);
- pushReturn(mb, q, v2);
+ /* pushReturn(mb, q, v2);*/
q = pushInt(mb, q, 10);
q->barrier = BARRIERsymbol;
rexit = getArg(q,0);
@@ -639,8 +642,6 @@
q = newAssignment(mb);
q->barrier = EXITsymbol;
getArg(q, 0) = rexit;
- getArg(q, 1) = v2;
- q->retc = q->argc = 2;
GDKfree(wnm);
GDKfree(wvar);
@@ -821,19 +822,18 @@
setVarType(sm,l,getArgType(t,tsig,0));
setVarFixed(sm,l);
setVarFixed(sm,l);
- if ( tsig->retc > 1 ) {
- if ( sm->var[l]->name )
- GDKfree(sm->var[l]->name);
- sm->var[l]->name = GDKstrdup("res0");
- for (i = 1; i < tsig->retc; i++ ){
- snprintf(buf,BUFSIZ,"res%d", i);
- tpe = getArgType(t, tsig,i);
- res[i]= newVariable(sm,GDKstrdup(buf),tpe);
- setVarFixed(sm,res[i]);
- setVarFixed(sm,res[i]);
- q = pushReturn(sm,q,res[i]);
- }
+ if ( sm->var[l]->name )
+ GDKfree(sm->var[l]->name);
+ sm->var[l]->name = GDKstrdup("res0");
+ for (i = 1; i < tsig->retc; i++ ){
+ snprintf(buf,BUFSIZ,"res%d", i);
+ tpe = getArgType(t, tsig,i);
+ res[i]= newVariable(sm,GDKstrdup(buf),tpe);
+ setVarFixed(sm,res[i]);
+ setVarFixed(sm,res[i]);
+ q = pushReturn(sm,q,res[i]);
}
+
dbvar= newVariable(sm,GDKstrdup("dbname"),TYPE_str);
qvar = newVariable(sm,GDKstrdup("query"),TYPE_str);
q= pushArgument(sm,q,dbvar);
@@ -858,8 +858,9 @@
getArg(q, 0) = getArg(sig, i);
}
+ conn = newVariable(sm,GDKstrdup("conn"),TYPE_str);
q = newStmt(sm, octopusRef,connectRef);
- conn= getArg(q,0);
+ getArg(q,0) = conn;
setVarFixed(sm,conn);
setVarFixed(sm,conn);
q = pushArgument(sm, q, dbvar);
@@ -867,7 +868,8 @@
/* x:= remote.put(conn,...) for each argument*/
assert(sig->argc <1024);
for (i= sig->retc+2; i< sig->argc; i++){
- l= newTmpVariable(sm,TYPE_str);
+ snprintf(buf,BUFSIZ,"arg%d", i);
+ l= newVariable(sm,GDKstrdup(buf),TYPE_str);
q= newFcnCall(sm,remoteRef,putRef);
arg[i]= getArg(q,0)= l;
pushArgument(sm,q, conn);
@@ -876,9 +878,10 @@
/* k:= remote.put(conn,kvar) for each result */
for (i = 0; i < sig->retc; i++ ){
+ snprintf(buf,BUFSIZ,"rres%d", i);
+ l= newVariable(sm,GDKstrdup(buf),TYPE_str);
q= newFcnCall(sm,remoteRef,putRef);
- setArgType(sm,q,0,TYPE_str);
- rres[i]= getArg(q,0);
+ rres[i]= getArg(q,0)= l;
q= pushArgument(sm,q,conn);
q= pushArgument(sm,q, getArg(sig,i));
setVarFixed(sm,getArg(q,q->argc-1));
@@ -901,8 +904,9 @@
q= newFcnCall(sm,remoteRef,getRef);
q= pushArgument(sm,q,conn);
q= pushArgument(sm,q,rres[i]);
- lres[i] = getArg(q,0);
- setVarType(sm,lres[i], getArgType(sm,sig,i));
+ snprintf(buf,BUFSIZ,"lres%d", i);
+ l= newVariable(sm,GDKstrdup(buf),getArgType(sm,sig,i));
+ lres[i] = getArg(q,0)= l;
setVarFixed(sm,lres[i]);
setVarFixed(sm,lres[i]);
}
@@ -926,7 +930,7 @@
clrDeclarations(sm);
chkProgram(cntxt->nspace,sm);
OPTDEBUGoctopus{
- /* printFunction(cntxt->fdout, sm, 0,
LIST_MAL_STMT | LIST_MAL_UDF | LIST_MAL_PROPS ); */
+ printFunction(cntxt->fdout, sm, 0,
LIST_MAL_STMT | LIST_MAL_UDF | LIST_MAL_PROPS );
}
}
diff --git a/monetdb5/scheduler/run_octopus.mx
b/monetdb5/scheduler/run_octopus.mx
--- a/monetdb5/scheduler/run_octopus.mx
+++ b/monetdb5/scheduler/run_octopus.mx
@@ -57,9 +57,9 @@
The default is to use the local database as a target.
@{
@mal
-pattern scheduler.octopus(t:int)(:bit,version:int)
+pattern scheduler.octopus(t:int):bit
address OCTOPUSrun
-comment "Run the program block in parallel, but don't wait longer then t
seconds. Also fix a consistent database version.";
+comment "Run the program block in parallel, but don't wait longer than t
seconds. Also fix a consistent database version.";
pattern scheduler.register():bit
address OCTOPUSdiscoverRegister
@@ -73,6 +73,10 @@
address OCTOPUSconnect
comment "Returns the connection to the server dbname.";
+command octopus.getVersion():int
+address OCTOPUSgetVersion
+comment "Returns database version.";
+
pattern scheduler.bidding():bit
address OCTOPUSbidding
comment "Collect bids from workers.";
@@ -88,7 +92,7 @@
#include "mal_instruction.h"
#include "mal_client.h"
-/*#define DEBUG_RUN_OCTOPUS to trace processing */
+ /*#define DEBUG_RUN_OCTOPUS to trace processing */
#ifdef WIN32
#if !defined(LIBMAL) && !defined(LIBATOMS) && !defined(LIBKERNEL) &&
!defined(LIBMAL) && !defined(LIBOPTIMIZER) && !defined(LIBSCHEDULER) &&
!defined(LIBMONETDB5)
@@ -106,6 +110,7 @@
octopus_export str OCTOPUSbidding(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
octopus_export str OCTOPUSmakeSchedule(Client cntxt, MalBlkPtr mb, MalStkPtr
stk, InstrPtr p);
octopus_export str OCTOPUSconnect(str *c, str *dbname);
+octopus_export str OCTOPUSgetVersion(int *res);
#endif /* MAL_RUN_OCTOPUS */
@+ Octopus scheduling implementation
@@ -238,6 +243,13 @@
return msg;
}
+str
+OCTOPUSgetVersion(int *res)
+{
+ *res = 1;
+ return MAL_SUCCEED;
+}
+
static str
OCTOPUSdiscover(Client cntxt){
bat bid = 0;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list