Changeset: fbd8c84970f6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fbd8c84970f6
Modified Files:
gdk/gdk_align.c
gdk/gdk_hash.c
gdk/gdk_orderidx.c
Branch: Aug2024
Log Message:
Keep lock longer in BATmaterialize, don't allow accelerators on VOID bats.
diffs (76 lines):
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -238,23 +238,22 @@ BATmaterialize(BAT *b, BUN cap)
assert(!isVIEW(b));
if (cap == BUN_NONE || cap < BATcapacity(b))
cap = BATcapacity(b);
+ MT_lock_set(&b->theaplock);
if (b->ttype != TYPE_void) {
/* no voids; just call BATextend to make sure of capacity */
+ MT_lock_unset(&b->theaplock);
return BATextend(b, cap);
}
- if ((tail = GDKmalloc(sizeof(Heap))) == NULL)
+ if ((tail = GDKmalloc(sizeof(Heap))) == NULL) {
+ MT_lock_unset(&b->theaplock);
return GDK_FAIL;
+ }
p = 0;
q = BATcount(b);
assert(cap >= q - p);
TRC_DEBUG(ALGO, "BATmaterialize(" ALGOBATFMT ")\n", ALGOBATPAR(b));
- /* cleanup possible ACC's */
- HASHdestroy(b);
- IMPSdestroy(b);
- OIDXdestroy(b);
-
*tail = (Heap) {
.farmid = BBPselectfarm(b->batRole, TYPE_oid, offheap),
.parentid = b->batCacheid,
@@ -263,6 +262,7 @@ BATmaterialize(BAT *b, BUN cap)
};
settailname(tail, BBP_physical(b->batCacheid), TYPE_oid, 0);
if (HEAPalloc(tail, cap, sizeof(oid)) != GDK_SUCCEED) {
+ MT_lock_unset(&b->theaplock);
GDKfree(tail);
return GDK_FAIL;
}
@@ -276,7 +276,6 @@ BATmaterialize(BAT *b, BUN cap)
x[p] = t++;
}
/* point of no return */
- MT_lock_set(&b->theaplock);
assert((ATOMIC_GET(&b->theap->refs) & HEAPREFS) > 0);
/* can only look at tvheap when lock is held */
if (complex_cand(b)) {
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -1004,6 +1004,10 @@ BAThash_impl(BAT *restrict b, struct can
gdk_return
BAThash(BAT *b)
{
+ if (b->ttype == TYPE_void) {
+ GDKerror("No hash on void type bats\n");
+ return GDK_FAIL;
+ }
if (ATOMstorage(b->ttype) == TYPE_msk) {
GDKerror("No hash on msk type bats\n");
return GDK_FAIL;
diff --git a/gdk/gdk_orderidx.c b/gdk/gdk_orderidx.c
--- a/gdk/gdk_orderidx.c
+++ b/gdk/gdk_orderidx.c
@@ -193,6 +193,10 @@ persistOIDX(BAT *b)
gdk_return
BATorderidx(BAT *b, bool stable)
{
+ if (b->ttype == TYPE_void) {
+ GDKerror("No order index on void type bats\n");
+ return GDK_FAIL;
+ }
if (BATcheckorderidx(b))
return GDK_SUCCEED;
if (!BATtdense(b)) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]