Changeset: a4d161a0d9e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a4d161a0d9e5
Modified Files:
        gdk/gdk_hash.c
Branch: linear-hashing
Log Message:

Deal with 0 and 1 pointers properly.


diffs (32 lines):

diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -1000,14 +1000,20 @@ HASHins(BAT *b, BUN i, const void *v)
 {
        MT_lock_set(&b->batIdxLock);
        Hash *h = b->thash;
-       if (h == (Hash *) 1 ||
-           h == NULL ||
-           (ATOMsize(b->ttype) > 2 &&
-            HASHgrowbucket(b) != GDK_SUCCEED) ||
-           ((i + 1) * h->width > h->heaplink.size &&
-            HEAPextend(&h->heaplink,
-                       i * h->width + GDK_mmap_pagesize,
-                       true) != GDK_SUCCEED)) {
+       if (h == NULL) {
+               /* nothing to do */
+       } else if (h == (Hash *) 1) {
+               GDKunlink(BBPselectfarm(b->batRole, b->ttype, hashheap),
+                         BATDIR,
+                         BBP_physical(b->batCacheid),
+                         "thash");
+               b->thash = NULL;
+       } else if ((ATOMsize(b->ttype) > 2 &&
+                   HASHgrowbucket(b) != GDK_SUCCEED) ||
+                  ((i + 1) * h->width > h->heaplink.size &&
+                   HEAPextend(&h->heaplink,
+                              i * h->width + GDK_mmap_pagesize,
+                              true) != GDK_SUCCEED)) {
                b->thash = NULL;
                HEAPfree(&h->heapbckt, true);
                HEAPfree(&h->heaplink, true);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to