Changeset: e77ebd7baf5a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e77ebd7baf5a Modified Files: debian/rules gdk/gdk_align.c gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_delta.c gdk/gdk_tm.c sql/storage/store.c Branch: default Log Message:
Merge with Jan2022 branch. diffs (180 lines): diff --git a/debian/rules b/debian/rules --- a/debian/rules +++ b/debian/rules @@ -13,7 +13,7 @@ DH_VERBOSE=1 override_dh_auto_configure: dh_auto_configure -- \ - -DPYTHON3_LIBDIR=lib/python3/dist-packages + -DPYTHON3_LIBDIR=lib/python3/dist-packages \ -DCMAKE_INSTALL_RUNSTATEDIR=/run \ -DRELEASE_VERSION=ON \ -DASSERT=OFF \ diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -97,6 +97,7 @@ BATcreatedesc(oid hseq, int tt, bool hea .batRole = role, .batTransient = true, .batRestricted = BAT_WRITE, + .batDirtydesc = true, }; if (heapnames && (bn->theap = GDKmalloc(sizeof(Heap))) == NULL) { GDKfree(bn); @@ -120,6 +121,7 @@ BATcreatedesc(oid hseq, int tt, bool hea *bn->theap = (Heap) { .parentid = bn->batCacheid, .farmid = BBPselectfarm(role, bn->ttype, offheap), + .dirty = true, }; const char *nme = BBP_physical(bn->batCacheid); @@ -136,6 +138,7 @@ BATcreatedesc(oid hseq, int tt, bool hea *bn->tvheap = (Heap) { .parentid = bn->batCacheid, .farmid = BBPselectfarm(role, bn->ttype, varheap), + .dirty = true, }; ATOMIC_INIT(&bn->tvheap->refs, 1); strconcat_len(bn->tvheap->filename, @@ -153,7 +156,6 @@ BATcreatedesc(oid hseq, int tt, bool hea MT_lock_init(&bn->batIdxLock, name); snprintf(name, sizeof(name), "hashlock%d", bn->batCacheid); /* fits */ MT_rwlock_init(&bn->thashlock, name); - bn->batDirtydesc = true; return bn; } @@ -294,14 +296,6 @@ COLnew2(oid hseq, int tt, BUN cap, role_ return bn; bailout: BBPclear(bn->batCacheid, true); - if (bn->theap) - HEAPdecref(bn->theap, true); - if (bn->tvheap) - HEAPdecref(bn->tvheap, true); - MT_lock_destroy(&bn->theaplock); - MT_lock_destroy(&bn->batIdxLock); - MT_rwlock_destroy(&bn->thashlock); - GDKfree(bn); return NULL; } @@ -645,6 +639,7 @@ BATclear(BAT *b, bool force) b->batCount = 0; if (b->ttype == TYPE_void) b->batCapacity = 0; + b->theap->free = 0; BAThseqbase(b, 0); BATtseqbase(b, ATOMtype(b->ttype) == TYPE_oid ? 0 : oid_nil); b->batDirtydesc = true; diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -701,7 +701,9 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool IMPSdestroy(b); /* imprints do not support updates yet */ OIDXdestroy(b); STRMPdestroy(b); /* TODO: use STRMPappendBitString */ + MT_lock_set(&b->theaplock); + b->batDirtydesc = true; if (BATcount(b) == 0 || b->tmaxpos != BUN_NONE) { @@ -1124,9 +1126,13 @@ BATappend_or_update(BAT *b, BAT *p, cons OIDXdestroy(b); IMPSdestroy(b); STRMPdestroy(b); + /* load hash so that we can maintain it */ + (void) BATcheckhash(b); + MT_lock_set(&b->theaplock); if (!force && (b->batRestricted != BAT_WRITE || b->batSharecnt > 0)) { MT_lock_unset(&b->theaplock); + bat_iterator_end(&ni); GDKerror("access denied to %s, aborting.\n", BATgetId(b)); return GDK_FAIL; } @@ -1134,9 +1140,6 @@ BATappend_or_update(BAT *b, BAT *p, cons if (ni.count > BATcount(b) / gdk_unique_estimate_keep_fraction) { b->tunique_est = 0; } - MT_lock_unset(&b->theaplock); - /* load hash so that we can maintain it */ - (void) BATcheckhash(b); b->tsorted = b->trevsorted = false; b->tnosorted = b->tnorevsorted = 0; @@ -1147,6 +1150,9 @@ BATappend_or_update(BAT *b, BAT *p, cons int (*atomcmp)(const void *, const void *) = ATOMcompare(b->ttype); const void *nil = ATOMnilptr(b->ttype); oid hseqend = b->hseqbase + BATcount(b); + + MT_lock_unset(&b->theaplock); + bool anynil = false; bool locked = false; @@ -2801,6 +2807,7 @@ PROPdestroy(BAT *b) b->tprops = NULL; while (p) { + /* only set dirty if a saved property is changed */ n = p->next; VALclear(&p->v); GDKfree(p); diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -805,6 +805,7 @@ BBPreadEntries(FILE *fp, unsigned bbpver goto bailout; } } + bn->batDirtydesc = false; /* undo setting by BATsetprop_nolock */ BBP_refs(bid) = 0; BBP_lrefs(bid) = 1; /* any BAT we encounter here is persistent, so has a logical reference */ BBP_desc(bid) = bn; @@ -3924,7 +3925,8 @@ BBPsync(int cnt, bat *restrict subcommit BBP_status_on(i, BBPSAVING); if (lock) MT_lock_unset(&GDKswapLock(i)); - assert(size <= bi.count || size == BUN_NONE); + assert(sizes == NULL || size <= bi.count); + assert(sizes == NULL || bi.width == 0 || (bi.type == TYPE_msk ? ((size + 31) / 32) * 4 : size << bi.shift) <= bi.hfree); if (size > bi.count) size = bi.count; MT_rwlock_rdlock(&b->thashlock); diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c --- a/gdk/gdk_tm.c +++ b/gdk/gdk_tm.c @@ -60,6 +60,7 @@ prelude(int cnt, bat *restrict subcommit MT_lock_set(&b->theaplock); assert(!isVIEW(b)); assert(b->batRole == PERSISTENT); + assert(sizes == NULL || sizes[i] <= BATcount(b)); BATcommit(b, sizes ? sizes[i] : BUN_NONE); MT_lock_unset(&b->theaplock); } diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -2066,6 +2066,9 @@ store_init(int debug, store_type store_t sql_allocator *pa; sqlstore *store = MNEW(sqlstore); + if (debug&2) + GDKtracer_set_layer_level("sql_all", "debug"); + if (!store) { TRC_CRITICAL(SQL_STORE, "Allocation failure while initializing store\n"); return NULL; @@ -2331,7 +2334,8 @@ store_manager(sqlstore *store) if (res != LOG_OK) { MT_lock_unset(&store->flush); - GDKfatal("write-ahead logging failure"); + if (!GDKexiting()) + GDKfatal("write-ahead logging failure"); } if (GDKexiting()) _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org