Changeset: 724040d737bb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/724040d737bb
Modified Files:
        sql/ChangeLog.Sep2022
        sql/storage/store.c
Branch: Sep2022
Log Message:

Merge with Jan2022 branch, including release of commit lock while waiting for 
flush lock.


diffs (52 lines):

diff --git a/sql/ChangeLog.Sep2022 b/sql/ChangeLog.Sep2022
--- a/sql/ChangeLog.Sep2022
+++ b/sql/ChangeLog.Sep2022
@@ -1,6 +1,10 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Wed Apr  5 2023 Sjoerd Mullender <sjo...@acm.org>
+- When creating a hot snapshot, allow other clients to proceed, even
+  with updating queries.
+
 * Fri Mar 24 2023 Sjoerd Mullender <sjo...@acm.org>
 - Increased the size of a variable counting the number of changes made
   to the database (e.g. in case more than a 2 billion rows are added to
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2389,8 +2389,13 @@ store_manager(sqlstore *store)
                const int sleeptime = 100;
                MT_lock_unset(&store->flush);
                MT_sleep_ms(sleeptime);
-               MT_lock_set(&store->commit);
-               MT_lock_set(&store->flush);
+               for (;;) {
+                       MT_lock_set(&store->commit);
+                       if (MT_lock_try(&store->flush))
+                               break;
+                       MT_lock_unset(&store->commit);
+                       MT_sleep_ms(sleeptime);
+               }
 
                if (GDKexiting()) {
                        MT_lock_unset(&store->commit);
@@ -2759,6 +2764,8 @@ store_hot_snapshot_to_stream(sqlstore *s
                goto end; // should already have set a GDK error
        close_stream(plan_stream);
        plan_stream = NULL;
+       MT_lock_unset(&store->lock);
+       locked = 2;
        r = hot_snapshot_write_tar(tar_stream, GDKgetenv("gdk_dbname"), 
buffer_get_buf(plan_buf));
        if (r != GDK_SUCCEED)
                goto end;
@@ -2775,7 +2782,8 @@ store_hot_snapshot_to_stream(sqlstore *s
 end:
        if (locked) {
                BBPtmunlock();
-               MT_lock_unset(&store->lock);
+               if (locked == 1)
+                       MT_lock_unset(&store->lock);
                MT_lock_unset(&store->flush);
        }
        if (plan_stream)
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to