Changeset: 2ff5b4701e0e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2ff5b4701e0e
Modified Files:
        gdk/gdk.h
        gdk/gdk_atoms.c
        gdk/gdk_bbp.c
        gdk/gdk_heap.c
Branch: Dec2016
Log Message:

Only clean out the hash table at start of string heap when starting server.
The idea behind cleaning the hash at all is that we can't trust the
contents of the hash table after a server restart since we may have
been half way through changing the string heap when the server shut
down (new entries were added, but not committed, so on restart the
free pointer was reset and the hash table points into limbo).
We now only clean out the hash table at server start, not when
reloading the heap during normal operations.
This should fix bug 6138.


diffs (56 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -635,7 +635,8 @@ typedef struct {
 
        unsigned int copied:1,  /* a copy of an existing map. */
                hashash:1,      /* the string heap contains hash values */
-               forcemap:1;     /* force STORE_MMAP even if heap exists */
+               forcemap:1,     /* force STORE_MMAP even if heap exists */
+               cleanhash:1;    /* string heaps must clean hash */
        storage_t storage;      /* storage mode (mmap/malloc). */
        storage_t newstorage;   /* new desired storage mode at re-allocation. */
        bte dirty;              /* specific heap dirty marker */
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -1130,6 +1130,9 @@ void
 strCleanHash(Heap *h, int rebuild)
 {
        (void) rebuild;
+       if (!h->cleanhash)
+               return;
+       h->cleanhash = 0;
        if (!GDK_ELIMDOUBLES(h)) {
                /* flush hash table for security */
                memset(h->base, 0, GDK_STRHASHSIZE);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1025,6 +1025,7 @@ vheapinit(BAT *b, const char *buf, int h
                b->tvheap->storage = (storage_t) storage;
                b->tvheap->copied = 0;
                b->tvheap->hashash = hashash != 0;
+               b->tvheap->cleanhash = 1;
                b->tvheap->newstorage = (storage_t) storage;
                b->tvheap->dirty = 0;
                b->tvheap->parentid = bid;
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -93,6 +93,7 @@ HEAPalloc(Heap *h, size_t nitems, size_t
        if (itemsize)
                h->size = MAX(1, nitems) * itemsize;
        h->free = 0;
+       h->cleanhash = 0;
 
        /* check for overflow */
        if (itemsize && nitems > (h->size / itemsize)) {
@@ -556,6 +557,7 @@ HEAPcopy(Heap *dst, Heap *src)
                dst->free = src->free;
                memcpy(dst->base, src->base, src->free);
                dst->hashash = src->hashash;
+               dst->cleanhash = src->cleanhash;
                return GDK_SUCCEED;
        }
        return GDK_FAIL;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to