Changeset: 26e05d704769 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/26e05d704769
Modified Files:
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_storage.c
Branch: Jul2021
Log Message:

Some minor locking issues.


diffs (61 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1523,7 +1523,6 @@ BATappend_or_update(BAT *b, BAT *p, cons
                                        goto bailout;
                                }
                                if (BUNappend(b, new, force) != GDK_SUCCEED) {
-                                       MT_rwlock_wrunlock(&b->thashlock);
                                        bat_iterator_end(&ni);
                                        return GDK_FAIL;
                                }
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3341,7 +3341,9 @@ BBPsync(int cnt, bat *restrict subcommit
                                        BATiter bi = bat_iterator(b);
                                        if (size > bi.count)
                                                size = bi.count;
+                                       MT_rwlock_rdlock(&b->thashlock);
                                        ret = BATsave_locked(b, &bi, size);
+                                       MT_rwlock_rdunlock(&b->thashlock);
                                        bat_iterator_end(&bi);
                                        BBP_status_off(i, BBPSAVING);
                                }
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -881,17 +881,8 @@ BATsave_locked(BAT *b, BATiter *bi, BUN 
                        b->batDirtydesc = false;
                }
                MT_lock_unset(&b->theaplock);
-               if (MT_rwlock_rdtry(&b->thashlock)) {
-                       /* if we can't get the lock, don't bother saving
-                        * the hash (normally, the hash lock should not
-                        * be acquired when the heap lock has already
-                        * been acquired, and here we have the heap
-                        * lock, so we must be careful with the hash
-                        * lock) */
-                       if (b->thash && b->thash != (Hash *) 1)
-                               BAThashsave(b, dosync);
-                       MT_rwlock_rdunlock(&b->thashlock);
-               }
+               if (b->thash && b->thash != (Hash *) 1)
+                       BAThashsave(b, dosync);
        }
        return err;
 }
@@ -901,11 +892,11 @@ BATsave(BAT *b)
 {
        gdk_return rc;
 
+       BATiter bi = bat_iterator(b);
        MT_rwlock_rdlock(&b->thashlock);
-       BATiter bi = bat_iterator(b);
        rc = BATsave_locked(b, &bi, bi.count);
+       MT_rwlock_rdunlock(&b->thashlock);
        bat_iterator_end(&bi);
-       MT_rwlock_rdunlock(&b->thashlock);
        return rc;
 }
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to