MonetDB: Jan2022 - Print tail width for string bats in algo debu...
Changeset: f2f35f67e237 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f2f35f67e237 Modified Files: gdk/gdk_private.h Branch: Jan2022 Log Message: Print tail width for string bats in algo debug output. diffs (35 lines): diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -361,12 +361,13 @@ ilog2(BUN x) } /* some macros to help print info about BATs when using ALGODEBUG */ -#define ALGOBATFMT "%s#" BUNFMT "@" OIDFMT "[%s]%s%s%s%s%s%s%s%s%s" +#define ALGOBATFMT "%s#" BUNFMT "@" OIDFMT "[%s%s]%s%s%s%s%s%s%s%s%s" #define ALGOBATPAR(b) \ BATgetId(b),\ BATcount(b),\ b->hseqbase,\ ATOMname(b->ttype), \ + b->ttype==TYPE_str?b->twidth==1?"1":b->twidth==2?"2":b->twidth==4?"4":"8":"", \ !b->batTransient ? "P" : b->theap->parentid != b->batCacheid ? "V" : b->tvheap && b->tvheap->parentid != b->batCacheid ? "v" : "T", \ BATtdense(b) ? "D" : b->ttype == TYPE_void && b->tvheap ? "X" : ATOMstorage(b->ttype) == TYPE_str && GDK_ELIMDOUBLES(b->tvheap) ? "E" : "", \ b->tsorted ? "S" : b->tnosorted ? "!s" : "",\ @@ -377,7 +378,7 @@ ilog2(BUN x) b->torderidx ? "O" : "",\ b->timprints ? "I" : b->theap->parentid && BBP_cache(b->theap->parentid)->timprints ? "(I)" : "" /* use ALGOOPTBAT* when BAT is optional (can be NULL) */ -#define ALGOOPTBATFMT "%s%s" BUNFMT "%s" OIDFMT "%s%s%s%s%s%s%s%s%s%s%s%s" +#define ALGOOPTBATFMT "%s%s" BUNFMT "%s" OIDFMT "%s%s%s%s%s%s%s%s%s%s%s%s%s" #define ALGOOPTBATPAR(b) \ b ? BATgetId(b) : "", \ b ? "#" : "", \ @@ -386,6 +387,7 @@ ilog2(BUN x) b ? b->hseqbase : 0,\ b ? "[" : "", \ b ? ATOMname(b->ttype) : "",\ + b ? b->ttype==TYPE_str?b->twidth==1?"1":b->twidth==2?"2":b->twidth==4?"4":"8":"" : "", \ b ? "]" : "", \ b ? !b->batTransient ? "P" : b->theap && b->theap->parentid != b->batCacheid ? "V" : b->tvheap && b->tvheap->parentid != b->batCacheid ? "v" : "T" : "", \ b ? BATtdense(b) ? "D" : b->ttype == TYPE_void && b->tvheap ? "X" : ATOMstorage(b->ttype) == TYPE_str && GDK_ELIMDOUBLES(b->tvheap) ? "E" : "" : "", \ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jan2022 - Slightly better placement of lock/unlock calls.
Changeset: 535799f927f9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/535799f927f9 Modified Files: gdk/gdk_align.c gdk/gdk_heap.c Branch: Jan2022 Log Message: Slightly better placement of lock/unlock calls. diffs (36 lines): diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c --- a/gdk/gdk_align.c +++ b/gdk/gdk_align.c @@ -100,17 +100,15 @@ VIEWcreate(oid seq, BAT *b) * because in case of a mark, we are going to override a * column with a void. Take care to zero the accelerator data, * though. */ + MT_lock_set(&b->theaplock); bn->batInserted = b->batInserted; bn->batCount = b->batCount; bn->batCapacity = b->batCapacity; - MT_lock_set(&b->theaplock); bn->T = b->T; tp = VIEWtparent(b); if (tp == 0 && b->ttype != TYPE_void) tp = b->batCacheid; assert(b->ttype != TYPE_void || !tp); - /* copy again now we have the correct lock */ - bn->theap = b->theap; HEAPincref(b->theap); if (b->tvheap) HEAPincref(b->tvheap); diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -647,9 +647,9 @@ GDKupgradevarheap(BAT *b, var_t v, BUN c b->twidth = width; if (cap > BATcapacity(b)) BATsetcapacity(b, cap); - HEAPdecref(old, strcmp(old->filename, new->filename) != 0); b->theap = new; MT_lock_unset(&b->theaplock); + HEAPdecref(old, strcmp(old->filename, new->filename) != 0); return GDK_SUCCEED; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jan2022 - Do not unload/reload views when the ref count...
Changeset: 8c0ee03e16e6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8c0ee03e16e6 Modified Files: gdk/gdk_bbp.c Branch: Jan2022 Log Message: Do not unload/reload views when the ref count goes to 0. This fixes bug #7237. diffs (68 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -2830,7 +2830,6 @@ incref(bat i, bool logical, bool lock) int refs; bat tp = i, tvp = i; BAT *b, *pb = NULL, *pvb = NULL; - bool load = false; if (!BBPcheck(i)) return 0; @@ -2890,40 +2889,12 @@ incref(bat i, bool logical, bool lock) } else { assert(tp >= 0); refs = ++BBP_refs(i); - unsigned flag = BBPHOT; - if (refs == 1 && (tp != i || tvp != i)) { - /* If this is a view, we must load the parent -* BATs, but we must do that outside of the -* lock. Set the BBPLOADING flag so that -* other threads will wait until we're -* done. */ - flag |= BBPLOADING; - load = true; - } - BBP_status_on(i, flag); + BBP_status_on(i, BBPHOT); } if (lock) MT_lock_unset(&GDKswapLock(i)); - if (load) { - /* load the parent BATs */ - assert(!logical); - if (tp != i) { - assert(pb != NULL); - /* load being set implies there is no other -* thread that has access to this bat, but the -* parent is a different matter */ - MT_lock_set(&pb->theaplock); - if (b->theap != pb->theap) { - HEAPincref(pb->theap); - HEAPdecref(b->theap, false); - b->theap = pb->theap; - } - MT_lock_unset(&pb->theaplock); - } - /* done loading, release descriptor */ - BBP_status_off(i, BBPLOADING); - } else if (!logical) { + if (!logical && refs > 1) { /* this wasn't the first physical reference, so undo * the fixes on the parent bats */ if (pb) @@ -3067,8 +3038,12 @@ decref(bat i, bool logical, bool release ? (!BATdirty(b) && !(BBP_status(i) & chkflag) && (BBP_status(i) & BBPPERSISTENT) && +/* cannot unload in-memory data */ !GDKinmemory(farmid) && -b->batSharecnt == 0) +/* do not unload views or parents of views */ +b->batSharecnt == 0 && +b->batCacheid == b->theap->parentid && +(b->tvheap == NULL || b->batCacheid == b->tvheap->parentid)) : (BBP_status(i) & BBPTMP { /* bat will be unloaded now. set the UNLOADING bit * while locked so no other thread thinks it's ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jan2022 - You cannot create an integer view on an strin...
Changeset: 7ee2bb86a943 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7ee2bb86a943 Modified Files: sql/backends/monet5/sql.c sql/test/BugTracker-2022/Tests/All sql/test/BugTracker-2022/Tests/index-function-query.Bug-7238.test Branch: Jan2022 Log Message: You cannot create an integer view on an string offset bat. This fixes bug #7238. diffs (269 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -4191,43 +4191,33 @@ BATSTRindex_int(bat *res, const bat *src if ((s = BATdescriptor(*src)) == NULL) throw(SQL, "calc.index", SQLSTATE(HY005) "Cannot access column descriptor"); - if (*u) { - Heap *h = s->tvheap; - size_t pad, pos; - int v; - - r = COLnew(0, TYPE_int, 1024, TRANSIENT); - if (r == NULL) { + (void) u; + + Heap *h = s->tvheap; + size_t pad, pos; + int v; + + r = COLnew(0, TYPE_int, 1024, TRANSIENT); + if (r == NULL) { + BBPunfix(s->batCacheid); + throw(SQL, "calc.index", SQLSTATE(HY013) MAL_MALLOC_FAIL); + } + pos = GDK_STRHASHSIZE; + while (pos < h->free) { + const char *p; + + pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1)); + if (pad < sizeof(stridx_t)) + pad += GDK_VARALIGN; + pos += pad; + p = h->base + pos; + v = (int) (pos - GDK_STRHASHSIZE); + if (BUNappend(r, &v, false) != GDK_SUCCEED) { + BBPreclaim(r); BBPunfix(s->batCacheid); throw(SQL, "calc.index", SQLSTATE(HY013) MAL_MALLOC_FAIL); } - pos = GDK_STRHASHSIZE; - while (pos < h->free) { - const char *p; - - pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1)); - if (pad < sizeof(stridx_t)) - pad += GDK_VARALIGN; - pos += pad; - p = h->base + pos; - v = (int) (pos - GDK_STRHASHSIZE); - if (BUNappend(r, &v, false) != GDK_SUCCEED) { - BBPreclaim(r); - BBPunfix(s->batCacheid); - throw(SQL, "calc.index", SQLSTATE(HY013) MAL_MALLOC_FAIL); - } - pos += strLen(p); - } - } else { - r = VIEWcreate(s->hseqbase, s); - if (r == NULL) { - BBPunfix(s->batCacheid); - throw(SQL, "calc.index", SQLSTATE(HY013) MAL_MALLOC_FAIL); - } - r->ttype = TYPE_int; - r->tvarsized = false; - HEAPdecref(r->tvheap, false); - r->tvheap = NULL; + pos += strLen(p); } BBPunfix(s->batCacheid); BBPkeepref((*res = r->batCacheid)); @@ -4250,42 +4240,32 @@ BATSTRindex_sht(bat *res, const bat *src if ((s = BATdescriptor(*src)) == NULL) throw(SQL, "calc.index", SQLSTATE(HY005) "Cannot access column descriptor"); - if (*u) { - Heap *h = s->tvheap; - size_t pad, pos; - sht v; - - r = COLnew(0, TYPE_sht, 1024, TRANSIENT); - if (r == NULL) { - BBPunfix(s->batCacheid); + (void) u; + + Heap *h = s->tvheap; + size_t pad, pos; + sht v; + + r = COLnew(0, TYPE_sht, 1024, TRANSIENT); + if (r == NULL) { + BBPunfix(s->batCacheid); + throw(SQL, "calc.index", SQLSTATE(HY013) MAL_MALLOC_FAIL); + } + pos = GDK_STRHASHSIZE; + while (pos < h->free) { + const char *s; + + pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1)); + if (pad < sizeof(stridx_t)) + pad += GDK_VARALIGN; + pos += pad; + s = h->base + pos; + v = (sht) (pos - GDK_STRHASHSIZE); + if (BUNappend(r, &v, false) != GDK_SUCCEED) { + BBPreclaim(r); throw(SQL, "calc.index", SQLSTATE(HY013) MAL_MALLOC_FAIL); } - pos = GDK_STRHASHSIZE; - while (pos < h->free) { - const char *s; - - pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1)); - if (pad < sizeof(stridx_t)) - pad += GDK_VARALIGN; - pos += pad; - s = h->base + pos; - v = (sht) (pos - GDK_STRHASHSIZE); - if (BUNappend(r, &v, false) != GDK_SUCCEED) { -
MonetDB: default - Merge with Jan2022 branch.
Changeset: 299d31cf61cf for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/299d31cf61cf Modified Files: gdk/gdk_private.h sql/backends/monet5/sql.c sql/test/BugTracker-2022/Tests/All Branch: default Log Message: Merge with Jan2022 branch. diffs (truncated from 400 to 300 lines): diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c --- a/gdk/gdk_align.c +++ b/gdk/gdk_align.c @@ -100,17 +100,15 @@ VIEWcreate(oid seq, BAT *b) * because in case of a mark, we are going to override a * column with a void. Take care to zero the accelerator data, * though. */ + MT_lock_set(&b->theaplock); bn->batInserted = b->batInserted; bn->batCount = b->batCount; bn->batCapacity = b->batCapacity; - MT_lock_set(&b->theaplock); bn->T = b->T; tp = VIEWtparent(b); if (tp == 0 && b->ttype != TYPE_void) tp = b->batCacheid; assert(b->ttype != TYPE_void || !tp); - /* copy again now we have the correct lock */ - bn->theap = b->theap; HEAPincref(b->theap); if (b->tvheap) HEAPincref(b->tvheap); diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -2830,7 +2830,6 @@ incref(bat i, bool logical, bool lock) int refs; bat tp = i, tvp = i; BAT *b, *pb = NULL, *pvb = NULL; - bool load = false; if (!BBPcheck(i)) return 0; @@ -2890,40 +2889,12 @@ incref(bat i, bool logical, bool lock) } else { assert(tp >= 0); refs = ++BBP_refs(i); - unsigned flag = BBPHOT; - if (refs == 1 && (tp != i || tvp != i)) { - /* If this is a view, we must load the parent -* BATs, but we must do that outside of the -* lock. Set the BBPLOADING flag so that -* other threads will wait until we're -* done. */ - flag |= BBPLOADING; - load = true; - } - BBP_status_on(i, flag); + BBP_status_on(i, BBPHOT); } if (lock) MT_lock_unset(&GDKswapLock(i)); - if (load) { - /* load the parent BATs */ - assert(!logical); - if (tp != i) { - assert(pb != NULL); - /* load being set implies there is no other -* thread that has access to this bat, but the -* parent is a different matter */ - MT_lock_set(&pb->theaplock); - if (b->theap != pb->theap) { - HEAPincref(pb->theap); - HEAPdecref(b->theap, false); - b->theap = pb->theap; - } - MT_lock_unset(&pb->theaplock); - } - /* done loading, release descriptor */ - BBP_status_off(i, BBPLOADING); - } else if (!logical) { + if (!logical && refs > 1) { /* this wasn't the first physical reference, so undo * the fixes on the parent bats */ if (pb) @@ -3067,8 +3038,12 @@ decref(bat i, bool logical, bool release ? (!BATdirty(b) && !(BBP_status(i) & chkflag) && (BBP_status(i) & BBPPERSISTENT) && +/* cannot unload in-memory data */ !GDKinmemory(farmid) && -b->batSharecnt == 0) +/* do not unload views or parents of views */ +b->batSharecnt == 0 && +b->batCacheid == b->theap->parentid && +(b->tvheap == NULL || b->batCacheid == b->tvheap->parentid)) : (BBP_status(i) & BBPTMP { /* bat will be unloaded now. set the UNLOADING bit * while locked so no other thread thinks it's diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -647,9 +647,9 @@ GDKupgradevarheap(BAT *b, var_t v, BUN c b->twidth = width; if (cap > BATcapacity(b)) BATsetcapacity(b, cap); - HEAPdecref(old, strcmp(old->filename, new->filename) != 0); b->theap = new; MT_lock_unset(&b->theaplock); + HEAPdecref(old, strcmp(old->filename, new->filename) != 0); return GDK_SUCCEED; } diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -361,12 +361,13 @@ ilog2(BUN x) } /* some macros to help print info about BATs when using ALGODEBUG */ -#define ALGOBATFMT "%s#" BUNFMT "@" OIDFMT "[%s]%s%s%s%s%s%s%s%s%s" +#define ALGOBATFMT "%s#" BUNFMT "@" OIDFMT "[%s%s]%s%s%s%s%s%s%s%s%s" #define ALGOBATPAR(b) \
MonetDB: default - Remove functions sys.index and sys.strings.
Changeset: 7926afef3866 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7926afef3866 Removed Files: sql/test/BugTracker-2022/Tests/index-function-query.Bug-7238.test Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test sql/ChangeLog sql/backends/monet5/sql.c sql/backends/monet5/sql.h sql/common/sql_types.c sql/test/BugTracker-2022/Tests/All sql/test/SQLancer/Tests/sqlancer08.test sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.ppc64 sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.32bit sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.int128 sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out.32bit sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: default Log Message: Remove functions sys.index and sys.strings. diffs (truncated from 31529 to 300 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -44458,21 +44458,6 @@ pattern batsql.get_value(X_0:bat[:str], mvc_get_value_bulk; return the current value of the sequence (ie the next to be used value) batsql -index -command batsql.index(X_0:bat[:str], X_1:bit):bat[:bte] -BATSTRindex_bte; -Return the offsets as an index bat -batsql -index -command batsql.index(X_0:bat[:str], X_1:bit):bat[:int] -BATSTRindex_int; -Return the offsets as an index bat -batsql -index -command batsql.index(X_0:bat[:str], X_1:bit):bat[:sht] -BATSTRindex_sht; -Return the offsets as an index bat -batsql lag pattern batsql.lag(X_0:any_1, X_1:any, X_2:bat[:any_1], X_3:any_2, X_4:any_3):bat[:any_1] SQLlag; @@ -44803,11 +44788,6 @@ pattern batsql.str_group_concat(X_0:str, SQLstrgroup_concat; return the string concatenation of groups with a custom separator batsql -strings -command batsql.strings(X_0:bat[:str]):bat[:str] -BATSTRstrings; -Return the strings -batsql sum pattern batsql.sum(X_0:bat[:bte], X_1:any, X_2:any, X_3:int, X_4:any, X_5:any):bat[:hge] SQLsum; @@ -63298,21 +63278,6 @@ unsafe pattern sql.include(X_0:str):void SQLinclude; Compile and execute a sql statements on the file sql -index -command sql.index(X_0:str, X_1:bit):bte -STRindex_bte; -Return the offsets as an index bat -sql -index -command sql.index(X_0:str, X_1:bit):int -STRindex_int; -Return the offsets as an index bat -sql -index -command sql.index(X_0:str, X_1:bit):sht -STRindex_sht; -Return the offsets as an index bat -sql lag pattern sql.lag(X_0:any_1, X_1:any, X_2:any_1, X_3:bit, X_4:bit):any_1 SQLlag; @@ -63753,11 +63718,6 @@ pattern sql.str_group_concat(X_0:str, X_ SQLstrgroup_concat; return the string concatenation of groups with a custom separator sql -strings -command sql.strings(X_0:str):str -STRstrings; -Return the strings -sql subdelta command sql.subdelta(X_0:bat[:oid], X_1:bat[:oid], X_2:bat[:oid], X_3:bat[:oid]):bat[:oid] DELTAsub; diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -31753,21 +31753,6 @@ pattern batsql.get_value(X_0:bat[:str], mvc_get_value_bulk; return the current value of the sequence (ie the next to be used value) batsql -index -command batsql.index(X_0:bat
MonetDB: Jan2022 - Move dml dependency change to the backend, so...
Changeset: 557b3500e8dc for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/557b3500e8dc Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql.h sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/test/mapi/Tests/sql_int128.test Branch: Jan2022 Log Message: Move dml dependency change to the backend, so sql functions/procedures will always add the dependency when they run. Also check if any rows were affected diffs (truncated from 339 to 300 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -63118,6 +63118,11 @@ pattern sql.dense_rank(X_0:any_1, X_1:bi SQLdense_rank; return the densely ranked groups sql +depend +unsafe pattern sql.depend(X_0:str, X_1:str, X_2:lng):void +mvc_add_dependency_change; +Set dml dependency on current transaction for a table. +sql deregister unsafe pattern sql.deregister():int RAstatementEnd; diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -46593,6 +46593,11 @@ pattern sql.dense_rank(X_0:any_1, X_1:bi SQLdense_rank; return the densely ranked groups sql +depend +unsafe pattern sql.depend(X_0:str, X_1:str, X_2:lng):void +mvc_add_dependency_change; +Set dml dependency on current transaction for a table. +sql deregister unsafe pattern sql.deregister():int RAstatementEnd; diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -4345,8 +4345,6 @@ rel2bin_insert(backend *be, sql_rel *rel /* update predicate list */ if (rel->r && !rel_predicates(be, rel->r)) return NULL; - if (!isNew(t) && isGlobal(t) && !isGlobalTemp(t) && sql_trans_add_dependency_change(be->mvc->session->tr, t->base.id, dml) != LOG_OK) - return sql_error(sql, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL); if (ddl) { ret = ddl; @@ -4358,6 +4356,8 @@ rel2bin_insert(backend *be, sql_rel *rel /* if there are multiple update statements, update total count, otherwise use the the current count */ be->rowcount = be->rowcount ? add_to_rowcount_accumulator(be, ret->nr) : ret->nr; } + if (t->s && isGlobal(t) && !isGlobalTemp(t)) + (void) stmt_dependency_change(be, t, ret); return ret; } } @@ -5182,6 +5182,7 @@ sql_update(backend *be, sql_table *t, st int i, nr_cols = ol_length(t->columns); list *l = sa_list(sql->sa); node *n; + stmt *cnt = NULL; sql_update_check_null(be, t, updates); @@ -5210,6 +5211,14 @@ sql_update(backend *be, sql_table *t, st if (!sql_update_triggers(be, t, rows, updates, 1)) return sql_error(sql, 10, SQLSTATE(27000) "UPDATE: triggers failed for table '%s'", t->base.name); + if (!be->silent || (t->s && isGlobal(t) && !isGlobalTemp(t))) + cnt = stmt_aggr(be, rows, NULL, NULL, sql_bind_func(sql, "sys", "count", sql_bind_localtype("void"), NULL, F_AGGR), 1, 0, 1); + if (!be->silent) { + /* if there are multiple update statements, update total count, otherwise use the the current count */ + be->rowcount = be->rowcount ? add_to_rowcount_accumulator(be, cnt->nr) : cnt->nr; + } + if (t->s && isGlobal(t) && !isGlobalTemp(t)) + (void) stmt_dependency_change(be, t, cnt); /* cascade ?? */ return l; } @@ -5332,14 +5341,14 @@ rel2bin_update(backend *be, sql_rel *rel /* if there are multiple update statements, update total count, otherwise use the the current count */ be->rowcount = be->rowcount ? add_to_rowcount_accumulator(be, cnt->nr) : cnt->nr; } + if (t->s && isGlobal(t) && !isGlobalTemp(t)) + (void) stmt_dependency_change(be, t, cnt); } if (sql->cascade_action) sql->cascade_action = NULL; if (rel->r && !rel_predicates(be, rel->r)) return NULL; - if (!isNew(t) && isGlobal(t) && !isGlobalTemp(t) && sql_trans_add_dependency_change(be->mvc->session->tr, t->base.id, dml) != LOG_OK) - return sql_error(sql, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL); return cnt; } @@ -5536,7 +5545,7 @@ sql_delete(backend *be, sql_table *t, st if (rows) { s = stmt_delete(be, t, rows); - if (!be->silent) + if (!be->silent || (t->s && isGlobal(t) && !isGlobalTemp(t)))
MonetDB: Jan2022 - I committed too much
Changeset: 4beb86842488 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4beb86842488 Modified Files: sql/backends/monet5/sql.c Branch: Jan2022 Log Message: I committed too much diffs (21 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -577,14 +577,14 @@ create_table_from_emit(Client cntxt, cha for (i = 0; i < ncols; i++) { BAT *b = columns[i].b; - const char *atomname = ATOMname(b->ttype); + str atoname = ATOMname(b->ttype); sql_subtype tpe; sql_column *col = NULL; - if (!strcmp(atomname, "str")) + if (!strcmp(atoname, "str")) sql_find_subtype(&tpe, "clob", 0, 0); else { - sql_subtype *t = sql_bind_localtype(atomname); + sql_subtype *t = sql_bind_localtype(atoname); if (!t) throw(SQL, "sql.catalog", SQLSTATE(3F000) "CREATE TABLE: could not find type for column"); tpe = *t; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jan2022 - Missing check
Changeset: 6dad8fabafa9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6dad8fabafa9 Modified Files: sql/backends/monet5/sql.c Branch: Jan2022 Log Message: Missing check diffs (13 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -669,6 +669,9 @@ append_to_table_from_emit(Client cntxt, } } bat_destroy(pos); + if (BATcount(columns[0].b) > 0 && !isNew(t) && isGlobal(t) && !isGlobalTemp(t) && + sql_trans_add_dependency_change(sql->session->tr, t->base.id, dml) != LOG_OK) + throw(SQL, "sql.catalog", SQLSTATE(HY013) MAL_MALLOC_FAIL); return msg; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list