Changeset: ea723073ccf3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ea723073ccf3
Modified Files:
        MonetDB/src/gdk/gdk_bbp.mx
        MonetDB/src/gdk/gdk_search.mx
Branch: Oct2010
Log Message:

Fix for views sharing a hash with their parent.

When a view's physical reference count goes down to zero, the parent's
physical reference count may also go down to zero.  This means that
the parent may be unloaded.  If the view shares the hash with its
parent, the hash pointer becomes invalid when the parent is unloaded.
So we now remember that we shared the hash (by setting it to -1) and
restore the hash pointer when the view's reference count goes up from
0.  It may be that the parent lost its hash in the mean time, but then
the view just lost the hash as well.


diffs (57 lines):

diff -r 24b278db3ea1 -r ea723073ccf3 MonetDB/src/gdk/gdk_bbp.mx
--- a/MonetDB/src/gdk/gdk_bbp.mx        Wed Oct 13 14:31:20 2010 +0200
+++ b/MonetDB/src/gdk/gdk_bbp.mx        Wed Oct 13 17:59:02 2010 +0200
@@ -1913,6 +1913,12 @@
                                b = getBBPdescriptor(hp, lock);
                                bs->B.H->heap.base = b->H->heap.base + (size_t) 
bs->B.H->heap.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 (bs->B.H->hash == (Hash *) -1)
+                               bs->B.H->hash = b->H->hash;
                }
                if (tp) {
                        incref(tp, 0, lock);
@@ -1921,6 +1927,12 @@
                                b = getBBPdescriptor(tp, lock);
                                bs->B.T->heap.base = b->H->heap.base + (size_t) 
bs->B.T->heap.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 (bs->B.T->hash == (Hash *) -1)
+                               bs->B.T->hash = b->H->hash;
                }
                if (hvp)
                        incref(hvp, 0, lock);
@@ -2011,6 +2023,15 @@
                                    b->H != b->T &&
                                    !b->P->lview)
                                        b->T->heap.base = (char *) 
(b->T->heap.base - BBP_cache(tp)->H->heap.base);
+                               /* if a view shared the hash with its
+                                  parent, indicate this, but only if
+                                  view isn't getting destroyed */
+                               if (hp && b->H->hash &&
+                                   b->H->hash == BBP_cache(hp)->H->hash)
+                                       b->H->hash = (Hash *) -1;
+                               if (tp && b->T->hash &&
+                                   b->T->hash == BBP_cache(tp)->H->hash)
+                                       b->T->hash = (Hash *) -1;
                                hvp = VIEWvhparent(b);
                                tvp = VIEWvtparent(b);
                        }
diff -r 24b278db3ea1 -r ea723073ccf3 MonetDB/src/gdk/gdk_search.mx
--- a/MonetDB/src/gdk/gdk_search.mx     Wed Oct 13 14:31:20 2010 +0200
+++ b/MonetDB/src/gdk/gdk_search.mx     Wed Oct 13 17:59:02 2010 +0200
@@ -624,7 +624,7 @@
                if (p)
                        hp = BBP_cache(p);
 
-               if (!hp || b->H->hash != hp->H->hash) {
+               if ((!hp || b->H->hash != hp->H->hash) && b->H->hash != (Hash 
*) -1) {
                        HEAPfree(b->H->hash->heap);
                        if (b->H->hash->heap->storage != STORE_MEM)
                                HEAPdelete(b->H->hash->heap, 
BBP_physical(b->batCacheid), (b->batCacheid > 0) ? "hhash" : "thash");
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to