Changeset: c5759252a332 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c5759252a332 Added Files: sql/test/BugTracker-2017/Tests/All sql/test/BugTracker-2017/Tests/avggroupbysq.Bug-6178.sql sql/test/BugTracker-2017/Tests/avggroupbysq.Bug-6178.stable.err sql/test/BugTracker-2017/Tests/avggroupbysq.Bug-6178.stable.out sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.sql sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.stable.err sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.stable.out Modified Files: gdk/gdk_aggr.c gdk/gdk_interprocess.c gdk/gdk_interprocess.h monetdb5/mal/mal_debugger.c monetdb5/mal/mal_interpreter.c monetdb5/modules/mal/clients.c monetdb5/optimizer/opt_mergetable.c sql/backends/monet5/UDF/pyapi/connection.c sql/backends/monet5/UDF/pyapi/conversion.c sql/backends/monet5/UDF/pyapi/conversion.h sql/backends/monet5/UDF/pyapi/emit.c sql/backends/monet5/UDF/pyapi/formatinput.c sql/backends/monet5/UDF/pyapi/pyapi.c sql/backends/monet5/UDF/pyapi/pyapi.h sql/backends/monet5/UDF/pyapi/pyheader.h sql/backends/monet5/UDF/pyapi/pyloader.c sql/backends/monet5/UDF/pyapi/pytypes.c sql/backends/monet5/UDF/pyapi/type_conversion.c sql/backends/monet5/UDF/pyapi/unicode.c sql/backends/monet5/rel_bin.c sql/server/rel_optimizer.c sql/server/rel_psm.c sql/server/sql_parser.y testing/Mtest.py.in tools/mserver/shutdowntest.c Branch: batcalc-candidates Log Message:
Merge with default branch. diffs (truncated from 897 to 300 lines): diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -1386,7 +1386,8 @@ BATgroupavg(BAT **bnp, BAT **cntsp, BAT return GDK_SUCCEED; } - if ((e == NULL || + if ((!skip_nils || cntsp == NULL || b->tnonil) && + (e == NULL || (BATcount(e) == BATcount(b) && e->hseqbase == b->hseqbase)) && (BATtdense(g) || (g->tkey && g->tnonil))) { /* trivial: singleton groups, so all results are equal diff --git a/gdk/gdk_interprocess.c b/gdk/gdk_interprocess.c --- a/gdk/gdk_interprocess.c +++ b/gdk/gdk_interprocess.c @@ -6,10 +6,11 @@ * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. */ -#include "gdk_interprocess.h" +#include "monetdb_config.h" #ifdef HAVE_FORK +#include "gdk_interprocess.h" #include "gdk.h" #include "gdk_private.h" diff --git a/gdk/gdk_interprocess.h b/gdk/gdk_interprocess.h --- a/gdk/gdk_interprocess.h +++ b/gdk/gdk_interprocess.h @@ -14,8 +14,6 @@ #ifndef _GDK_INTERPROCES_H_ #define _GDK_INTERPROCES_H_ -#include "monetdb_config.h" - #ifdef HAVE_FORK #include "gdk.h" diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c --- a/monetdb5/mal/mal_debugger.c +++ b/monetdb5/mal/mal_debugger.c @@ -66,11 +66,12 @@ mdbInit(void) /* * Each client has its own breakpoint administration, kept in a * global table. Although a little space consumptive, it is the - * easiest to maintain and much less expensive as reserving debugger - * space in each instruction. + * easiest to maintain and much less expensive than reserving + * debugger space in each instruction. */ - mdbTable = GDKzalloc(sizeof(mdbStateRecord) * MAL_MAXCLIENTS); - if (mdbTable == NULL) { + if (mdbTable) + memset(mdbTable, 0, sizeof(mdbStateRecord) * MAL_MAXCLIENTS); + else if ((mdbTable = GDKzalloc(sizeof(mdbStateRecord) * MAL_MAXCLIENTS)) == NULL) { showException(GDKout,MAL, "mdbInit",MAL_MALLOC_FAIL); return -1; } diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -486,7 +486,7 @@ str runMALsequence(Client cntxt, MalBlkP if (startpc+1 == stoppc) { pci = getInstrPtr(mb, startpc); if (pci->argc > 16) { - backup = GDKzalloc(pci->argc * sizeof(ValRecord)); + backup = GDKmalloc(pci->argc * sizeof(ValRecord)); if( backup == NULL) throw(MAL, "mal.interpreter", MAL_MALLOC_FAIL); garbage = (int*)GDKzalloc(pci->argc * sizeof(int)); @@ -500,7 +500,7 @@ str runMALsequence(Client cntxt, MalBlkP memset(garbages, 0, sizeof(garbages)); } } else if ( mb->maxarg > 16 ){ - backup = GDKzalloc(mb->maxarg * sizeof(ValRecord)); + backup = GDKmalloc(mb->maxarg * sizeof(ValRecord)); if( backup == NULL) throw(MAL, "mal.interpreter", MAL_MALLOC_FAIL); garbage = (int*)GDKzalloc(mb->maxarg * sizeof(int)); @@ -588,25 +588,16 @@ str runMALsequence(Client cntxt, MalBlkP * garbage collected are identified. In the post-execution * phase they are removed. */ + for (i = 0; i < pci->retc; i++) + backup[i] = stk->stk[getArg(pci, i)]; + if (garbageControl(pci)) { for (i = 0; i < pci->argc; i++) { int a = getArg(pci, i); - backup[i].vtype = 0; - backup[i].len = 0; - backup[i].val.pval = 0; garbage[i] = -1; if (stk->stk[a].vtype == TYPE_bat && getEndScope(mb, a) == stkpc && isNotUsedIn(pci, i + 1, a)) garbage[i] = a; - - if (i < pci->retc && stk->stk[a].vtype == TYPE_bat) { - backup[i] = stk->stk[a]; - } else if (i < pci->retc && - 0 < stk->stk[a].vtype && - stk->stk[a].vtype < TYPE_any && - ATOMextern(stk->stk[a].vtype)) { - backup[i] = stk->stk[a]; - } } } @@ -812,6 +803,16 @@ str runMALsequence(Client cntxt, MalBlkP runtimeProfileFinish(cntxt, mb); /* check for strong debugging after each MAL statement */ if ( pci->token != FACcall && ret== MAL_SUCCEED) { + for (i = 0; i < pci->retc; i++) { + lhs = &backup[i]; + if (BATatoms[lhs->vtype].atomUnfix) + (*BATatoms[lhs->vtype].atomUnfix)(VALget(lhs)); + if (ATOMextern(lhs->vtype) && + lhs->val.pval && + lhs->val.pval != ATOMnilptr(lhs->vtype) && + lhs->val.pval != stk->stk[getArg(pci, i)].val.pval) + GDKfree(lhs->val.pval); + } if (GDKdebug & (CHECKMASK|PROPMASK) && exceptionVar < 0) { BAT *b; @@ -841,28 +842,12 @@ str runMALsequence(Client cntxt, MalBlkP if (isaBatType(getArgType(mb, pci, i))) { bat bid = stk->stk[a].val.bval; - if (i < pci->retc && backup[i].val.bval != bat_nil) { - bat bx = backup[i].val.bval; - backup[i].val.bval = bat_nil; - BBPrelease(bx); - } if (garbage[i] >= 0) { PARDEBUG mnstr_printf(GDKstdout, "#GC pc=%d bid=%d %s done\n", stkpc, bid, getVarName(mb, garbage[i])); bid = stk->stk[garbage[i]].val.bval; stk->stk[garbage[i]].val.bval = bat_nil; BBPrelease(bid); } - } else if (i < pci->retc && - 0 < stk->stk[a].vtype && - stk->stk[a].vtype < TYPE_any && - ATOMextern(stk->stk[a].vtype)) { - if (backup[i].val.pval && - backup[i].val.pval != stk->stk[a].val.pval) { - if (backup[i].val.pval) - GDKfree(backup[i].val.pval); - backup[i].len = 0; - backup[i].val.pval = 0; - } } } } diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c --- a/monetdb5/modules/mal/clients.c +++ b/monetdb5/modules/mal/clients.c @@ -540,7 +540,7 @@ str CLTgetUsers(Client cntxt, MalBlkPtr str CLTshutdown(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { str *ret = getArgReference_str(stk,pci,0); - int delay = *getArgReference_int(stk,pci,1); + int delay; bit force = FALSE; int leftover; char buf[1024]={"safe to stop last connection"}; @@ -551,11 +551,14 @@ CLTshutdown(Client cntxt, MalBlkPtr mb, (void) mb; switch( getArgType(mb,pci,1)){ case TYPE_bte: + delay = *getArgReference_bte(stk,pci,1); + break; case TYPE_sht: delay = *getArgReference_sht(stk,pci,1); break; default: delay = *getArgReference_int(stk,pci,1); + break; } if ( cntxt->user != mal_clients[0].user) diff --git a/monetdb5/optimizer/opt_mergetable.c b/monetdb5/optimizer/opt_mergetable.c --- a/monetdb5/optimizer/opt_mergetable.c +++ b/monetdb5/optimizer/opt_mergetable.c @@ -1045,10 +1045,7 @@ mat_group_aggr(MalBlkPtr mb, InstrPtr p, ai2 = pushArgument(mb, ai2, getArg(ai1, 0)); ai2 = pushArgument(mb, ai2, mat[g].mv); ai2 = pushArgument(mb, ai2, mat[e].mv); - if (isAvg) - ai2 = pushBit(mb, ai2, 0); /* do not skip nils */ - else - ai2 = pushBit(mb, ai2, 1); /* skip nils */ + ai2 = pushBit(mb, ai2, 1); /* skip nils */ if (getFunctionId(p) != subminRef && getFunctionId(p) != submaxRef) ai2 = pushBit(mb, ai2, 1); pushInstruction(mb, ai2); diff --git a/sql/backends/monet5/UDF/pyapi/connection.c b/sql/backends/monet5/UDF/pyapi/connection.c --- a/sql/backends/monet5/UDF/pyapi/connection.c +++ b/sql/backends/monet5/UDF/pyapi/connection.c @@ -6,6 +6,7 @@ * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. */ +#include "monetdb_config.h" #include "pyapi.h" #include "conversion.h" #include "connection.h" diff --git a/sql/backends/monet5/UDF/pyapi/conversion.c b/sql/backends/monet5/UDF/pyapi/conversion.c --- a/sql/backends/monet5/UDF/pyapi/conversion.c +++ b/sql/backends/monet5/UDF/pyapi/conversion.c @@ -1,4 +1,12 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. + */ +#include "monetdb_config.h" #include "conversion.h" #include "convert_loops.h" #include "pytypes.h" diff --git a/sql/backends/monet5/UDF/pyapi/conversion.h b/sql/backends/monet5/UDF/pyapi/conversion.h --- a/sql/backends/monet5/UDF/pyapi/conversion.h +++ b/sql/backends/monet5/UDF/pyapi/conversion.h @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * - * Copyright 2008-2015 MonetDB B.V. + * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. */ /* diff --git a/sql/backends/monet5/UDF/pyapi/emit.c b/sql/backends/monet5/UDF/pyapi/emit.c --- a/sql/backends/monet5/UDF/pyapi/emit.c +++ b/sql/backends/monet5/UDF/pyapi/emit.c @@ -6,6 +6,7 @@ * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. */ +#include "monetdb_config.h" #include "emit.h" #include "conversion.h" #include "convert_loops.h" diff --git a/sql/backends/monet5/UDF/pyapi/formatinput.c b/sql/backends/monet5/UDF/pyapi/formatinput.c --- a/sql/backends/monet5/UDF/pyapi/formatinput.c +++ b/sql/backends/monet5/UDF/pyapi/formatinput.c @@ -6,6 +6,7 @@ * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. */ +#include "monetdb_config.h" #include "formatinput.h" #include "type_conversion.h" diff --git a/sql/backends/monet5/UDF/pyapi/pyapi.c b/sql/backends/monet5/UDF/pyapi/pyapi.c --- a/sql/backends/monet5/UDF/pyapi/pyapi.c +++ b/sql/backends/monet5/UDF/pyapi/pyapi.c @@ -6,6 +6,7 @@ * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. */ +#include "monetdb_config.h" #include "pyapi.h" #include "connection.h" diff --git a/sql/backends/monet5/UDF/pyapi/pyheader.h b/sql/backends/monet5/UDF/pyapi/pyheader.h --- a/sql/backends/monet5/UDF/pyapi/pyheader.h +++ b/sql/backends/monet5/UDF/pyapi/pyheader.h @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * - * Copyright 2008-2015 MonetDB B.V. + * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. */ /* @@ -16,7 +16,6 @@ #ifndef _PYHEADER_H_ #define _PYHEADER_H_ -#include "monetdb_config.h" #include "mal.h" #include "mal_stack.h" #include "mal_linker.h" diff --git a/sql/backends/monet5/UDF/pyapi/pyloader.c b/sql/backends/monet5/UDF/pyapi/pyloader.c --- a/sql/backends/monet5/UDF/pyapi/pyloader.c +++ b/sql/backends/monet5/UDF/pyapi/pyloader.c @@ -6,6 +6,7 @@ * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. */ +#include "monetdb_config.h" #include "pyapi.h" _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list