Changeset: 803f067c823e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=803f067c823e
Modified Files:
        gdk/gdk_group.c
        gdk/gdk_join.c
        gdk/gdk_logger.c
        gdk/gdk_private.h
        gdk/gdk_select.c
        gdk/gdk_system_private.h
        gdk/gdk_unique.c
Branch: Jul2015
Log Message:

Easily disable hash on persistent parent bat.


diffs (171 lines):

diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -760,9 +760,12 @@ BATgroup_internal(BAT **groups, BAT **ex
                GDKfree(sgrps);
        } else if (BATcheckhash(b) ||
                   (b->batPersistence == PERSISTENT &&
-                   BAThash(b, 0) == GDK_SUCCEED) ||
-                  ((parent = VIEWtparent(b)) != 0 &&
-                   BATcheckhash(BBPdescriptor(-parent)))) {
+                   BAThash(b, 0) == GDK_SUCCEED)
+#ifndef DISABLE_PARENT_HASH
+                  || ((parent = VIEWtparent(b)) != 0 &&
+                      BATcheckhash(BBPdescriptor(-parent)))
+#endif
+               ) {
                BUN lo, hi;
 
                /* we already have a hash table on b, or b is
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -1884,6 +1884,7 @@ hashjoin(BAT *r1, BAT *r2, BAT *l, BAT *
        }
 
        rl = BUNfirst(r);
+#ifndef DISABLE_PARENT_HASH
        if (VIEWtparent(r)) {
                BAT *b = BBPdescriptor(-VIEWtparent(r));
                if (b->batPersistence == PERSISTENT || BATcheckhash(b)) {
@@ -1904,6 +1905,7 @@ hashjoin(BAT *r1, BAT *r2, BAT *l, BAT *
                                        BATgetId(b), BATcount(b));
                }
        }
+#endif
        rh = rl + rend;
        rl += rstart;
        rseq += rstart;
@@ -2968,17 +2970,23 @@ BATsubjoin(BAT **r1p, BAT **r2p, BAT *l,
 
        lparent = VIEWtparent(l);
        rparent = VIEWtparent(r);
+#ifndef DISABLE_PARENT_HASH
        if (lparent) {
                lpcount = BATcount(BBPdescriptor(lparent));
                lhash = BATcheckhash(l) || 
BATcheckhash(BBPdescriptor(-lparent));
-       } else {
+       } else
+#endif
+       {
                lpcount = BATcount(l);
                lhash = BATcheckhash(l);
        }
+#ifndef DISABLE_PARENT_HASH
        if (rparent) {
                rpcount = BATcount(BBPdescriptor(rparent));
                rhash = BATcheckhash(r) || 
BATcheckhash(BBPdescriptor(-rparent));
-       } else {
+       } else
+#endif
+       {
                rpcount = BATcount(r);
                rhash = BATcheckhash(r);
        }
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1089,7 +1089,7 @@ check_version(logger *lg, FILE *fp)
        if (version != lg->version) {
                if (lg->prefuncp == NULL ||
                    (*lg->prefuncp)(version, lg->version) != 0) {
-                       GDKerror("Incompatible database version %06d, "
+                       GDKfatal("Incompatible database version %06d, "
                                 "this server supports version %06d.\n%s",
                                 version, lg->version,
                                 version < lg->version ? "Maybe you need to 
upgrade to an intermediate release first.\n" : "");
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -12,6 +12,8 @@
 #error this file should not be included outside its source directory
 #endif
 
+/* #define DISABLE_PARENT_HASH 1 */
+
 #include "gdk_system_private.h"
 
 enum heaptype {
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -176,6 +176,7 @@ BAT_hashselect(BAT *b, BAT *s, BAT *bn, 
        seq = b->hseqbase;
        l = BUNfirst(b);
        h = BUNlast(b);
+#ifndef DISABLE_PARENT_HASH
        if (VIEWtparent(b)) {
                BAT *b2 = BBPdescriptor(-VIEWtparent(b));
                if (b2->batPersistence == PERSISTENT || BATcheckhash(b2)) {
@@ -197,6 +198,7 @@ BAT_hashselect(BAT *b, BAT *s, BAT *bn, 
                                        BATgetId(b2), BATcount(b2));
                }
        }
+#endif
        if (s && BATtdense(s)) {
                /* no need for binary search in s, we just adjust the
                 * boundaries */
@@ -1616,18 +1618,27 @@ BATsubselect(BAT *b, BAT *s, const void 
         * persistent and the total size wouldn't be too large; check
         * for existence of hash last since that may involve I/O */
        hash = equi &&
-               (((b->batPersistence == PERSISTENT ||
-                 (parent != 0 &&
-                  BBPquickdesc(abs(parent),0)->batPersistence == PERSISTENT)) 
&&
+               (((b->batPersistence == PERSISTENT
+#ifndef DISABLE_PARENT_HASH
+                  || (parent != 0 &&
+                      BBPquickdesc(abs(parent),0)->batPersistence == 
PERSISTENT)
+#endif
+                         ) &&
                 (size_t) ATOMsize(b->ttype) >= sizeof(BUN) / 4 &&
                  BATcount(b) * (ATOMsize(b->ttype) + 2 * sizeof(BUN)) < 
GDK_mem_maxsize / 2) ||
-                (BATcheckhash(b) ||
-                 (parent != 0 &&
-                  BATcheckhash(BBPdescriptor(-parent)))));
+                (BATcheckhash(b)
+#ifndef DISABLE_PARENT_HASH
+                 || (parent != 0 &&
+                     BATcheckhash(BBPdescriptor(-parent)))
+#endif
+                        ));
        if (hash &&
            estimate == BUN_NONE &&
-           !BATcheckhash(b) &&
-           (parent == 0 || !BATcheckhash(BBPdescriptor(-parent)))) {
+           !BATcheckhash(b)
+#ifndef DISABLE_PARENT_HASH
+           && (parent == 0 || !BATcheckhash(BBPdescriptor(-parent)))
+#endif
+               ) {
                /* no exact result size, but we need estimate to choose
                 * between hash- & scan-select
                 * (if we already have a hash, it's a no-brainer: we
diff --git a/gdk/gdk_system_private.h b/gdk/gdk_system_private.h
--- a/gdk/gdk_system_private.h
+++ b/gdk/gdk_system_private.h
@@ -19,3 +19,5 @@
        __attribute__((__visibility__("hidden")));
 __hidden int MT_kill_thread(MT_Id t)
        __attribute__((__visibility__("hidden")));
+
+/* #define DISABLE_PARENT_HASH 1 */
diff --git a/gdk/gdk_unique.c b/gdk/gdk_unique.c
--- a/gdk/gdk_unique.c
+++ b/gdk/gdk_unique.c
@@ -243,9 +243,12 @@ BATsubunique(BAT *b, BAT *s)
                seen = NULL;
        } else if (BATcheckhash(b) ||
                   (b->batPersistence == PERSISTENT &&
-                   BAThash(b, 0) == GDK_SUCCEED) ||
-                  ((parent = VIEWtparent(b)) != 0 &&
-                   BATcheckhash(BBPdescriptor(-parent)))) {
+                   BAThash(b, 0) == GDK_SUCCEED)
+#ifndef DISABLE_PARENT_HASH
+                  || ((parent = VIEWtparent(b)) != 0 &&
+                      BATcheckhash(BBPdescriptor(-parent)))
+#endif
+               ) {
                BUN lo;
                oid seq;
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to