Changeset: 0480550045e9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0480550045e9
Modified Files:
        gdk/gdk_bbp.c
Branch: Jul2021
Log Message:

Lock heap while writing the backup.


diffs (33 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3472,6 +3472,7 @@ BBPbackup(BAT *b, bool subcommit)
        long_str nme;
        const char *s = BBP_physical(b->batCacheid);
        size_t slen;
+       bool locked = false;
 
        if (BBPprepare(subcommit) != GDK_SUCCEED) {
                return GDK_FAIL;
@@ -3492,6 +3493,8 @@ BBPbackup(BAT *b, bool subcommit)
        memcpy(nme, s, slen + 1);
        srcdir[s - srcdir] = 0;
 
+       MT_lock_set(&b->theaplock);
+       locked = true;
        if (b->ttype != TYPE_void &&
            do_backup(srcdir, nme, gettailname(b), b->theap,
                      b->batDirtydesc || b->theap->dirty,
@@ -3502,9 +3505,12 @@ BBPbackup(BAT *b, bool subcommit)
                      b->batDirtydesc || b->tvheap->dirty,
                      subcommit) != GDK_SUCCEED)
                goto fail;
+       MT_lock_unset(&b->theaplock);
        GDKfree(srcdir);
        return GDK_SUCCEED;
   fail:
+       if (locked)
+               MT_lock_unset(&b->theaplock);
        if(srcdir)
                GDKfree(srcdir);
        return GDK_FAIL;
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to