Changeset: c8fd537c0429 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8fd537c0429
Modified Files:
        gdk/gdk_utils.c
Branch: Nov2019
Log Message:

Merge heads.


diffs (truncated from 5055 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -670,6 +670,9 @@
 /* The size of `char', as computed by sizeof. */
 #define SIZEOF_CHAR 1
 
+/* The size of `double', as computed by sizeof. */
+#define SIZEOF_DOUBLE 8
+
 /* The size of `int', as computed by sizeof. */
 #define SIZEOF_INT 4
 
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2285,6 +2285,7 @@ AC_CHECK_SIZEOF([int])
 AC_CHECK_SIZEOF([long])
 AC_CHECK_SIZEOF([void *])
 AC_CHECK_SIZEOF([size_t])
+AC_CHECK_SIZEOF([double])
 AC_CHECK_SIZEOF([ssize_t])
 AC_CHECK_SIZEOF([ptrdiff_t],,[@%:@include <stddef.h>])
 AC_CHECK_SIZEOF([wchar_t],,[@%:@include <stddef.h>])
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -129,10 +129,14 @@ VIEWcreate(oid seq, BAT *b)
        /* Order OID index */
        bn->torderidx = NULL;
        if (BBPcacheit(bn, true) != GDK_SUCCEED) {      /* enter in BBP */
-               if (tp)
+               if (tp) {
                        BBPunshare(tp);
-               if (bn->tvheap)
+                       BBPunfix(tp);
+               }
+               if (bn->tvheap) {
                        BBPunshare(bn->tvheap->parentid);
+                       BBPunfix(bn->tvheap->parentid);
+               }
                MT_lock_destroy(&bn->batIdxLock);
                GDKfree(bn);
                return NULL;
@@ -284,7 +288,7 @@ VIEWreset(BAT *b)
                        if (th == NULL)
                                goto bailout;
                        th->farmid = BBPselectfarm(b->batRole, b->ttype, 
varheap);
-                       stpconcat(th->filename, nme, ".tail", NULL);
+                       stpconcat(th->filename, nme, ".theap", NULL);
                        if (ATOMheap(b->ttype, th, cnt) != GDK_SUCCEED)
                                goto bailout;
                }
@@ -349,7 +353,7 @@ VIEWreset(BAT *b)
                b->batCapacity = cnt;
 
                /* insert all of v in b, and quit */
-               if (BATappend(b, v, NULL, false) != GDK_SUCCEED)
+               if (BATappend2(b, v, NULL, false, false) != GDK_SUCCEED)
                        goto bailout;
                BBPreclaim(v);
        }
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -38,6 +38,7 @@ unshare_string_heap(BAT *b)
                        return GDK_FAIL;
                }
                BBPunshare(b->tvheap->parentid);
+               BBPunfix(b->tvheap->parentid);
                b->tvheap = h;
        }
        return GDK_SUCCEED;
@@ -54,7 +55,7 @@ unshare_string_heap(BAT *b)
 #endif
 
 static gdk_return
-insert_string_bat(BAT *b, BAT *n, BAT *s, bool force)
+insert_string_bat(BAT *b, BAT *n, BAT *s, bool force, bool mayshare)
 {
        BATiter ni;             /* iterator */
        size_t toff = ~(size_t) 0;      /* tail offset */
@@ -104,11 +105,13 @@ insert_string_bat(BAT *b, BAT *n, BAT *s
                        /* if cand != NULL, there is no wholesale
                         * copying of n's offset heap, but we may
                         * still be able to share the string heap */
-                       if (b->batCount == 0 &&
+                       if (mayshare &&
+                           b->batCount == 0 &&
                            b->tvheap != n->tvheap &&
                            cand == NULL) {
                                if (b->tvheap->parentid != bid) {
                                        BBPunshare(b->tvheap->parentid);
+                                       BBPunfix(b->tvheap->parentid);
                                } else {
                                        HEAPfree(b->tvheap, true);
                                        GDKfree(b->tvheap);
@@ -420,7 +423,7 @@ insert_string_bat(BAT *b, BAT *n, BAT *s
 }
 
 static gdk_return
-append_varsized_bat(BAT *b, BAT *n, BAT *s)
+append_varsized_bat(BAT *b, BAT *n, BAT *s, bool mayshare)
 {
        BATiter ni;
        BUN start, end, cnt, r;
@@ -437,7 +440,8 @@ append_varsized_bat(BAT *b, BAT *n, BAT 
        cnt = cand ? (BUN) (candend - cand) : end - start;
        if (cnt == 0)
                return GDK_SUCCEED;
-       if (BATcount(b) == 0 &&
+       if (mayshare &&
+           BATcount(b) == 0 &&
            b->batRole == TRANSIENT &&
            n->batRestricted == BAT_READ &&
            b->tvheap != n->tvheap) {
@@ -446,6 +450,7 @@ append_varsized_bat(BAT *b, BAT *n, BAT 
                 * to n's */
                if (b->tvheap->parentid != b->batCacheid) {
                        BBPunshare(b->tvheap->parentid);
+                       BBPunfix(b->tvheap->parentid);
                } else {
                        HEAPfree(b->tvheap, true);
                        GDKfree(b->tvheap);
@@ -491,6 +496,7 @@ append_varsized_bat(BAT *b, BAT *n, BAT 
                        return GDK_FAIL;
                }
                BBPunshare(b->tvheap->parentid);
+               BBPunfix(b->tvheap->parentid);
                b->tvheap = h;
        }
        /* copy data from n to b */
@@ -527,7 +533,7 @@ append_varsized_bat(BAT *b, BAT *n, BAT 
  * list s) to BAT b.  If b is empty, b will get the seqbase of s if it
  * was passed in, and else the seqbase of n. */
 gdk_return
-BATappend(BAT *b, BAT *n, BAT *s, bool force)
+BATappend2(BAT *b, BAT *n, BAT *s, bool force, bool mayshare)
 {
        BUN start, end, cnt;
        BUN r;
@@ -757,13 +763,13 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
                b->tnil |= n->tnil && cnt == BATcount(n);
        }
        if (b->ttype == TYPE_str) {
-               if (insert_string_bat(b, n, s, force) != GDK_SUCCEED) {
+               if (insert_string_bat(b, n, s, force, mayshare) != GDK_SUCCEED) 
{
                        if (b->tunique)
                                BBPunfix(s->batCacheid);
                        return GDK_FAIL;
                }
        } else if (ATOMvarsized(b->ttype)) {
-               if (append_varsized_bat(b, n, s) != GDK_SUCCEED) {
+               if (append_varsized_bat(b, n, s, mayshare) != GDK_SUCCEED) {
                        if (b->tunique)
                                BBPunfix(s->batCacheid);
                        return GDK_FAIL;
@@ -814,6 +820,12 @@ BATappend(BAT *b, BAT *n, BAT *s, bool f
 }
 
 gdk_return
+BATappend(BAT *b, BAT *n, BAT *s, bool force)
+{
+       return BATappend2(b, n, s, force, true);
+}
+
+gdk_return
 BATdel(BAT *b, BAT *d)
 {
        int (*unfix) (const void *) = BATatoms[b->ttype].atomUnfix;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -3018,7 +3018,7 @@ log_tstart(logger *lg)
 #define DBLKSZ         8192
 #define SEGSZ          (64*DBLKSZ)
 
-#define LOG_LARGE      LL_CONSTANT(2)*1024*1024*1024
+#define LOG_LARGE      (LL_CONSTANT(2)*1024*1024*1024)
 
 static gdk_return
 pre_allocate(logger *lg)
@@ -3031,6 +3031,7 @@ pre_allocate(logger *lg)
        if (p == -1)
                return GDK_FAIL;
        if (p > LOG_LARGE) {
+               logger_close(lg);
                lg->id++;
                return logger_open(lg);
        }
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -45,6 +45,8 @@ enum heaptype {
        __attribute__((__visibility__("hidden")));
 __hidden void ATOMunknown_clean(void)
        __attribute__((__visibility__("hidden")));
+__hidden gdk_return BATappend2(BAT *b, BAT *n, BAT *s, bool force, bool 
mayshare)
+       __attribute__((__visibility__("hidden")));
 __hidden bool BATcheckhash(BAT *b)
        __attribute__((__visibility__("hidden")));
 __hidden bool BATcheckimprints(BAT *b)
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -901,10 +901,10 @@ BATdelete(BAT *b)
        assert(bid > 0);
        if (loaded) {
                b = loaded;
-               HASHdestroy(b);
-               IMPSdestroy(b);
-               OIDXdestroy(b);
        }
+       HASHdestroy(b);
+       IMPSdestroy(b);
+       OIDXdestroy(b);
        if (b->batCopiedtodisk || (b->theap.storage != STORE_MEM)) {
                if (b->ttype != TYPE_void &&
                    HEAPdelete(&b->theap, o, "tail") != GDK_SUCCEED &&
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -258,7 +258,7 @@ strPut(Heap *h, var_t *dst, const char *
                                if ((v[i] & 0xC0) != 0x80 ||
                                    (m != 0 && (v[i] & m) == 0)) {
                                  badutf8:
-                                       GDKerror("strPut: incorrectly encoded 
UTF-8");
+                                       GDKerror("strPut: incorrectly encoded 
UTF-8: '%s'", v);
                                        return 0;
                                }
                                m = 0;
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -641,6 +641,8 @@ GDKinit(opt *set, int setlen)
        static_assert(sizeof(hge) == SIZEOF_HGE,
                      "error in configure: bad value for SIZEOF_HGE");
 #endif
+               static_assert(sizeof(dbl) == SIZEOF_DOUBLE,
+                     "error in configure: bad value for SIZEOF_DOUBLE");
        static_assert(sizeof(oid) == SIZEOF_OID,
                      "error in configure: bad value for SIZEOF_OID");
        static_assert(sizeof(void *) == SIZEOF_VOID_P,
@@ -1568,7 +1570,7 @@ THRcreate(void (*f) (void *), void *arg,
        Thread s;
        struct THRstart *t;
        static ATOMIC_TYPE ctr = ATOMIC_VAR_INIT(0);
-       char semname[16];
+       char semname[32];
        int len;
 
        if ((t = GDKmalloc(sizeof(*t))) == NULL)
diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h
--- a/geom/lib/libgeom.h
+++ b/geom/lib/libgeom.h
@@ -29,6 +29,7 @@
 #include <geos_c.h>
 
 #ifdef HAVE_PROJ
+#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
 #include <proj_api.h> //it is needed to transform from one srid to another
 #endif
 
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -45,7 +45,7 @@ wkbNULLcopy(void)
 #ifdef HAVE_PROJ
 
 /** convert degrees to radians */
-static void
+static inline void
 degrees2radians(double *x, double *y, double *z)
 {
        *x *= M_PI / 180.0;
@@ -54,7 +54,7 @@ degrees2radians(double *x, double *y, do
 }
 
 /** convert radians to degrees */
-static void
+static inline void
 radians2degrees(double *x, double *y, double *z)
 {
        *x *= 180.0 / M_PI;
diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c
--- a/monetdb5/extras/rapi/rapi.c
+++ b/monetdb5/extras/rapi/rapi.c
@@ -30,6 +30,7 @@
 
 #define USE_RINTERNALS 1
 
+#include <Rversion.h>
 #include <Rembedded.h>
 #include <Rdefines.h>
 #include <Rinternals.h>
@@ -110,25 +111,34 @@ static char *RAPIinitialize(void) {
        // set some command line arguments
        {
                structRstart rp;
-               Rstart Rp = &rp;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to