Changeset: ebd9010dd8ee for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ebd9010dd8ee
Modified Files:
        .hgtags
        gdk/gdk_bat.c
        gdk/gdk_bbp.c
Branch: Jun2023
Log Message:

Merge with Sep2022 branch.


diffs (88 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -798,3 +798,4 @@ 8a95168e853382b9b89ac7b67e343788ea837f3a
 bb95192134c0d8ef8fea525204eefcd0de099a54 Jun2023_root
 24385ee6130494440e09d31ec73f4aa2e2893e98 Jul2021_33
 05b3d9ea9165baf1d2956d5b06ad85f817ecc6d2 Jul2021_33
+05b3d9ea9165baf1d2956d5b06ad85f817ecc6d2 Jul2021_SP10_release
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -668,9 +668,6 @@ BATfree(BAT *b)
                return;
 
        /* deallocate all memory for a bat */
-       if (b->tident && !default_ident(b->tident))
-               GDKfree(b->tident);
-       b->tident = BATstring_t;
        MT_rwlock_rdlock(&b->thashlock);
        BUN nunique = BUN_NONE;
        if (b->thash && b->thash != (Hash *) 1) {
@@ -682,6 +679,9 @@ BATfree(BAT *b)
        OIDXfree(b);
        STRMPfree(b);
        MT_lock_set(&b->theaplock);
+       if (b->tident && !default_ident(b->tident))
+               GDKfree(b->tident);
+       b->tident = BATstring_t;
        if (nunique != BUN_NONE) {
                b->tunique_est = (double) nunique;
        }
@@ -2139,12 +2139,14 @@ BATroles(BAT *b, const char *tnme)
 {
        if (b == NULL)
                return GDK_SUCCEED;
+       MT_lock_set(&b->theaplock);
        if (b->tident && !default_ident(b->tident))
                GDKfree(b->tident);
        if (tnme)
                b->tident = GDKstrdup(tnme);
        else
                b->tident = BATstring_t;
+       MT_lock_unset(&b->theaplock);
        return b->tident ? GDK_SUCCEED : GDK_FAIL;
 }
 
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2925,8 +2925,10 @@ decref(bat i, bool logical, bool lock, c
                }
        }
        if (b) {
-               if (!locked)
+               if (!locked) {
                        MT_lock_set(&b->theaplock);
+                       locked = true;
+               }
 #if 0
                if (b->batCount > b->batInserted && !isVIEW(b)) {
                        /* if batCount is larger than batInserted and
@@ -2947,9 +2949,14 @@ decref(bat i, bool logical, bool lock, c
        /* we destroy transients asap and unload persistent bats only
         * if they have been made cold or are not dirty */
        unsigned chkflag = BBPSYNCING;
-       if (GDKvm_cursize() < GDK_vm_maxsize &&
-            ((b && b->theap ? b->theap->size : 0) + (b && b->tvheap ? 
b->tvheap->size : 0)) < (GDK_vm_maxsize - GDKvm_cursize()) / 32)
-               chkflag |= BBPHOT;
+       if (b && GDKvm_cursize() < GDK_vm_maxsize) {
+               if (!locked) {
+                       MT_lock_set(&b->theaplock);
+                       locked = true;
+               }
+               if (((b->theap ? b->theap->size : 0) + (b->tvheap ? 
b->tvheap->size : 0)) < (GDK_vm_maxsize - GDKvm_cursize()) / 32)
+                       chkflag |= BBPHOT;
+       }
        /* only consider unloading if refs is 0; if, in addition, lrefs
         * is 0, we can definitely unload, else only if some more
         * conditions are met */
@@ -2975,7 +2982,7 @@ decref(bat i, bool logical, bool lock, c
                swap = true;
        } /* else: bat cannot be swapped out */
        lrefs = BBP_lrefs(i);
-       if (b)
+       if (locked)
                MT_lock_unset(&b->theaplock);
 
        /* unlock before re-locking in unload; as saving a dirty
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to