Changeset: be90488febfd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/be90488febfd Modified Files: gdk/gdk_aggr.c gdk/gdk_align.c gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_heap.c gdk/gdk_private.h gdk/gdk_select.c gdk/gdk_storage.c sql/storage/bat/bat_storage.c testing/sqltest.py Branch: default Log Message:
Merge with Jan2022 branch. diffs (254 lines): diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -3643,9 +3643,12 @@ BATmin_skipnil(BAT *b, void *aggr, bit s if (r == 0) { /* there are no nils, record that */ MT_lock_set(&b->theaplock); - b->tnonil = true; + if (b->batCount == bi.count) { + b->tnonil = true; + } MT_lock_unset(&b->theaplock); } + bat_iterator_end(&bi); } else { r = 0; } diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c --- a/gdk/gdk_align.c +++ b/gdk/gdk_align.c @@ -388,10 +388,10 @@ VIEWdestroy(BAT *b) IMPSdestroy(b); OIDXdestroy(b); STRMPdestroy(b); - PROPdestroy(b); VIEWunlink(b); MT_lock_set(&b->theaplock); + PROPdestroy_nolock(b); /* heaps that are left after VIEWunlink are ours, so need to be * destroyed (and files deleted) */ if (b->theap) { diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -696,7 +696,7 @@ BATdestroy(BAT *b) ATOMIC_DESTROY(&b->tvheap->refs); GDKfree(b->tvheap); } - PROPdestroy(b); + PROPdestroy_nolock(b); MT_lock_destroy(&b->theaplock); MT_lock_destroy(&b->batIdxLock); MT_rwlock_destroy(&b->thashlock); @@ -1300,6 +1300,7 @@ BUNdelete(BAT *b, oid o) BUN p; BATiter bi = bat_iterator_nolock(b); const void *val; + bool locked = false; assert(!is_oid_nil(b->hseqbase) || BATcount(b) == 0); if (o < b->hseqbase || o >= b->hseqbase + BATcount(b)) { @@ -1346,19 +1347,22 @@ BUNdelete(BAT *b, oid o) memcpy(Tloc(b, p), val, b->twidth); HASHinsert(&bi, p, val); MT_lock_set(&b->theaplock); + locked = true; if (b->tminpos == BATcount(b) - 1) b->tminpos = p; if (b->tmaxpos == BATcount(b) - 1) b->tmaxpos = p; - MT_lock_unset(&b->theaplock); } /* no longer sorted */ - MT_lock_set(&b->theaplock); + if (!locked) { + MT_lock_set(&b->theaplock); + locked = true; + } b->tsorted = b->trevsorted = false; b->theap->dirty = true; - MT_lock_unset(&b->theaplock); } - MT_lock_set(&b->theaplock); + if (!locked) + MT_lock_set(&b->theaplock); if (b->tnosorted >= p) b->tnosorted = 0; if (b->tnorevsorted >= p) @@ -1457,7 +1461,9 @@ BUNinplacemulti(BAT *b, const oid *posit * isn't, we're not sure anymore about * the nil property, so we must clear * it */ + MT_lock_set(&b->theaplock); b->tnil = false; + MT_lock_unset(&b->theaplock); } if (b->ttype != TYPE_void) { if (bi.maxpos != BUN_NONE) { diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -2790,7 +2790,7 @@ BATconstant(oid hseq, int tailtype, cons */ void -PROPdestroy(BAT *b) +PROPdestroy_nolock(BAT *b) { PROPrec *p = b->tprops; PROPrec *n; @@ -2805,6 +2805,14 @@ PROPdestroy(BAT *b) } } +void +PROPdestroy(BAT *b) +{ + MT_lock_set(&b->theaplock); + PROPdestroy_nolock(b); + MT_lock_unset(&b->theaplock); +} + ValPtr BATgetprop_nolock(BAT *b, enum prop_t idx) { diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -1804,8 +1804,8 @@ BBPexit(void) HEAPdecref(b->tvheap, false); b->tvheap = NULL; } + PROPdestroy_nolock(b); MT_lock_unset(&b->theaplock); - PROPdestroy(b); BATfree(b); } BBP_pid(i) = 0; @@ -3267,7 +3267,7 @@ BBPdestroy(BAT *b) HASHdestroy(b); IMPSdestroy(b); OIDXdestroy(b); - PROPdestroy(b); + PROPdestroy_nolock(b); if (tp == 0) { /* bats that get destroyed must unfix their atoms */ gdk_return (*tunfix) (const void *) = BATatoms[b->ttype].atomUnfix; @@ -3574,6 +3574,7 @@ do_backup(const char *srcdir, const char char extnew[16]; bool istail = strncmp(ext, "tail", 4) == 0; + h->dirty |= dirty; if (h->wasempty) { return GDK_SUCCEED; } @@ -3925,8 +3926,9 @@ BBPsync(int cnt, bat *restrict subcommit break; /* we once again have a saved heap */ } - if (idx < cnt) + if (idx < cnt) { ret = GDK_FAIL; + } } TRC_DEBUG(PERF, "write time %d\n", (t0 = GDKms()) - t1); diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -841,6 +841,7 @@ HEAPload_intern(Heap *h, const char *nme if (h->base == NULL) return GDK_FAIL; /* file could not be read satisfactorily */ + h->dirty = false; /* we just read it, so it's clean */ 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 @@ -251,6 +251,8 @@ void persistOIDX(BAT *b) __attribute__((__visibility__("hidden"))); void PROPdestroy(BAT *b) __attribute__((__visibility__("hidden"))); +void PROPdestroy_nolock(BAT *b) + __attribute__((__visibility__("hidden"))); gdk_return rangejoin(BAT *r1, BAT *r2, BAT *l, BAT *rl, BAT *rh, struct canditer *lci, struct canditer *rci, bool li, bool hi, bool anti, bool symmetric, BUN maxsize) __attribute__((__warn_unused_result__)) __attribute__((__visibility__("hidden"))); diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -1109,8 +1109,10 @@ scanselect(BATiter *bi, struct canditer /* range bounded on left */ \ if (!li) { \ /* open range on left */ \ - if (*(TYPE*)tl == MAXVALUE##TYPE) \ + if (*(TYPE*)tl == MAXVALUE##TYPE) { \ + bat_iterator_end(&bi); \ return BATdense(0, 0, 0); \ + } \ /* vl < x === vl+1 <= x */ \ vl.v_##TYPE = NEXTVALUE##TYPE(*(TYPE*)tl); \ li = true; \ @@ -1127,8 +1129,10 @@ scanselect(BATiter *bi, struct canditer /* range bounded on right */ \ if (!hi) { \ /* open range on right */ \ - if (*(TYPE*)th == MINVALUE##TYPE) \ + if (*(TYPE*)th == MINVALUE##TYPE) { \ + bat_iterator_end(&bi); \ return BATdense(0, 0, 0); \ + } \ /* x < vh === x <= vh-1 */ \ vh.v_##TYPE = PREVVALUE##TYPE(*(TYPE*)th); \ hi = true; \ @@ -1141,8 +1145,10 @@ scanselect(BATiter *bi, struct canditer th = &vh.v_##TYPE; \ hval = true; \ } \ - if (*(TYPE*)tl > *(TYPE*)th) \ + if (*(TYPE*)tl > *(TYPE*)th) { \ + bat_iterator_end(&bi); \ return BATdense(0, 0, 0); \ + } \ } \ assert(lval); \ assert(hval); \ diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c --- a/gdk/gdk_storage.c +++ b/gdk/gdk_storage.c @@ -625,14 +625,6 @@ GDKload(int farmid, const char *nme, con * merely copies the data into place. Failure to read or write the * BAT results in a NULL, otherwise it returns the BAT pointer. */ -static void -DESCclean(BAT *b) -{ - b->theap->dirty = false; - if (b->tvheap) - b->tvheap->dirty = false; -} - static BAT * DESCload(int i) { @@ -664,7 +656,6 @@ DESCload(int i) * descriptor, so loaded mode may be stale) */ b->batTransient = (BBP_status(b->batCacheid) & BBPPERSISTENT) == 0; b->batCopiedtodisk = true; - DESCclean(b); MT_lock_unset(&b->theaplock); return b; } @@ -880,7 +871,7 @@ BATdelete(BAT *b) HASHdestroy(b); IMPSdestroy(b); OIDXdestroy(b); - PROPdestroy(b); + PROPdestroy_nolock(b); STRMPdestroy(b); HEAPfree(b->theap, true); if (b->tvheap) _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org