MonetDB: Jul2017 - More locking.
Changeset: 7ee643fa6a83 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ee643fa6a83 Modified Files: gdk/gdk_hash.c Branch: Jul2017 Log Message: More locking. diffs (16 lines): diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c --- a/gdk/gdk_hash.c +++ b/gdk/gdk_hash.c @@ -567,8 +567,11 @@ void HASHdestroy(BAT *b) { if (b) { - Hash *hs = b->thash; + Hash *hs; + MT_lock_set(&GDKhashLock(b->batCacheid)); + hs = b->thash; b->thash = NULL; + MT_lock_unset(&GDKhashLock(b->batCacheid)); if (hs == (Hash *) 1) { GDKunlink(BBPselectfarm(b->batRole, b->ttype, hashheap), BATDIR, ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2017 - Don't redefine isnan/isinf.
Changeset: 25b47b5e79b2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=25b47b5e79b2 Modified Files: gdk/gdk_aggr.c Branch: Jul2017 Log Message: Don't redefine isnan/isinf. diffs (17 lines): diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -152,9 +152,13 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e, /* sum */ #if defined(_MSC_VER) && _MSC_VER < 1800 +#ifndef isnan #define isnan(x) _isnan(x) +#endif +#ifndef isinf #define isinf(x) (_fpclass(x) & (_FPCLASS_NINF | _FPCLASS_PINF)) #endif +#endif static inline int samesign(double x, double y) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with Jul2017 branch.
Changeset: e33575e904c6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e33575e904c6 Added Files: sql/test/Tests/fsum1.sql.src sql/test/Tests/fsum1.stable.err.src sql/test/Tests/fsum1.stable.out.src sql/test/mergetables/Tests/sqlsmith.Bug-6451.sql sql/test/mergetables/Tests/sqlsmith.Bug-6451.stable.err sql/test/mergetables/Tests/sqlsmith.Bug-6451.stable.out sql/test/mergetables/Tests/sqlsmith.Bug-6453.sql sql/test/mergetables/Tests/sqlsmith.Bug-6453.stable.err sql/test/mergetables/Tests/sqlsmith.Bug-6453.stable.out sql/test/mergetables/Tests/sqlsmith.Bug-6455.sql sql/test/mergetables/Tests/sqlsmith.Bug-6455.stable.err sql/test/mergetables/Tests/sqlsmith.Bug-6455.stable.out Modified Files: gdk/gdk_aggr.c gdk/gdk_group.c gdk/gdk_hash.c gdk/gdk_orderidx.c sql/server/rel_dump.c sql/server/rel_optimizer.c sql/server/rel_rel.c sql/server/rel_select.c sql/test/Tests/All sql/test/mergetables/Tests/All Branch: default Log Message: Merge with Jul2017 branch. diffs (truncated from 1048 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 @@ -152,9 +152,13 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e, /* sum */ #if defined(_MSC_VER) && _MSC_VER < 1800 +#ifndef isnan #define isnan(x) _isnan(x) +#endif +#ifndef isinf #define isinf(x) (_fpclass(x) & (_FPCLASS_NINF | _FPCLASS_PINF)) #endif +#endif static inline int samesign(double x, double y) @@ -186,6 +190,7 @@ exchange(double *x, double *y) *y = t; } +/* this function was adapted from https://bugs.python.org/file10357/msum4.py */ static BUN dofsum(const void *restrict values, oid seqb, BUN start, BUN end, void *restrict results, BUN ngrp, int tp1, int tp2, diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c --- a/gdk/gdk_group.c +++ b/gdk/gdk_group.c @@ -88,7 +88,7 @@ } \ } \ if (extents)\ - exts[ngrp] = hseqb + p; \ + exts[ngrp] = hseqb + p - lo;\ if (histo) \ cnts[ngrp] = 1; \ ngrps[r] = ngrp++; \ @@ -545,6 +545,7 @@ BATgroup_internal(BAT **groups, BAT **ex bat parent; #endif BUN start, end, cnt; + BUN lo = 0; const oid *restrict cand, *candend; oid maxgrp = oid_nil; /* maximum value of g BAT (if subgrouping) */ PROPrec *prop; @@ -1006,8 +1007,6 @@ BATgroup_internal(BAT **groups, BAT **ex BATcheckhash(BBPdescriptor(parent))) #endif ) { - BUN lo; - /* we already have a hash table on b, or b is * persistent and we could create a hash table, or b * is a view on a bat that already has a hash table */ @@ -1034,11 +1033,8 @@ BATgroup_internal(BAT **groups, BAT **ex bi = bat_iterator(b); start += lo; end += lo; - } else + } #endif - { - lo = 0; - } hs = b->thash; gn->tsorted = 1; /* be optimistic */ diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c --- a/gdk/gdk_hash.c +++ b/gdk/gdk_hash.c @@ -273,44 +273,42 @@ BATcheckhash(BAT *b) } #ifdef PERSISTENTHASH -struct hashsync { - Heap *hp; - bat id; -}; - static void BAThashsync(void *arg) { - struct hashsync *hs = arg; - Heap *hp = hs->hp; + BAT *b = arg; + Heap *hp; int fd; lng t0 = 0; const char *failed = " failed"; ALGODEBUG t0 = GDKusec(); - if (HEAPsave(hp, hp->filename, NULL) == GDK_SUCCEED && - (fd = GDKfdlocate(hp->farmid, hp->filename, "rb+", NULL)) >= 0) { - ((size_t *) hp->base)[0] |= 1 << 24; - if (write(fd, hp->base, SIZEOF_SIZE_T) >= 0) { - failed = ""; /* not failed */ - if (!(GDKdebug & FORCEMITOMASK)) { + MT_lock_set(&GDKhashLock(b->batCacheid)); + if (b->thash != NULL && (hp = b->thash->heap) != NULL) { + if (HEAPsave(hp, hp->filename, NULL) == GDK_SUCCEED && + (fd = GDKfdlocate(hp->farmid, hp->filename, "rb+", NULL)) >= 0) { + ((size_t *) hp->base)[0] |= 1 << 24; + if (write(fd, hp->base, SIZEOF_SIZE_T) >= 0) { + failed = ""; /* not failed */ +
MonetDB: trails - Merge with default
Changeset: 91f4aba5c936 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=91f4aba5c936 Added Files: sql/test/BugTracker-2009/Tests/AVG_of_SQRT.SF-2757642.sql sql/test/BugTracker-2017/Tests/insert_into_multiple_subqueries.Bug-6448.sql sql/test/BugTracker-2017/Tests/insert_into_multiple_subqueries.Bug-6448.stable.err sql/test/BugTracker-2017/Tests/insert_into_multiple_subqueries.Bug-6448.stable.out sql/test/BugTracker-2017/Tests/sqlitelogictest-cast-decimal.Bug-6445.stable.err sql/test/BugTracker-2017/Tests/sqlitelogictest-cast-decimal.Bug-6445.stable.out sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6449.sql sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6449.stable.err sql/test/BugTracker-2017/Tests/sqlsmith.Bug-6449.stable.out sql/test/BugTracker-2017/Tests/table_returning_with.Bug-6444.sql sql/test/BugTracker-2017/Tests/table_returning_with.Bug-6444.stable.err sql/test/BugTracker-2017/Tests/table_returning_with.Bug-6444.stable.out sql/test/Tests/fsum.sql sql/test/Tests/fsum.stable.err sql/test/Tests/fsum.stable.out Removed Files: sql/test/BugTracker-2009/Tests/AVG_of_SQRT.SF-2757642.SQL.py Modified Files: gdk/ChangeLog.Jul2017 gdk/gdk_aggr.c gdk/gdk_utils.c monetdb5/mal/mal_parser.c sql/backends/monet5/sql_gencode.c sql/server/rel_optimizer.c sql/server/rel_select.c sql/server/rel_sequence.c sql/server/rel_updates.c sql/server/sql_parser.h sql/server/sql_parser.y sql/server/sql_privileges.c sql/server/sql_scan.c sql/test/BugTracker-2009/Tests/AVG_of_SQRT.SF-2757642.stable.out sql/test/BugTracker-2017/Tests/All sql/test/BugTracker/Tests/drop_schema_crash.SF-1504794.stable.err sql/test/BugTracker/Tests/set_a_new_user_password.SF-1844050.stable.err sql/test/Dependencies/Tests/Dependencies.stable.err sql/test/Tests/All sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 testing/ChangeLog testing/Mtest.py.in tools/merovingian/daemon/merovingian.c Branch: trails Log Message: Merge with default diffs (truncated from 5248 to 300 lines): diff --git a/gdk/ChangeLog.Jul2017 b/gdk/ChangeLog.Jul2017 --- a/gdk/ChangeLog.Jul2017 +++ b/gdk/ChangeLog.Jul2017 @@ -1,3 +1,10 @@ # ChangeLog file for MonetDB # This file is updated with Maddlog +* Mon Oct 30 2017 Sjoerd Mullender +- Reimplemented summing of a column of floating point (flt and dbl) + values. The old code could give wildly inaccurate results when adding + up lots and lots of values due to lack of precision. Try SELECT sum(c) + FROM t; where t is 100,000,000 rows, c is of type REAL and all values + are equal to 1.1. (The old code returned 33554432 instead of 1.1e8.) + diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -10,7 +10,11 @@ #include "gdk.h" #include "gdk_private.h" #include "gdk_calc_private.h" +#ifdef __INTEL_COMPILER +#include +#else #include +#endif /* grouped aggregates * @@ -147,6 +151,296 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e, /* -- */ /* sum */ +#if defined(_MSC_VER) && _MSC_VER < 1800 +#define isnan(x) _isnan(x) +#define isinf(x) (_fpclass(x) & (_FPCLASS_NINF | _FPCLASS_PINF)) +#endif + +static inline int +samesign(double x, double y) +{ + return (x >= 0) == (y >= 0); +} + +/* Add two values, producing the sum and the remainder due to limited + * range of floating point arithmetic. This function depends on the + * fact that the sum returns INFINITY in *hi of the correct sign + * (i.e. isinf() returns TRUE) in case of overflow. */ +static inline void +twosum(volatile double *hi, volatile double *lo, double x, double y) +{ + volatile double yr; + + assert(fabs(x) >= fabs(y)); + + *hi = x + y; + yr = *hi - x; + *lo = y - yr; +} + +static inline void +exchange(double *x, double *y) +{ + double t = *x; + *x = *y; + *y = t; +} + +static BUN +dofsum(const void *restrict values, oid seqb, BUN star
MonetDB: trails - Check out for MAL compilation errors of the ba...
Changeset: e67ea4bfde31 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e67ea4bfde31 Modified Files: sql/backends/monet5/sql_cquery.c Branch: trails Log Message: Check out for MAL compilation errors of the backend function diffs (57 lines): diff --git a/sql/backends/monet5/sql_cquery.c b/sql/backends/monet5/sql_cquery.c --- a/sql/backends/monet5/sql_cquery.c +++ b/sql/backends/monet5/sql_cquery.c @@ -389,19 +389,12 @@ CQanalysis(Client cntxt, MalBlkPtr mb, i } } if(isUnion && msg == MAL_SUCCEED) { //register the output stream into the baskets - if((msg = BSKTregisterInternal(cntxt,mb,"tmp",alias,&bskt)) == MAL_SUCCEED) { - for( j=0; j< MAXSTREAMS && pnet[idx].baskets[j]; j++) - if( strcmp(sch, baskets[pnet[idx].baskets[j]].table->s->base.name) == 0 && - strcmp(tbl, baskets[pnet[idx].baskets[j]].table->base.name) == 0 ) - break; - if ( j == MAXSTREAMS){ - msg = createException(MAL,"cquery.analysis",SQLSTATE(3F000) "Too many stream table columns\n"); - } else if ( pnet[idx].baskets[j] ) { - msg = createException(MAL,"cquery.analysis",SQLSTATE(3F000) "The output stream is already used inside the function body\n"); - } else { - pnet[idx].baskets[j] = bskt; - pnet[idx].inout[j] = STREAM_OUT; - } + for( j=0; j< MAXSTREAMS && pnet[idx].baskets[j]; j++); + if ( j == MAXSTREAMS){ + msg = createException(MAL,"cquery.analysis",SQLSTATE(3F000) "Too many stream table columns\n"); + } else if((msg = BSKTregisterInternal(cntxt,mb,"tmp",alias,&bskt)) == MAL_SUCCEED) { + pnet[idx].baskets[j] = bskt; + pnet[idx].inout[j] = STREAM_OUT; } } return msg; @@ -500,6 +493,9 @@ CQregister(Client cntxt, str sname, str FREE_CQ_MB(finish) } list_destroy(l); + if((msg = be->client->curprg->def->errors) != NULL) { + FREE_CQ_MB(finish) + } if(!alias || strcmp(alias, str_nil) == 0) { //set the alias ralias = GDKstrdup(fname); @@ -616,7 +612,7 @@ CQregister(Client cntxt, str sname, str /* make sure we return the correct type (not the storage type) */ val->vtype = tpe.type->localtype; q = pushValue(mb, q, val); - if(val->vtype == TYPE_str) //if the input variable is of type str we must free it + if(ATOMextern(val->vtype)) //if the input variable is of type str we must free it GDKfree(val->val.sval); if(q == NULL) { CQ_MALLOC_FAIL(finish); @@ -647,7 +643,7 @@ CQregister(Client cntxt, str sname, str int nextbid = newTmpVariable(mb, type); p = pushReturn(mb, p, nextbid); - q= newStmt(mb, basketRef, appendRef); //append to the basket the output results of teh UDF + q= newStmt(mb, basketRef, appendRef); //append to the basket the output results of the UDF q= pushArgument(mb, q, mvc_var); getArg(q, 0) = mvc_var = newTmpVariable(mb, TYPE_int); q= pushStr(mb, q, "tmp"); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: trails - Merge with default
Changeset: 5a5648b9ef69 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5a5648b9ef69 Added Files: sql/test/Tests/fsum1.sql.src sql/test/Tests/fsum1.stable.err.src sql/test/Tests/fsum1.stable.out.src sql/test/mergetables/Tests/sqlsmith.Bug-6451.sql sql/test/mergetables/Tests/sqlsmith.Bug-6451.stable.err sql/test/mergetables/Tests/sqlsmith.Bug-6451.stable.out sql/test/mergetables/Tests/sqlsmith.Bug-6453.sql sql/test/mergetables/Tests/sqlsmith.Bug-6453.stable.err sql/test/mergetables/Tests/sqlsmith.Bug-6453.stable.out sql/test/mergetables/Tests/sqlsmith.Bug-6455.sql sql/test/mergetables/Tests/sqlsmith.Bug-6455.stable.err sql/test/mergetables/Tests/sqlsmith.Bug-6455.stable.out Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_atoms.c gdk/gdk_atoms.h gdk/gdk_bat.c gdk/gdk_group.c gdk/gdk_hash.c gdk/gdk_join.c gdk/gdk_orderidx.c sql/server/rel_dump.c sql/server/rel_optimizer.c sql/server/rel_rel.c sql/server/rel_select.c sql/test/Tests/All sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/mergetables/Tests/All sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: trails Log Message: Merge with default diffs (truncated from 19631 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 @@ -10,7 +10,6 @@ void ALIGNsetH(BAT *b1, BAT *b2); void ALIGNsetT(BAT *b1, BAT *b2); int ALIGNsynced(BAT *b1, BAT *b2); int ATOMallocate(const char *nme); -int ATOMcmp(int id, const void *v_1, const void *v_2); ptr ATOMdup(int id, const void *val); bte ATOMelmshift(int sz); char *ATOMformat(int id, const void *val); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -1791,7 +1791,7 @@ gdk_export BAT *BBPquickdesc(bat b, int * value. `val' is a direct pointer to the atom value. Its return * value should be an hash_t between 0 and 'mask'. * - * @item The @emph{ATOMcmp()} operation computes two atomic + * @item The @emph{ATOMcmp()} operation compares two atomic * values. Its parameters are pointers to atomic values. * * @item The @emph{ATOMlen()} operation computes the byte length for a @@ -1892,7 +1892,6 @@ gdk_export int ATOMindex(const char *nme gdk_export str ATOMname(int id); gdk_export size_t ATOMlen(int id, const void *v); gdk_export ptr ATOMnil(int id); -gdk_export int ATOMcmp(int id, const void *v_1, const void *v_2); gdk_export int ATOMprint(int id, const void *val, stream *fd); gdk_export char *ATOMformat(int id, const void *val); @@ -2769,7 +2768,7 @@ gdk_export void ALIGNsetT(BAT *b1, BAT * for (hb = HASHget(h, hash_##TYPE(h, v));\ hb != HASHnil(h); \ hb = HASHgetlink(h,hb))\ - if (simple_EQ(v, BUNtloc(bi, hb), TYPE)) + if (* (const TYPE *) v == * (const TYPE *) BUNtloc(bi, hb)) #define HASHloop_bte(bi, h, hb, v) HASHloop_TYPE(bi, h, hb, v, bte) #define HASHloop_sht(bi, h, hb, v) HASHloop_TYPE(bi, h, hb, v, sht) diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -152,9 +152,13 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e, /* sum */ #if defined(_MSC_VER) && _MSC_VER < 1800 +#ifndef isnan #define isnan(x) _isnan(x) +#endif +#ifndef isinf #define isinf(x) (_fpclass(x) & (_FPCLASS_NINF | _FPCLASS_PINF)) #endif +#endif static inline int samesign(double x, double y) @@ -186,6 +190,7 @@ exchange(double *x, double *y) *y = t; } +/* this function was adapted from https://bugs.python.org/file10357/msum4.py */ static BUN dofsum(const void *restrict values, oid seqb, BUN start, BUN end, void *restrict results, BUN ngrp, int tp1, int tp2, diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c --- a/gdk/gdk_atoms.c +++ b/gdk/gdk_atoms.c @@ -34,45 +34,45 @@ static int bteCmp(const bte *l, const bte *r) { - return simple_CMP(l, r, bte); + return (*l > *r) - (*l < *r); } static int shtCmp(const sht *l, const sht *r) { - return simple_CMP(l, r, sht); + return (*l > *r) - (*l < *r); } static int intCmp(const int *l, const int *r) { - return simple_CMP(l, r, int); + return (*l > *r) - (*l < *r); } static int fltCmp(const flt *l, const flt *r) { - return simple_CMP(l, r, flt); + return (*l > *r) - (*l < *r); } static int lngCmp(const lng *l, const lng *r) { - return simple_CMP(l, r, lng); + return (*l > *r) - (*l < *r);
MonetDB: trails - More error scenarios handling.
Changeset: f0ff30527e5f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f0ff30527e5f Modified Files: sql/backends/monet5/sql_cquery.c sql/backends/monet5/sql_cquery.h Branch: trails Log Message: More error scenarios handling. diffs (truncated from 302 to 300 lines): diff --git a/sql/backends/monet5/sql_cquery.c b/sql/backends/monet5/sql_cquery.c --- a/sql/backends/monet5/sql_cquery.c +++ b/sql/backends/monet5/sql_cquery.c @@ -394,7 +394,7 @@ CQanalysis(Client cntxt, MalBlkPtr mb, i msg = createException(MAL,"cquery.analysis",SQLSTATE(3F000) "Too many stream table columns\n"); } else if((msg = BSKTregisterInternal(cntxt,mb,"tmp",alias,&bskt)) == MAL_SUCCEED) { pnet[idx].baskets[j] = bskt; - pnet[idx].inout[j] = STREAM_OUT; + pnet[idx].inout[j] = CQ_OUT; } } return msg; @@ -524,8 +524,8 @@ CQregister(Client cntxt, str sname, str msg = createException(SQL,"cquery.register",SQLSTATE(3F000) "Table tmp.%s already exists\n", ralias); goto revertids; } - if((t = mvc_create_stream_table(m, tmp_schema, ralias, tt_stream_temp, 0, SQL_DECLARED_TABLE, CA_COMMIT, - -1, DEFAULT_TABLE_WINDOW, DEFAULT_TABLE_STRIDE)) == NULL) { + if((t = mvc_create_stream_table(m, tmp_schema, ralias, tt_stream_temp, 0, SQL_DECLARED_TABLE, + CA_PRESERVE, -1, DEFAULT_TABLE_WINDOW, DEFAULT_TABLE_STRIDE)) == NULL) { msg = createException(SQL,"cquery.register",SQLSTATE(3F000) "Failed create internal stream table\n"); goto revertids; } @@ -536,7 +536,7 @@ CQregister(Client cntxt, str sname, str goto revertids; } } - msg = create_table_or_view(m, "tmp", ralias, t, tt_stream_temp); + msg = create_table_or_view(m, "tmp", ralias, t, SQL_LOCAL_TEMP_STREAM); //msg = sql_grant_table_privs(m, "public", PRIV_SELECT, "tmp", ralias, NULL, 0, USER_MONETDB); } revertids: @@ -736,7 +736,7 @@ CQregister(Client cntxt, str sname, str } if(heartbeats != HEARTBEAT_NIL) { for(i=0; i < MAXSTREAMS && pnet[pnettop].baskets[i]; i++) { - if(baskets[pnet[pnettop].baskets[i]].window != DEFAULT_TABLE_WINDOW) { + if(pnet[idx].inout[i] == STREAM_IN && baskets[pnet[pnettop].baskets[i]].window != DEFAULT_TABLE_WINDOW) { msg = createException(SQL, "cquery.register", SQLSTATE(42000) "Heartbeat ignored, a window constraint exists\n"); cleanBaskets(pnettop); @@ -817,7 +817,7 @@ CQresume(str alias, int with_alter, lng } if(with_alter && heartbeats != HEARTBEAT_NIL) { for(j=0; j < MAXSTREAMS && pnet[idx].baskets[j]; j++) { - if(baskets[pnet[idx].baskets[j]].window != DEFAULT_TABLE_WINDOW) { + if(pnet[idx].inout[j] == STREAM_IN && baskets[pnet[pnettop].baskets[j]].window != DEFAULT_TABLE_WINDOW) { msg = createException(SQL, "cquery.resume", SQLSTATE(42000) "Heartbeat ignored, a window constraint exists\n"); goto unlock; @@ -826,6 +826,10 @@ CQresume(str alias, int with_alter, lng } pnet[idx].status = CQWAIT; + if(pnet[idx].error) { //if there was an error registered, delete it + GDKfree(pnet[idx].error); + pnet[idx].error = MAL_SUCCEED; + } if(with_alter) { pnet[idx].cycles = cycles; pnet[idx].beats = SET_HEARTBEATS(heartbeats); @@ -856,8 +860,13 @@ CQresumeAll(void) #endif MT_lock_set(&ttrLock); - for(i = 0 ; i < pnettop; i++) + for(i = 0 ; i < pnettop; i++) { pnet[i].status = CQWAIT; + if(pnet[i].error) { + GDKfree(pnet[i].error); + pnet[i].error = MAL_SUCCEED; + } + } /* start the scheduler if needed */ if(cq_pid == 0) { @@ -1053,7 +1062,7 @@ CQheartbeat(Client cntxt, MalBlkPtr mb, for( ; idx < last; idx++){
MonetDB: Jul2017 - Use C99 interfaces isnan, isinf, isfinite, an...
Changeset: 41bd8ea955c8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=41bd8ea955c8 Modified Files: NT/monetdb_config.h.in configure.ag gdk/gdk_aggr.c gdk/gdk_atoms.c gdk/gdk_calc.c monetdb5/modules/kernel/mmath.h Branch: Jul2017 Log Message: Use C99 interfaces isnan, isinf, isfinite, and provide them on old Visual Studio. diffs (200 lines): diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in --- a/NT/monetdb_config.h.in +++ b/NT/monetdb_config.h.in @@ -160,14 +160,6 @@ /* Define if the fits module is to be enabled */ /* #undef HAVE_FITS */ -/* Define to 1 if you have the `fpclass' function. */ -#define HAVE_FPCLASS 1 /* uses _fpclass, see mmath.c */ - -/* Define to 1 if you have the `fpclassify' function. */ -#if defined(_MSC_VER) && _MSC_VER > 1600 -#define HAVE_FPCLASSIFY 1 -#endif - /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ /* #undef HAVE_FSEEKO */ diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -2722,8 +2722,6 @@ AC_CHECK_FUNCS([\ fabsf \ fallocate \ fcntl \ - fpclass \ - fpclassify \ fsync \ ftime \ getexecname \ diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -10,7 +10,7 @@ #include "gdk.h" #include "gdk_private.h" #include "gdk_calc_private.h" -#ifdef __INTEL_COMPILER +#if defined(_MSC_VER) && defined(__INTEL_COMPILER) #include #else #include @@ -151,13 +151,11 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e, /* -- */ /* sum */ -#if defined(_MSC_VER) && _MSC_VER < 1800 -#ifndef isnan +#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && _MSC_VER < 1800 +#include #define isnan(x) _isnan(x) -#endif -#ifndef isinf #define isinf(x) (_fpclass(x) & (_FPCLASS_NINF | _FPCLASS_PINF)) -#endif +#define isfinite(x)_finite(x) #endif static inline int diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c --- a/gdk/gdk_atoms.c +++ b/gdk/gdk_atoms.c @@ -23,12 +23,18 @@ #include "monetdb_config.h" #include "gdk.h" #include "gdk_private.h" -#include /* for isfinite macro */ -#ifdef HAVE_IEEEFP_H -#include /* for Solaris */ -#ifndef isfinite -#define isfinite(f)finite(f) +#if defined(_MSC_VER) && defined(__INTEL_COMPILER) +#include/* Intel compiler on Windows */ +#else +#include /* anywhere else */ #endif + +/* these are only for older Visual Studio compilers (VS 2010) */ +#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && _MSC_VER < 1800 +#include +#define isnan(x) _isnan(x) +#define isinf(x) (_fpclass(x) & (_FPCLASS_NINF | _FPCLASS_PINF)) +#define isfinite(x)_finite(x) #endif static int @@ -920,10 +926,6 @@ atom_io(ptr, Int, int) #else /* SIZEOF_VOID_P == SIZEOF_LNG */ atom_io(ptr, Lng, lng) #endif -#if defined(_MSC_VER) && !defined(isfinite) -/* with more recent Visual Studio, isfinite is defined */ -#define isfinite(x)_finite(x) -#endif int dblFromStr(const char *src, int *len, dbl **dst) @@ -956,9 +958,7 @@ dblFromStr(const char *src, int *len, db p = pe; n = (int) (p - src); if (n == 0 || (errno == ERANGE && (d < -1 || d > 1)) -#ifdef isfinite || !isfinite(d) /* no NaN or Infinte */ -#endif ) { **dst = dbl_nil; /* default return value is nil */ n = 0; @@ -1025,9 +1025,7 @@ fltFromStr(const char *src, int *len, fl #else /* no strtof, try sscanf */ if (sscanf(src, "%f%n", &f, &n) <= 0 || n <= 0 #endif -#ifdef isfinite || !isfinite(f) /* no NaN or infinite */ -#endif ) { **dst = flt_nil; /* default return value is nil */ n = 0; diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c --- a/gdk/gdk_calc.c +++ b/gdk/gdk_calc.c @@ -10,7 +10,11 @@ #include "gdk.h" #include "gdk_private.h" #include "gdk_calc_private.h" +#if defined(_MSC_VER) && defined(__INTEL_COMPILER) +#include +#else #include +#endif /* Define symbol FULL_IMPLEMENTATION to get implementations for all * sensible output types for +, -, *, /. Without the symbol, all diff --git a/monetdb5/modules/kernel/mmath.h b/monetdb5/modules/kernel/mmath.h --- a/monetdb5/modules/kernel/mmath.h +++ b/monetdb5/modules/kernel/mmath.h @@ -10,50 +10,23 @@ #define __MMATH_H__ #include "mal.h" #include "mal_exception.h" -#include - -#ifdef WIN32 -# include -#if _MSC_VER <= 1600 -/* Windows spells these differently */ -# define isnan(x) _isnan(x) -#endif -# define finite(x) _finite(x) -/* NOTE: HAVE_FPCLASS assumed... */ -# define fpclass(x)_fpclass(x) -# define FP_NINF _FPCLASS_NINF -# define FP_PINF _FPCL