Changeset: 05d2729d1875 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/05d2729d1875 Modified Files: gdk/gdk_bat.c Branch: Dec2023 Log Message:
Lock both the view and its parent when making a copy. This hopefully fixes a race between COLcopy making a copy and insert in another thread happening at the same time. diffs (32 lines): diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -822,6 +822,17 @@ COLcopy(BAT *b, int tt, bool writable, r * table and that would result in buckets containing values * beyond the original vheap that we're copying */ MT_lock_set(&b->theaplock); + BAT *pb = NULL, *pvb = NULL; + if (b->theap->parentid != b->batCacheid) { + pb = BBP_desc(b->theap->parentid); + MT_lock_set(&pb->theaplock); + } + if (b->tvheap && + b->tvheap->parentid != b->batCacheid && + b->tvheap->parentid != b->theap->parentid) { + pvb = BBP_desc(b->tvheap->parentid); + MT_lock_set(&pvb->theaplock); + } bi = bat_iterator_nolock(b); if (ATOMstorage(b->ttype) == TYPE_str && b->tvheap->free >= GDK_STRHASHSIZE) memcpy(strhash, b->tvheap->base, GDK_STRHASHSIZE); @@ -832,6 +843,10 @@ COLcopy(BAT *b, int tt, bool writable, r HEAPincref(bi.h); if (bi.vh) HEAPincref(bi.vh); + if (pvb) + MT_lock_unset(&pvb->theaplock); + if (pb) + MT_lock_unset(&pb->theaplock); MT_lock_unset(&b->theaplock); /* first try case (1); create a view, possibly with different _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org