Changeset: ab0f64f41181 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ab0f64f41181
Modified Files:
        gdk/gdk_imprints.c
        gdk/gdk_select.c
Branch: default
Log Message:

Views that want to use an imprint should always obtain a fresh copy from the 
parent bat.


diffs (73 lines):

diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -721,7 +721,9 @@ do {                                    
        MT_lock_unset(&GDKimprintsLock(ABS(b->batCacheid)), "BATimprints");
 
        if (o != NULL) {
-               o->T->imprints = b->T->imprints;
+               o->T->imprints = NULL; /* views always keep null pointer and 
need to
+                                                                 obtain the 
latest imprint from the parent
+                                                                 at query time 
*/
                BBPunfix(b->batCacheid);
                b = o;
        }
@@ -787,11 +789,7 @@ IMPSremove(BAT *b) {
 
        assert(BAThdense(b)); /* assert void head */
        assert(b->T->imprints != NULL);
-
-       if (VIEWtparent(b)) {
-               b->T->imprints = NULL;
-               return;
-       }
+       assert(!VIEWtparent(b));
 
        MT_lock_set(&GDKimprintsLock(ABS(b->batCacheid)),
                        "BATimprints");
@@ -826,11 +824,11 @@ void
 IMPSdestroy(BAT *b) {
 
        if (b) {
-               if (b->T->imprints != NULL) {
+               if (b->T->imprints != NULL && !VIEWtparent(b)) {
                        IMPSremove(b);
                }
 
-               if (b->H->imprints != NULL) {
+               if (b->H->imprints != NULL && !VIEWhparent(b)) {
                        IMPSremove(BATmirror(b));
                }
        }
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -291,7 +291,6 @@ do {                                                        
                    \
 /* choose number of bits */
 #define bitswitch(CAND,TEST)                                               \
 do {                                                                       \
-       Imprints *imprints = b->T->imprints;                                \
        assert(imprints);                                                   \
        ALGODEBUG fprintf(stderr,                                           \
                        "#BATsubselect(b=%s#"BUNFMT",s=%s,anti=%d): "       \
@@ -399,6 +398,7 @@ NAME##_##TYPE (BAT *b, BAT *s, BAT *bn, 
        oid o;                                                               \
        BUN w, p = r;                                                        \
        BUN pr_off = 0;                                                      \
+       Imprints *imprints;                                                  \
        (void) candlist;                                                     \
        (void) li;                                                           \
        (void) hi;                                                           \
@@ -406,9 +406,12 @@ NAME##_##TYPE (BAT *b, BAT *s, BAT *bn, 
        (void) hval;                                                         \
        if (use_imprints && VIEWtparent(b)) {                                \
                BAT *parent = BATmirror(BATdescriptor(VIEWtparent(b)));      \
+               imprints = parent->T->imprints;                              \
                pr_off = (TYPE *)Tloc(b,0) -                                 \
                         (TYPE *)Tloc(parent,0)+BUNfirst(parent);            \
                BBPunfix(parent->batCacheid);                                \
+       } else {                                                             \
+               imprints= b->T->imprints;                                    \
        }                                                                    \
        END;                                                                 \
        if (equi) {                                                          \
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to