Changeset: 124433b46e8d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/124433b46e8d
Modified Files:
        gdk/gdk_bbp.c
        gdk/gdk_string.c
Branch: default
Log Message:

Merge with Jan2022 branch.


diffs (46 lines):

diff --git a/gdk/ChangeLog.Jan2022 b/gdk/ChangeLog.Jan2022
--- a/gdk/ChangeLog.Jan2022
+++ b/gdk/ChangeLog.Jan2022
@@ -1,6 +1,11 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Fri Mar 18 2022 Sjoerd Mullender <sjo...@acm.org>
+- Fixed a race condition which could cause a too large size being written
+  for a .theap file to the BBP.dir file after the correct size file had
+  been saved to disk.
+
 * Wed Mar  9 2022 Sjoerd Mullender <sjo...@acm.org>
 - Fixed a bug in the append code for msk (bit mask) bats.
 - Conversions from floating point types to integral types that involve
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -582,7 +582,8 @@ vheapinit(BAT *b, const char *buf, bat b
                        TRC_CRITICAL(GDK, "cannot allocate memory for heap.");
                        return -1;
                }
-               if (ATOMstorage(b->ttype) == TYPE_str &&
+               if (b->ttype >= 0 &&
+                   ATOMstorage(b->ttype) == TYPE_str &&
                    free < GDK_STRHASHTABLE * sizeof(stridx_t) + BATTINY * 
GDK_VARALIGN)
                        size = GDK_STRHASHTABLE * sizeof(stridx_t) + BATTINY * 
GDK_VARALIGN;
                else if (free < 512)
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -86,6 +86,14 @@ strCleanHash(Heap *h, bool rebuild)
        (void) rebuild;
        if (!h->cleanhash)
                return;
+       if (h->size < GDK_STRHASHTABLE * sizeof(stridx_t) &&
+           HEAPextend(h, GDK_STRHASHTABLE * sizeof(stridx_t) + BATTINY * 
GDK_VARALIGN, true) != GDK_SUCCEED) {
+               GDKclrerr();
+               if (h->size > 0)
+                       memset(h->base, 0, h->size);
+               return;
+       }
+
        /* rebuild hash table for double elimination
         *
         * If appending strings to the BAT was aborted, if the heap
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to