Changeset: 9a06f532eea7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9a06f532eea7 Modified Files: gdk/gdk_bbp.c Branch: default Log Message:
Don't free bat if descriptor is dirty. That causes a race with BBPsync. The sequence is, BBPsync sees a BAT is dirty (even if only the descriptor) and moves the heap(s) to the backup directory. Then in another thread, the reference count goes down to zero and decref decides to free the heaps because they are clean. Then BBPsync needs to save the BATs it was to sync. Since the BAT is unloaded, the cache entry in BBP is NULL, so the BAT is not (cannot be) saved. This then causes mayhem. The solution is to not free the heaps (and clear the cache) if only the descriptor is dirty. diffs (12 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -2260,7 +2260,7 @@ decref(bat i, bool logical, bool release * if they have been made cold or are not dirty */ if (BBP_refs(i) > 0 || (BBP_lrefs(i) > 0 && - (b == NULL || BATdirtydata(b) || !(BBP_status(i) & BBPPERSISTENT) || GDKinmemory(b->theap->farmid)))) { + (b == NULL || BATdirty(b) || !(BBP_status(i) & BBPPERSISTENT) || GDKinmemory(b->theap->farmid)))) { /* bat cannot be swapped out */ } else if (b ? b->batSharecnt == 0 : (BBP_status(i) & BBPTMP)) { /* bat will be unloaded now. set the UNLOADING bit _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list