Changeset: 44ee8948ade0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/44ee8948ade0
Modified Files:
        gdk/gdk_bat.c
Branch: default
Log Message:

Merge with Dec2023 branch.


diffs (58 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -798,6 +798,7 @@ COLcopy(BAT *b, int tt, bool writable, r
        bool slowcopy = false;
        BAT *bn = NULL;
        BATiter bi;
+       char strhash[GDK_STRHASHSIZE];
 
        BATcheck(b, NULL);
 
@@ -810,7 +811,24 @@ COLcopy(BAT *b, int tt, bool writable, r
                return NULL;
        }
 
-       bi = bat_iterator(b);
+       /* in case of a string bat, we save the string heap hash table
+        * while we have the lock so that we can restore it in the copy;
+        * this is because during our operation, a parallel thread could
+        * be adding strings to the vheap which would modify the hash
+        * table and that would result in buckets containing values
+        * beyond the original vheap that we're copying */
+       MT_lock_set(&b->theaplock);
+       bi = bat_iterator_nolock(b);
+       if (ATOMstorage(b->ttype) == TYPE_str && b->tvheap->free >= 
GDK_STRHASHSIZE)
+               memcpy(strhash, b->tvheap->base, GDK_STRHASHSIZE);
+
+#ifndef NDEBUG
+       bi.locked = true;
+#endif
+       HEAPincref(bi.h);
+       if (bi.vh)
+               HEAPincref(bi.vh);
+       MT_lock_unset(&b->theaplock);
 
        /* first try case (1); create a view, possibly with different
         * atom-types */
@@ -887,6 +905,8 @@ COLcopy(BAT *b, int tt, bool writable, r
                                memcpy(bn->tvheap->base, bi.vh->base, 
bi.vhfree);
                                bn->tvheap->free = bi.vhfree;
                                bn->tvheap->dirty = true;
+                               if (ATOMstorage(b->ttype) == TYPE_str && 
b->tvheap->free >= GDK_STRHASHSIZE)
+                                       memcpy(b->tvheap->base, strhash, 
GDK_STRHASHSIZE);
                        }
 
                        /* make sure we use the correct capacity */
diff --git a/sql/ChangeLog.Dec2023 b/sql/ChangeLog.Dec2023
--- a/sql/ChangeLog.Dec2023
+++ b/sql/ChangeLog.Dec2023
@@ -2,6 +2,6 @@
 # This file is updated with Maddlog
 
 * Tue Mar 19 2024 Sjoerd Mullender <sjo...@acm.org>
-- Fixed issue where equal column aliases where created. When those
-  aliases where parsed on the remote side it could give crashes.
+- Fixed issue where equal column aliases were created. When those
+  aliases were parsed on the remote side it could give crashes.
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to