Changeset: 68917703bb13 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/68917703bb13
Modified Files:
        sql/storage/bat/bat_storage.c
Branch: Sep2022
Log Message:

Fewer lock/unlock sequences, and protect reading of BATcount.


diffs (26 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -281,10 +281,11 @@ segments2cs(sql_trans *tr, segments *seg
        b->tkey = false;
        b->tnokey[0] = 0;
        b->tnokey[1] = 0;
+       b->theap->dirty = true;
+       BUN cnt = BATcount(b);
        MT_lock_unset(&b->theaplock);
 
        uint32_t *restrict dst;
-       BUN cnt = BATcount(b);
        MT_rwlock_wrlock(&b->thashlock);
        for (; s ; s=s->next) {
                if (s->start >= nr)
@@ -320,9 +321,6 @@ segments2cs(sql_trans *tr, segments *seg
                                }
                                assert(lnr==0);
                        }
-                       MT_lock_set(&b->theaplock);
-                       b->theap->dirty = true;
-                       MT_lock_unset(&b->theaplock);
                        size_t lnr = s->end-s->start;
                        size_t pos = s->start;
                        dst = (uint32_t *) Tloc(b, 0) + (pos/32);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to