Changeset: 3dff7755917e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3dff7755917e
Modified Files:
        gdk/gdk_align.c
        gdk/gdk_bbp.c
        gdk/gdk_hash.c
Branch: Aug2018
Log Message:

Don't share hash heaps between parent and view.
Since views now use their parent's hash if appropriate, we have a more
general approach.


diffs (128 lines):

diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -123,10 +123,7 @@ VIEWcreate(oid seq, BAT *b)
                bn->theap.parentid = tp;
        BATinit_idents(bn);
        bn->batRestricted = BAT_READ;
-       if (!tp || isVIEW(b))
-               bn->thash = NULL;
-       else
-               bn->thash = b->thash;
+       bn->thash = NULL;
        /* imprints are shared, but the check is dynamic */
        bn->timprints = NULL;
        /* Order OID index */
@@ -241,10 +238,6 @@ VIEWunlink(BAT *b)
                if (tpb && b->tprops && b->tprops == tpb->tprops)
                        b->tprops = NULL;
 
-               /* unlink hash accelerators shared with parent */
-               if (tpb && b->thash && b->thash == tpb->thash)
-                       b->thash = NULL;
-
                /* unlink imprints shared with parent */
                if (tpb && b->timprints && b->timprints == tpb->timprints)
                        b->timprints = NULL;
@@ -405,9 +398,6 @@ VIEWbounds(BAT *b, BAT *view, BUN l, BUN
        } else {
                view->tnokey[0] = view->tnokey[1] = 0;
        }
-       /* slices are unequal to their parents; cannot use accs */
-       if (b->thash == view->thash)
-               view->thash = NULL;
 }
 
 /*
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1814,7 +1814,7 @@ BBPdump(void)
                                }
                        }
                }
-               if (b->thash && b->thash != (Hash *) -1) {
+               if (b->thash && b->thash != (Hash *) 1) {
                        fprintf(stderr,
                                " Thash=[%zu,%zu]",
                                HEAPmemsize(&b->thash->heap),
@@ -2394,12 +2394,6 @@ incref(bat i, bool logical, bool lock)
                if (tp) {
                        assert(pb != NULL);
                        b->theap.base = pb->theap.base + (size_t) b->theap.base;
-                       /* if we shared the hash before, share it
-                        * again note that if the parent's hash is
-                        * destroyed, we also don't have a hash
-                        * anymore */
-                       if (b->thash == (Hash *) -1)
-                               b->thash = pb->thash;
                }
                /* done loading, release descriptor */
                BBP_status_off(i, BBPLOADING, "BBPfix");
@@ -2494,12 +2488,6 @@ decref(bat i, bool logical, bool release
                        if (b && refs == 0) {
                                if ((tp = b->theap.parentid) != 0)
                                        b->theap.base = (char *) (b->theap.base 
- BBP_cache(tp)->theap.base);
-                               /* if a view shared the hash with its
-                                * parent, indicate this, but only if
-                                * view isn't getting destroyed */
-                               if (tp && b->thash &&
-                                   b->thash == BBP_cache(tp)->thash)
-                                       b->thash = (Hash *) -1;
                                tvp = VIEWvtparent(b);
                        }
                }
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -649,7 +649,7 @@ HASHdestroy(BAT *b)
                        if (p)
                                hp = BBP_cache(p);
 
-                       if ((!hp || hs != hp->thash) && hs != (Hash *) -1) {
+                       if (!hp || hs != hp->thash) {
                                ALGODEBUG if (*(size_t *) hs->heap.base & (1 << 
24))
                                        fprintf(stderr, "#HASHdestroy: removing 
persisted hash %d\n", b->batCacheid);
                                HEAPfree(&hs->heap, true);
@@ -662,35 +662,14 @@ HASHdestroy(BAT *b)
 void
 HASHfree(BAT *b)
 {
-       int err = 0;
        if (b) {
                MT_lock_set(&GDKhashLock(b->batCacheid));
-               if (b->thash && b->thash != (Hash *) -1) {
-                       if (b->thash != (Hash *) 1) {
-                               if (b->thash->heap.storage == STORE_MEM &&
-                                   b->thash->heap.dirty) {
-                                       if (GDKsave(b->thash->heap.farmid,
-                                                   b->thash->heap.filename,
-                                                   NULL,
-                                                   b->thash->heap.base,
-                                                   b->thash->heap.free,
-                                                   STORE_MEM,
-                                                   false) != GDK_SUCCEED) {
-                                               /* if saving failed, remove */
-                                               
GDKunlink(BBPselectfarm(b->batRole, b->ttype, hashheap),
-                                                         BATDIR,
-                                                         
BBP_physical(b->batCacheid),
-                                                         "thash");
-                                               err = 1;
-                                       }
-                                       b->thash->heap.dirty = FALSE;
-                               }
-                               HEAPfree(&b->thash->heap, false);
-                               GDKfree(b->thash);
-                               b->thash = err ? NULL : (Hash *) 1;
-                       }
-               } else {
-                       b->thash = NULL;
+               if (b->thash && b->thash != (Hash *) 1) {
+                       bool dirty = b->thash->heap.dirty;
+
+                       HEAPfree(&b->thash->heap, dirty);
+                       GDKfree(b->thash);
+                       b->thash = dirty ? NULL : (Hash *) 1;
                }
                MT_lock_unset(&GDKhashLock(b->batCacheid));
        }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to