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

No duplicate bats in subcommit.


diffs (47 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1625,7 +1625,11 @@ BBPdir_subcommit(int cnt, bat *subcommit
        char *p;
        int n;
 
+#ifndef NDEBUG
        assert(subcommit != NULL);
+       for (n = 2; n < cnt; n++)
+               assert(subcommit[n - 1] < subcommit[n]);
+#endif
 
        if ((nbbpf = GDKfilelocate(0, "BBP", "w", "dir")) == NULL)
                return GDK_FAIL;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2806,6 +2806,7 @@ logger_add_bat(logger *lg, BAT *b, const
        bid = b->batCacheid;
        if (lg->debug & 1)
                fprintf(stderr, "#create %s\n", name);
+       assert(log_find(lg->catalog_bid, lg->dcatalog, bid) == BUN_NONE);
        lg->changes += BATcount(b) + 1;
        BUNappend(lg->catalog_bid, &bid, FALSE);
        BUNappend(lg->catalog_nme, name, FALSE);
diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c
--- a/gdk/gdk_tm.c
+++ b/gdk/gdk_tm.c
@@ -183,6 +183,17 @@ TMsubcommit_list(bat *subcommit, int cnt
        GDKqsort(subcommit + 1, NULL, NULL, cnt - 1, sizeof(bat), 0, TYPE_bat);
 
        assert(cnt == 1 || subcommit[1] > 0);  /* all values > 0 */
+       /* de-duplication of BAT ids in subcommit list
+        * this is needed because of legacy reasons (database
+        * upgrade) */
+       for (xx = 2; xx < cnt; xx++) {
+               if (subcommit[xx-1] == subcommit[xx]) {
+                       int i;
+                       cnt--;
+                       for (i = xx; i < cnt; i++)
+                               subcommit[i] = subcommit[i+1];
+               }
+       }
        if (prelude(cnt, subcommit) == GDK_SUCCEED) {   /* save the new bats 
outside the lock */
                /* lock just prevents BBPtrims, and other global
                 * (sub-)commits */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to