Changeset: d82fa49c1a2b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d82fa49c1a2b
Modified Files:
        gdk/gdk_bbp.c
Branch: Jul2015
Log Message:

Clear revsorted bit if necessary.
This is to fix the result of the bug that was fixed in changeset
4161d2234597.


diffs (74 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -808,12 +808,13 @@ vheapinit(COLrec *col, const char *buf, 
        return n;
 }
 
-static void
+static int
 BBPreadEntries(FILE *fp, int *min_stamp, int *max_stamp, int oidsize, int 
bbpversion)
 {
        bat bid = 0;
        char buf[4096];
        BATstore *bs;
+       int needcommit = 0;
 
        /* read the BBP.dir and insert the BATs into the BBP */
        while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -899,6 +900,21 @@ BBPreadEntries(FILE *fp, int *min_stamp,
                nread += vheapinit(&bs->H, buf + nread, Hhashash, bid);
                nread += vheapinit(&bs->T, buf + nread, Thashash, bid);
 
+               if (bs->S.count > 1) {
+                       /* fix result of bug in BATappend not clearing
+                        * revsorted property */
+                       if (bs->H.type == TYPE_void && bs->H.seq != oid_nil && 
bs->H.revsorted) {
+                               bs->H.revsorted = 0;
+                               bs->S.descdirty = 1;
+                               needcommit = 1;
+                       }
+                       if (bs->T.type == TYPE_void && bs->T.seq != oid_nil && 
bs->T.revsorted) {
+                               bs->T.revsorted = 0;
+                               bs->S.descdirty = 1;
+                               needcommit = 1;
+                       }
+               }
+
                if (buf[nread] != '\n' && buf[nread] != ' ')
                        GDKfatal("BBPinit: invalid format for BBP.dir\n%s", 
buf);
                if (buf[nread] == ' ')
@@ -931,6 +947,7 @@ BBPreadEntries(FILE *fp, int *min_stamp,
                BBP_refs(bid) = 0;
                BBP_lrefs(bid) = 1;     /* any BAT we encounter here is 
persistent, so has a logical reference */
        }
+       return needcommit;
 }
 
 #ifdef HAVE_HGE
@@ -1042,6 +1059,7 @@ BBPinit(void)
        int bbpversion;
        int oidsize;
        oid BBPoid;
+       int needcommit;
 
 #ifdef NEED_MT_LOCK_INIT
        MT_lock_init(&GDKunloadLock, "GDKunloadLock");
@@ -1093,7 +1111,7 @@ BBPinit(void)
        BBPextend(0, FALSE);            /* allocate BBP records */
        ATOMIC_SET(BBPsize, 1, BBPsizeLock, "BBPinit");
 
-       BBPreadEntries(fp, &min_stamp, &max_stamp, oidsize, bbpversion);
+       needcommit = BBPreadEntries(fp, &min_stamp, &max_stamp, oidsize, 
bbpversion);
        fclose(fp);
 
        /* normalize saved LRU stamps */
@@ -1122,7 +1140,7 @@ BBPinit(void)
 #else
        (void) oidsize;
 #endif
-       if (bbpversion < GDKLIBRARY)
+       if (bbpversion < GDKLIBRARY || needcommit)
                TMcommit();
 
        return;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to