Changeset: c4dd7839c618 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c4dd7839c618 Removed Files: tools/merovingian/daemon/peering.c tools/merovingian/daemon/peering.h Modified Files: clients/Tests/exports.stable.out common/utils/msabaoth.c common/utils/mutils.c common/utils/mutils.h monetdb5/extras/mal_optimizer_template/opt_sql_append.c monetdb5/mal/mal_builder.c monetdb5/mal/mal_function.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_instruction.h monetdb5/mal/mal_parser.c monetdb5/modules/mal/clients.mal monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/orderidx.c monetdb5/optimizer/opt_dataflow.c monetdb5/optimizer/opt_emptybind.c monetdb5/optimizer/opt_factorize.c monetdb5/optimizer/opt_generator.c monetdb5/optimizer/opt_json.c monetdb5/optimizer/opt_matpack.c monetdb5/optimizer/opt_mergetable.c monetdb5/optimizer/opt_mitosis.c monetdb5/optimizer/opt_pushselect.c monetdb5/optimizer/opt_remap.c monetdb5/optimizer/opt_remoteQueries.c monetdb5/optimizer/opt_volcano.c sql/backends/monet5/sql.mal sql/backends/monet5/sql_execute.c sql/backends/monet5/sql_gencode.c sql/scripts/22_clients.sql sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.err sql/test/BugTracker-2016/Tests/set-negative-querytimeout.Bug-6070.stable.out tools/merovingian/client/monetdb.c tools/merovingian/daemon/Makefile.ag tools/merovingian/daemon/client.c tools/merovingian/daemon/controlrunner.c tools/merovingian/daemon/discoveryrunner.h tools/merovingian/daemon/forkmserver.c tools/merovingian/daemon/handlers.c tools/merovingian/daemon/handlers.h tools/merovingian/daemon/merovingian.c tools/merovingian/daemon/multiplex-funnel.c tools/merovingian/daemon/multiplex-funnel.h tools/merovingian/daemon/proxy.c tools/merovingian/utils/control.c tools/merovingian/utils/utils.c Branch: oltp Log Message:
Merge with default diffs (truncated from 2652 to 300 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -2334,7 +2334,7 @@ InstrPtr newExitStmt(MalBlkPtr mb, str n InstrPtr newFcnCall(MalBlkPtr mb, char *mod, char *fcn); Symbol newFunction(str mod, str nme, int kind); MalStkPtr newGlobalStack(int size); -InstrPtr newInstruction(MalBlkPtr mb, int kind); +InstrPtr newInstruction(MalBlkPtr mb, str modnme, str fcnnme); MalBlkPtr newMalBlk(int maxvars, int maxstmts); int newMalBlkStmt(MalBlkPtr mb, int maxstmts); Module newModule(Module scope, str nme); diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c --- a/common/utils/msabaoth.c +++ b/common/utils/msabaoth.c @@ -675,7 +675,7 @@ msab_getSingleStatus(const char *pathbuf (void)fclose(f); } } else if ((snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname, ".gdk_lock") > 0) & /* no typo */ - ((fd = MT_lockf(buf, F_TLOCK, 4, 1)) == -2)) { + ((fd = MT_lockf(buf, F_TEST, 4, 1)) == -2)) { /* Locking failed; this can be because the lockfile couldn't * be created. Probably there is no Mserver running for * that case also. @@ -694,7 +694,7 @@ msab_getSingleStatus(const char *pathbuf } else { /* locking succeed, check for a crash in the uplog */ snprintf(log, sizeof(log), "%s/%s/%s", pathbuf, dbname, UPLOGFILE); - if ((f = fdopen(fd, "r+")) != NULL) { + if ((f = fopen(log, "r")) != NULL) { (void)fseek(f, -1, SEEK_END); if (fread(data, 1, 1, f) != 1) { /* the log is empty, assume no crash */ @@ -704,12 +704,10 @@ msab_getSingleStatus(const char *pathbuf } else { /* should be \t */ sdb->state = SABdbCrashed; } - /* release the lock */ - MT_lockf(buf, F_ULOCK, 4, 1); (void)fclose(f); } else { - /* shouldn't happen */ - close(fd); + /* no uplog, so presumably never started */ + sdb->state = SABdbInactive; } } snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname, MAINTENANCEFILE); diff --git a/common/utils/mutils.c b/common/utils/mutils.c --- a/common/utils/mutils.c +++ b/common/utils/mutils.c @@ -356,6 +356,13 @@ MT_lockf(char *filename, int mode, off_t ret = LockFileEx(fh, LOCKFILE_FAIL_IMMEDIATELY | LOCKFILE_EXCLUSIVE_LOCK, 0, len, 0, &ov); } else if (mode == F_LOCK) { ret = LockFileEx(fh, LOCKFILE_EXCLUSIVE_LOCK, 0, len, 0, &ov); + } else if (mode == F_TEST) { + ret = LockFileEx(fh, LOCKFILE_FAIL_IMMEDIATELY | LOCKFILE_EXCLUSIVE_LOCK, 0, len, 0, &ov); + if (ret != 0) { + UnlockFileEx(fh, 0, len, 0, &ov); + close(fd); + return 0; + } } else { close(fd); errno = EINVAL; @@ -408,6 +415,7 @@ lockf(int fd, int cmd, off_t len) #endif /* returns -1 when locking failed, * returns -2 when the lock file could not be opened/created + * returns 0 when mode is F_TEST and the lock file was not locked * returns the (open) file descriptor to the file when locking * returns 0 when unlocking */ int @@ -420,7 +428,7 @@ MT_lockf(char *filename, int mode, off_t if (lseek(fd, off, SEEK_SET) >= 0 && lockf(fd, mode, len) == 0) { - if (mode == F_ULOCK) { + if (mode == F_ULOCK || mode == F_TEST) { close(fd); return 0; } diff --git a/common/utils/mutils.h b/common/utils/mutils.h --- a/common/utils/mutils.h +++ b/common/utils/mutils.h @@ -56,9 +56,10 @@ mutils_export char *dirname(char *path); #define MONETDB_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) -#define F_TLOCK 2 /* test and lock a region for exclusive use */ -#define F_ULOCK 0 /* unlock a previously locked region */ -#define F_LOCK 1 /* lock a region for exclusive use */ +#define F_TEST 3 /* test a region for other processes locks. */ +#define F_TLOCK 2 /* test and lock a region for exclusive use */ +#define F_ULOCK 0 /* unlock a previously locked region */ +#define F_LOCK 1 /* lock a region for exclusive use */ mutils_export int MT_lockf(char *filename, int mode, off_t off, off_t len); diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c --- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c +++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c @@ -180,10 +180,8 @@ OPTsql_appendImplementation(Client cntxt * setArgType(mb,q1,TYPE_lng) */ /* it will be added to the block and even my * re-use MAL instructions */ - q1 = newInstruction(mb,ASSIGNsymbol); + q1 = newInstruction(mb,aggrRef,countRef); getArg(q1,0) = newTmpVariable(mb, TYPE_lng); - setModuleId(q1, aggrRef); - setFunctionId(q1, countRef); q1 = pushArgument(mb, q1, getArg(p, 5)); pushInstruction(mb, q1); } @@ -191,10 +189,8 @@ OPTsql_appendImplementation(Client cntxt /* push new v2 := algebra.slice( v0, 0, v1 ); */ /* use mal_builder.h primitives * q1 = newStmt(mb, algebraRef,sliceRef); */ - q2 = newInstruction(mb,ASSIGNsymbol); + q2 = newInstruction(mb,algebraRef, sliceRef); getArg(q2,0) = newTmpVariable(mb, TYPE_any); - setModuleId(q2, algebraRef); - setFunctionId(q2, sliceRef); q2 = pushArgument(mb, q2, getArg(p, 5)); q2 = pushLng(mb, q2, 0); q2 = pushArgument(mb, q2, getArg(q1, 0)); diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c --- a/monetdb5/mal/mal_builder.c +++ b/monetdb5/mal/mal_builder.c @@ -23,7 +23,7 @@ InstrPtr newAssignment(MalBlkPtr mb) { - InstrPtr q = newInstruction(mb,ASSIGNsymbol); + InstrPtr q = newInstruction(mb,NULL,NULL); if (q == NULL) return NULL; @@ -42,12 +42,10 @@ newAssignment(MalBlkPtr mb) InstrPtr newStmt(MalBlkPtr mb, const char *module, const char *name) { - InstrPtr q = newInstruction(mb,ASSIGNsymbol); + InstrPtr q = newInstruction(mb, putName(module), putName(name)); if (q == NULL) return NULL; - setModuleId(q, putName(module)); - setFunctionId(q, putName(name)); setDestVar(q, newTmpVariable(mb, TYPE_any)); if (getDestVar(q) < 0) { freeInstruction(q); @@ -64,7 +62,7 @@ newStmt(MalBlkPtr mb, const char *module InstrPtr newReturnStmt(MalBlkPtr mb) { - InstrPtr q = newInstruction(mb,ASSIGNsymbol); + InstrPtr q = newInstruction(mb, NULL,NULL); if (q == NULL) return NULL; @@ -96,11 +94,13 @@ newFcnCall(MalBlkPtr mb, char *mod, char InstrPtr newComment(MalBlkPtr mb, const char *val) { - InstrPtr q = newInstruction(mb, REMsymbol); + InstrPtr q = newInstruction(mb, NULL,NULL); ValRecord cst; if (q == NULL) return NULL; + q->token = REMsymbol; + q->barrier = 0; cst.vtype= TYPE_str; if ((cst.val.sval= GDKstrdup(val)) == NULL) { freeInstruction(q); 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 @@ -33,13 +33,13 @@ Symbol newFunction(str mod, str nme,int return NULL; } - p = newInstruction(NULL,kind); + p = newInstruction(NULL,mod,nme); + p->token = kind; + p->barrier = 0; if (p == NULL) { freeSymbol(s); return NULL; } - setModuleId(p, mod); - setFunctionId(p, nme); setDestVar(p, varid); pushInstruction(s->def,p); return s; diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -401,7 +401,7 @@ prepareMalBlk(MalBlkPtr mb, str s) } InstrPtr -newInstruction(MalBlkPtr mb, int kind) +newInstruction(MalBlkPtr mb, str modnme, str fcnnme) { InstrPtr p = NULL; @@ -423,8 +423,8 @@ newInstruction(MalBlkPtr mb, int kind) p->maxarg = MAXARG; } p->typechk = TYPE_UNKNOWN; - setModuleId(p, NULL); - setFunctionId(p, NULL); + setModuleId(p, modnme); + setFunctionId(p, fcnnme); p->fcn = NULL; p->blk = NULL; p->polymorphic = 0; @@ -435,22 +435,8 @@ newInstruction(MalBlkPtr mb, int kind) p->argv[0] = -1; /* watch out for direct use in variable table */ /* Flow of control instructions are always marked as an assignment * with modifier */ - switch (kind) { - case BARRIERsymbol: - case REDOsymbol: - case LEAVEsymbol: - case EXITsymbol: - case RETURNsymbol: - case YIELDsymbol: - case CATCHsymbol: - case RAISEsymbol: - p->token = ASSIGNsymbol; - p->barrier = kind; - break; - default: - p->token = kind; - p->barrier = 0; - } + p->token = ASSIGNsymbol; + p->barrier = 0; p->gc = 0; p->jump = 0; return p; @@ -1549,7 +1535,9 @@ pushEndInstruction(MalBlkPtr mb) { InstrPtr p; - p = newInstruction(mb, ENDsymbol); + p = newInstruction(mb, NULL, NULL); + p->token = ENDsymbol; + p->barrier = 0; if (!p) { mb->errors++; showException(GDKout, MAL, "pushEndInstruction", "failed to create instruction (out of memory?)"); diff --git a/monetdb5/mal/mal_instruction.h b/monetdb5/mal/mal_instruction.h --- a/monetdb5/mal/mal_instruction.h +++ b/monetdb5/mal/mal_instruction.h @@ -114,7 +114,7 @@ #define getGDKType(T) ( T <= TYPE_str ? T : (T == TYPE_any ? TYPE_void : findGDKtype(T))) -mal_export InstrPtr newInstruction(MalBlkPtr mb, int kind); +mal_export InstrPtr newInstruction(MalBlkPtr mb, str modnme, str fcnnme); mal_export InstrPtr copyInstruction(InstrPtr p); mal_export void oldmoveInstruction(InstrPtr dst, InstrPtr src); mal_export void clrInstruction(InstrPtr p); diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c --- a/monetdb5/mal/mal_parser.c +++ b/monetdb5/mal/mal_parser.c @@ -1513,7 +1513,10 @@ parseAssign(Client cntxt, int cntrl) curPrg = cntxt->curprg; curBlk = curPrg->def; - curInstr = newInstruction(curBlk, cntrl ? cntrl : ASSIGNsymbol); + curInstr = newInstruction(curBlk, NULL, NULL); + + if( cntrl) + curInstr->barrier = cntrl; /* start the parsing by recognition of the lhs of an assignment */ if (currChar(cntxt) == '(') { @@ -1757,7 +1760,9 @@ parseMAL(Client cntxt, Symbol curPrg, in *e = 0; if (! skipcomments && e > start && curBlk->stop > 0 ) { ValRecord cst; - curInstr = newInstruction(curBlk, REMsymbol); + curInstr = newInstruction(curBlk, NULL, NULL); + curInstr->token= REMsymbol; + curInstr->barrier= 0; cst.vtype = TYPE_str; cst.len = (int) strlen(start); cst.val.sval = GDKstrdup(start); diff --git a/monetdb5/modules/mal/clients.mal b/monetdb5/modules/mal/clients.mal --- a/monetdb5/modules/mal/clients.mal +++ b/monetdb5/modules/mal/clients.mal @@ -80,7 +80,7 @@ pattern settimeout(n:lng):void address CLTsetTimeout comment "Abort a query after n seconds."; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list