Changeset: 6b3b1396de21 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6b3b1396de21
Modified Files:
        common/utils/matomic.h
        debian/control
        debian/fix-deb.sh
        debian/monetdb-testing-python.install
        gdk/gdk.h
        gdk/gdk_align.c
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_hash.c
        gdk/gdk_hash.h
        gdk/gdk_imprints.c
        gdk/gdk_orderidx.c
        gdk/gdk_private.h
        gdk/gdk_system.h
        gdk/gdk_utils.c
        sql/test/subquery/Tests/subquery2.sql
Branch: default
Log Message:

Merge with Nov2019 branch.


diffs (truncated from 842 to 300 lines):

diff --git a/common/utils/matomic.h b/common/utils/matomic.h
--- a/common/utils/matomic.h
+++ b/common/utils/matomic.h
@@ -476,7 +476,7 @@ ATOMIC_CLEAR(ATOMIC_FLAG *var)
        pthread_mutex_unlock(&var->lck);
 }
 
-#define USE_PTHREAD_LOCKS              /* must use pthread locks */
+#define USE_NATIVE_LOCKS               /* must use pthread locks */
 
 #endif
 
diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends: debhelper (>= 9), autotoo
  libssl-dev, libxml2-dev, pkg-config,
  python, python-dev, python-numpy,
  python3, python3-dev, python3-numpy,
- unixodbc-dev, uuid-dev, zlib1g-dev, liblas-c-dev (>= 1.8.0), r-base,
+ unixodbc-dev, uuid-dev, zlib1g-dev, liblas-c-dev (>= 1.8.0), r-base-dev,
  libcfitsio-dev
 Standards-Version: 3.8.0
 X-Python-Version: >= 2.6
diff --git a/debian/fix-deb.sh b/debian/fix-deb.sh
--- a/debian/fix-deb.sh
+++ b/debian/fix-deb.sh
@@ -49,17 +49,19 @@ jessie)
     # Debian 8 still have php5-cli and doesn't have php*-sockets;
     # newer ones use php-cli and do have php-sockets.
     sed -i 's/php-cli/php5-cli/;s/, *php-sockets//' debian/control
-    ;;
-esac
 
-case $SUITE in
-jessie)
     # The Python 3 version is too old for py3integration.
     sed -i '/^Package: monetdb-python3/,/^$/d' debian/control
     sed -i 's/ python3-dev, python3-numpy,//' debian/control
     rm debian/monetdb-python3.install
     sed -i 's/py3integration=yes/py3integration=no/' debian/rules
-;;
+    ;;
+eoan)
+    # Ubuntu 19.10 (Eoan Ermine) doesn't have liblas-c-dev, hence no LiDAR
+    sed -i 's/ liblas-c-dev[^,]*,//' debian/control
+    sed -i '/^Package: libmonetdb5-server-lidar/,/^$/d' debian/control
+    sed -i '/--enable-lidar=yes/s/yes/no/;/--enable-liblas=yes/s/yes/no/' 
debian/rules
+    ;;
 esac
 
 # debhelper compatibility 9 and later support multiarch by using
diff --git a/debian/monetdb-testing-python.install 
b/debian/monetdb-testing-python.install
--- a/debian/monetdb-testing-python.install
+++ b/debian/monetdb-testing-python.install
@@ -1,3 +1,3 @@
 debian/tmp/usr/bin/Mapprove.py usr/bin
 debian/tmp/usr/bin/Mtest.py usr/bin
-debian/tmp/usr/lib/python3.*/*-packages/MonetDBtesting/*
+debian/tmp/usr/lib/python3*/*-packages/MonetDBtesting/*
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -807,6 +807,8 @@ typedef struct BAT {
 
        /* dynamic column properties */
        COLrec T;               /* column info */
+
+       MT_Lock batIdxLock;     /* lock to manipulate indexes */
 } BAT;
 
 typedef struct BATiter {
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -133,6 +133,7 @@ VIEWcreate(oid seq, BAT *b)
                        BBPunshare(tp);
                if (bn->tvheap)
                        BBPunshare(bn->tvheap->parentid);
+               MT_lock_destroy(&bn->batIdxLock);
                GDKfree(bn);
                return NULL;
        }
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -124,6 +124,9 @@ BATcreatedesc(oid hseq, int tt, bool hea
                bn->tvheap->parentid = bn->batCacheid;
                bn->tvheap->farmid = BBPselectfarm(role, bn->ttype, varheap);
        }
+       char name[16];
+       snprintf(name, sizeof(name), "BATlock%d", bn->batCacheid); /* fits */
+       MT_lock_init(&bn->batIdxLock, name);
        bn->batDirtydesc = true;
        return bn;
       bailout:
@@ -186,16 +189,10 @@ COLnew(oid hseq, int tt, BUN cap, role_t
                cap = (cap + BATTINY - 1) & ~(BATTINY - 1);
        if (cap < BATTINY)
                cap = BATTINY;
-       /* and in case we don't have assertions enabled: limit the size */
+       /* limit the size */
        if (cap > BUN_MAX)
                cap = BUN_MAX;
 
-       /* and in case we don't have assertions enabled: limit the size */
-       if (cap > BUN_MAX) {
-               /* shouldn't happen, but if it does... */
-               assert(0);
-               cap = BUN_MAX;
-       }
        bn = BATcreatedesc(hseq, tt, tt != TYPE_void, role);
        if (bn == NULL)
                return NULL;
@@ -222,6 +219,7 @@ COLnew(oid hseq, int tt, BUN cap, role_t
   bailout:
        BBPclear(bn->batCacheid);
        HEAPfree(&bn->theap, true);
+       MT_lock_destroy(&bn->batIdxLock);
        GDKfree(bn);
        return NULL;
 }
@@ -579,6 +577,7 @@ BATdestroy(BAT *b)
        if (b->tvheap)
                GDKfree(b->tvheap);
        PROPdestroy(b);
+       MT_lock_destroy(&b->batIdxLock);
        GDKfree(b);
 }
 
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -645,14 +645,14 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
        }
 
        /* if growing too much, remove the hash, else we maintain it */
-       MT_lock_set(&GDKhashLock((b)->batCacheid));
+       MT_lock_set(&b->batIdxLock);
        if (b->thash == (Hash *) 1 ||
            (b->thash != NULL &&
             (2 * b->thash->mask) < (BATcount(b) + cnt))) {
-               MT_lock_unset(&GDKhashLock((b)->batCacheid));
+               MT_lock_unset(&b->batIdxLock);
                HASHdestroy(b);
        } else {
-               MT_lock_unset(&GDKhashLock((b)->batCacheid));
+               MT_lock_unset(&b->batIdxLock);
        }
 
        r = BUNlast(b);
@@ -1052,7 +1052,7 @@ BATkeyed(BAT *b)
         * use a lock.  We reuse the hash lock for this, not because
         * this scanning interferes with hashes, but because it's
         * there, and not so likely to be used at the same time. */
-       MT_lock_set(&GDKhashLock(b->batCacheid));
+       MT_lock_set(&b->batIdxLock);
        b->batDirtydesc = true;
        if (!b->tkey && b->tnokey[0] == 0 && b->tnokey[1] == 0) {
                if (b->tsorted || b->trevsorted) {
@@ -1160,7 +1160,7 @@ BATkeyed(BAT *b)
                }
        }
   doreturn:
-       MT_lock_unset(&GDKhashLock(b->batCacheid));
+       MT_lock_unset(&b->batIdxLock);
        return b->tkey;
 }
 
@@ -1182,7 +1182,7 @@ BATordered(BAT *b)
         * use a lock.  We reuse the hash lock for this, not because
         * this scanning interferes with hashes, but because it's
         * there, and not so likely to be used at the same time. */
-       MT_lock_set(&GDKhashLock(b->batCacheid));
+       MT_lock_set(&b->batIdxLock);
        if (!b->tsorted && b->tnosorted == 0) {
                BATiter bi = bat_iterator(b);
                int (*cmpf)(const void *, const void *) = ATOMcompare(b->ttype);
@@ -1249,7 +1249,7 @@ BATordered(BAT *b)
                }
        }
   doreturn:
-       MT_lock_unset(&GDKhashLock(b->batCacheid));
+       MT_lock_unset(&b->batIdxLock);
        return b->tsorted;
 }
 
@@ -1271,7 +1271,7 @@ BATordered_rev(BAT *b)
                return is_oid_nil(b->tseqbase);
        if (BATtdense(b))
                return false;
-       MT_lock_set(&GDKhashLock(b->batCacheid));
+       MT_lock_set(&b->batIdxLock);
        if (!b->trevsorted && b->tnorevsorted == 0) {
                BATiter bi = bat_iterator(b);
                int (*cmpf)(const void *, const void *) = ATOMcompare(b->ttype);
@@ -1288,7 +1288,7 @@ BATordered_rev(BAT *b)
                ALGODEBUG fprintf(stderr, "#BATordered_rev: fixed revsorted for 
%s#" BUNFMT " (" LLFMT " usec)\n", BATgetId(b), BATcount(b), GDKusec() - t0);
        }
   doreturn:
-       MT_lock_unset(&GDKhashLock(b->batCacheid));
+       MT_lock_unset(&b->batIdxLock);
        return b->trevsorted;
 }
 
@@ -1498,7 +1498,7 @@ BATsort(BAT **sorted, BAT **order, BAT *
        mkorderidx = (g == NULL && !reverse && !nilslast && pb != NULL && 
(order || !pb->batTransient));
        if (g == NULL && !reverse && !nilslast &&
            pb != NULL && !BATcheckorderidx(pb)) {
-               MT_lock_set(&GDKhashLock(pb->batCacheid));
+               MT_lock_set(&pb->batIdxLock);
                if (pb->torderidx == NULL) {
                        /* no index created while waiting for lock */
                        if (mkorderidx) /* keep lock when going to create */
@@ -1508,7 +1508,7 @@ BATsort(BAT **sorted, BAT **order, BAT *
                        mkorderidx = false;
                }
                if (!orderidxlock)
-                       MT_lock_unset(&GDKhashLock(pb->batCacheid));
+                       MT_lock_unset(&pb->batIdxLock);
        } else {
                mkorderidx = false;
        }
@@ -1735,7 +1735,7 @@ BATsort(BAT **sorted, BAT **order, BAT *
                                GDKfree(m);
                        }
                        if (orderidxlock)
-                               MT_lock_unset(&GDKhashLock(pb->batCacheid));
+                               MT_lock_unset(&pb->batIdxLock);
                        goto error;
                }
                bn->tsorted = !reverse && !nilslast;
@@ -1758,7 +1758,7 @@ BATsort(BAT **sorted, BAT **order, BAT *
                }
        }
        if (orderidxlock)
-               MT_lock_unset(&GDKhashLock(pb->batCacheid));
+               MT_lock_unset(&pb->batIdxLock);
        bn->theap.dirty = true;
        bn->tnosorted = 0;
        bn->tnorevsorted = 0;
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -173,7 +173,7 @@ BATcheckhash(BAT *b)
        if (b->thash == (Hash *) 1) {
                /* but when we want to change it, we need the lock */
                ACCELDEBUG t = GDKusec();
-               MT_lock_set(&GDKhashLock(b->batCacheid));
+               MT_lock_set(&b->batIdxLock);
                ACCELDEBUG t = GDKusec() - t;
                /* if still 1 now that we have the lock, we can update */
                if (b->thash == (Hash *) 1) {
@@ -231,7 +231,7 @@ BATcheckhash(BAT *b)
                                                           &(oid){h->mask + 1});
                                                b->thash = h;
                                                ACCELDEBUG fprintf(stderr, 
"#BATcheckhash: reusing persisted hash %s\n", BATgetId(b));
-                                               
MT_lock_unset(&GDKhashLock(b->batCacheid));
+                                               MT_lock_unset(&b->batIdxLock);
                                                return true;
                                        }
                                        close(fd);
@@ -242,7 +242,7 @@ BATcheckhash(BAT *b)
                        GDKfree(h);
                        GDKclrerr();    /* we're not currently interested in 
errors */
                }
-               MT_lock_unset(&GDKhashLock(b->batCacheid));
+               MT_lock_unset(&b->batIdxLock);
        }
        ret = b->thash != NULL;
        ACCELDEBUG if (ret) fprintf(stderr, "#BATcheckhash: already has hash 
%s, waited " LLFMT " usec\n", BATgetId(b), t);
@@ -263,7 +263,7 @@ BAThashsync(void *arg)
        /* we could check whether b->thash == NULL before getting the
         * lock, and only lock if it isn't; however, it's very
         * unlikely that that is the case, so we don't */
-       MT_lock_set(&GDKhashLock(b->batCacheid));
+       MT_lock_set(&b->batIdxLock);
        if (b->thash != NULL) {
                Heap *hp = &b->thash->heap;
                /* only persist if parent BAT hasn't changed in the
@@ -304,7 +304,7 @@ BAThashsync(void *arg)
                        ACCELDEBUG fprintf(stderr, "#BAThash: persisting hash 
%s (" LLFMT " usec)%s\n", hp->filename, GDKusec() - t0, failed);
                }
        }
-       MT_lock_unset(&GDKhashLock(b->batCacheid));
+       MT_lock_unset(&b->batIdxLock);
        BBPunfix(b->batCacheid);
 }
 #endif
@@ -556,10 +556,10 @@ BAThash(BAT *b)
        if (BATcheckhash(b)) {
                return GDK_SUCCEED;
        }
-       MT_lock_set(&GDKhashLock(b->batCacheid));
+       MT_lock_set(&b->batIdxLock);
        if (b->thash == NULL) {
                if ((b->thash = BAThash_impl(b, NULL, "thash")) == NULL) {
-                       MT_lock_unset(&GDKhashLock(b->batCacheid));
+                       MT_lock_unset(&b->batIdxLock);
                        return GDK_FAIL;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to