Changeset: 94e5d23636c3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/94e5d23636c3
Modified Files:
gdk/gdk_bat.c
sql/storage/bat/bat_logger.c
Branch: Jan2022
Log Message:
Merge with Jul2021 branch.
diffs (31 lines):
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -674,11 +674,27 @@ BATfree(BAT *b)
if (nunique != BUN_NONE) {
b->tunique_est = (double) nunique;
}
+ /* wait until there are no other references to the heap; a
+ * reference is possible in e.g. BBPsync that uses a
+ * bat_iterator directly on the BBP_desc, i.e. without fix */
+ while (b->theap && (ATOMIC_GET(&b->theap->refs) & HEAPREFS) > 1) {
+ MT_lock_unset(&b->theaplock);
+ MT_sleep_ms(1);
+ MT_lock_set(&b->theaplock);
+ }
if (b->theap) {
assert((ATOMIC_GET(&b->theap->refs) & HEAPREFS) == 1);
assert(b->theap->parentid == b->batCacheid);
HEAPfree(b->theap, false);
}
+ /* wait until there are no other references to the heap; a
+ * reference is possible in e.g. BBPsync that uses a
+ * bat_iterator directly on the BBP_desc, i.e. without fix */
+ while (b->tvheap && (ATOMIC_GET(&b->tvheap->refs) & HEAPREFS) > 1) {
+ MT_lock_unset(&b->theaplock);
+ MT_sleep_ms(1);
+ MT_lock_set(&b->theaplock);
+ }
if (b->tvheap) {
assert((ATOMIC_GET(&b->tvheap->refs) & HEAPREFS) == 1);
assert(b->tvheap->parentid == b->batCacheid);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]