Changeset: 5090e72ac7d6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5090e72ac7d6
Modified Files:
        .bumpversion.cfg
        MonetDB.spec
        clients/mapilib/mapi.rc
        clients/odbc/driver/driver.rc
        clients/odbc/winsetup/setup.rc
        cmake/monetdb-versions.cmake
        gdk/libbat.rc
        monetdb5/tools/libmonetdb5.rc
        sql/server/sql_parser.y
Branch: default
Log Message:

Merge with Jun2023 branch.


diffs (truncated from 5338 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -799,3 +799,5 @@ bb95192134c0d8ef8fea525204eefcd0de099a54
 24385ee6130494440e09d31ec73f4aa2e2893e98 Jul2021_33
 05b3d9ea9165baf1d2956d5b06ad85f817ecc6d2 Jul2021_33
 05b3d9ea9165baf1d2956d5b06ad85f817ecc6d2 Jul2021_SP10_release
+ed34ab4283cbfcc57fb9d7387bc9d781c91902b1 Jan2022_27
+ed34ab4283cbfcc57fb9d7387bc9d781c91902b1 Jan2022_SP7_release
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -418,7 +418,21 @@ utf8strlenmax(char *s, char *e, size_t m
                                 * and code points marked either F or
                                 * W in EastAsianWidth.txt; this list
                                 * is up-to-date with Unicode 11.0 */
-                               if ((0x1100 <= c && c <= 0x115F) ||
+                               if ((0x0300 <= c && c <= 0x036F) ||
+                                       (0x0483 <= c && c <= 0x0489) ||
+                                       (0x0653 <= c && c <= 0x0655) ||
+                                       (0x1AB0 <= c && c <= 0x1AFF) ||
+                                       (0x1DC0 <= c && c <= 0x1DFF) ||
+                                       (0x20D0 <= c && c <= 0x20FF) ||
+                                       (0x2DE0 <= c && c <= 0x2DFF) ||
+                                       (0xA66F <= c && c <= 0xA672) ||
+                                       (0xA674 <= c && c <= 0xA67D) ||
+                                       (0xA69E <= c && c <= 0xA69F) ||
+                                       (0xA8E0 <= c && c <= 0xA8F1) ||
+                                       (0xFE20 <= c && c <= 0xFE2F) ||
+                                       c == 0x3099 || c == 0x309A)
+                                       len--;          /* combining mark */
+                               else if ((0x1100 <= c && c <= 0x115F) ||
                                    (0x231A <= c && c <= 0x231B) ||
                                    (0x2329 <= c && c <= 0x232A) ||
                                    (0x23E9 <= c && c <= 0x23EC) ||
diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -121,7 +121,7 @@ SQLhelp sqlhelp1[] = {
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-loading/export_data/"},
        {"COPY INTO BINARY",
         "Write query result data to binary files",
-        "COPY query_expression INTO [{{BIG | LITTLE | NATIVE}} ENDIAN] BINARY 
string_commalist [ON { CLIENT | SERVER }]",
+        "COPY query_expression INTO [{BIG | LITTLE | NATIVE} ENDIAN] BINARY 
string_commalist [ON { CLIENT | SERVER }]",
         "query_expression",
         "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-loading/export_data/"},
        {"COPY INTO FROM",
diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -150,6 +150,7 @@ macro(monetdb_macro_variables)
   set(RHOME "${LIBR_HOME}")
   set(HAVE_GEOM ${GEOS_FOUND})
   set(HAVE_SHP ${GDAL_FOUND})
+  set(SANITIZER ${SANITIZER})
 
   if(PY3INTEGRATION)
     set(HAVE_LIBPY3 "${Python3_NumPy_FOUND}")
diff --git a/gdk/ChangeLog.Sep2022 b/gdk/ChangeLog.Sep2022
--- a/gdk/ChangeLog.Sep2022
+++ b/gdk/ChangeLog.Sep2022
@@ -1,6 +1,11 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Tue May 16 2023 Sjoerd Mullender <sjo...@acm.org>
+- Warnings and informational messages are now sent to stdout instead of
+  stderr, which means that monetdbd will now log them with the tag MSG
+  instead of ERR.
+
 * Tue Apr 25 2023 Sjoerd Mullender <sjo...@acm.org>
 - Fixed parsing of the BBP.dir file when BAT ids grow larger than 2**24
   (i.e. 100000000 in octal).
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -363,9 +363,9 @@ recover_dir(int farmid, bool direxists)
        if (direxists) {
                /* just try; don't care about these non-vital files */
                if (GDKunlink(farmid, BATDIR, "BBP", "bak") != GDK_SUCCEED)
-                       TRC_WARNING(GDK, "unlink of BBP.bak failed\n");
+                       GDKwarning("unlink of BBP.bak failed\n");
                if (GDKmove(farmid, BATDIR, "BBP", "dir", BATDIR, "BBP", "bak", 
false) != GDK_SUCCEED)
-                       TRC_WARNING(GDK, "rename of BBP.dir to BBP.bak 
failed\n");
+                       GDKwarning("rename of BBP.dir to BBP.bak failed\n");
        }
        return GDKmove(farmid, BAKDIR, "BBP", "dir", BATDIR, "BBP", "dir", 
true);
 }
@@ -486,7 +486,7 @@ heapinit(BAT *b, const char *buf,
        }
 
        if (strcmp(type, "wkba") == 0)
-               TRC_WARNING(GDK, "type wkba (SQL name: GeometryA) is 
deprecated\n");
+               GDKwarning("type wkba (SQL name: GeometryA) is deprecated\n");
 
        if (properties & ~0x0F81) {
                TRC_CRITICAL(GDK, "unknown properties are set: incompatible 
database on line %d of BBP.dir\n", lineno);
@@ -1442,7 +1442,7 @@ movestrbats(void)
                                                GDKerror("both %s and %s exist 
with %s unexpectedly newer: manual intervention required\n", oldpath, newpath, 
oldpath);
                                                ret = -1;
                                        } else {
-                                               TRC_WARNING(GDK, "both %s and 
%s exist, removing %s\n", oldpath, newpath, oldpath);
+                                               GDKwarning("both %s and %s 
exist, removing %s\n", oldpath, newpath, oldpath);
                                                ret = MT_remove(oldpath);
                                        }
                                } else {
@@ -3250,8 +3250,8 @@ BBPquickdesc(bat bid)
                const char *aname = ATOMunknown_name(b->ttype);
                int tt = ATOMindex(aname);
                if (tt < 0) {
-                       TRC_WARNING(GDK, "atom '%s' unknown in bat '%s'.\n",
-                                   aname, BBP_physical(bid));
+                       GDKwarning("atom '%s' unknown in bat '%s'.\n",
+                                  aname, BBP_physical(bid));
                } else {
                        b->ttype = tt;
                }
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -142,6 +142,9 @@ HEAPgrow(Heap **hp, size_t size, bool ma
 gdk_return
 HEAPalloc(Heap *h, size_t nitems, size_t itemsize)
 {
+       size_t size = 0;
+       QryCtx *qc = NULL;
+
        h->base = NULL;
        h->size = 1;
        if (itemsize) {
@@ -161,6 +164,16 @@ HEAPalloc(Heap *h, size_t nitems, size_t
             h->size < (h->farmid == 0 ? GDK_mmap_minsize_persistent : 
GDK_mmap_minsize_transient) &&
             h->size < ((GDK_mem_maxsize - allocated) >> 6))) {
                h->storage = STORE_MEM;
+               size = h->size;
+               if (h->farmid == 1 && (qc = MT_thread_get_qry_ctx()) != NULL) {
+                       ATOMIC_BASE_TYPE sz = ATOMIC_ADD(&qc->datasize, size);
+                       sz += size;
+                       if (qc->maxmem > 0 && sz > qc->maxmem) {
+                               ATOMIC_SUB(&qc->datasize, size);
+                               GDKerror("Query using too much memory.\n");
+                               return GDK_FAIL;
+                       }
+               }
                h->base = GDKmalloc(h->size);
                TRC_DEBUG(HEAP, "%s %zu %p\n", h->filename, h->size, h->base);
        }
@@ -171,6 +184,18 @@ HEAPalloc(Heap *h, size_t nitems, size_t
                if (nme == NULL)
                        return GDK_FAIL;
                h->storage = STORE_MMAP;
+               h->size = (h->size + GDK_mmap_pagesize - 1) & 
~(GDK_mmap_pagesize - 1);
+               if (h->farmid == 1 && h->size > size &&
+                   (qc != NULL || (qc = MT_thread_get_qry_ctx()) != NULL)) {
+                       ATOMIC_BASE_TYPE sz = ATOMIC_ADD(&qc->datasize, h->size 
- size);
+                       sz += h->size - size;
+                       size = h->size;
+                       if (qc->maxmem > 0 && sz > qc->maxmem) {
+                               ATOMIC_SUB(&qc->datasize, size);
+                               GDKerror("Query using too much memory.\n");
+                               return GDK_FAIL;
+                       }
+               }
                h->base = HEAPcreatefile(NOFARM, &h->size, nme);
                h->hasfile = true;
        }
@@ -183,24 +208,13 @@ HEAPalloc(Heap *h, size_t nitems, size_t
                        GDKfree(nme);
                        h->hasfile = false; /* just removed it */
                }
+               if (qc != NULL && size > 0)
+                       ATOMIC_SUB(&qc->datasize, size);
                GDKerror("Insufficient space for HEAP of %zu bytes.", h->size);
                return GDK_FAIL;
        }
        GDKfree(nme);
        h->newstorage = h->storage;
-       if (h->farmid == 1) {
-               QryCtx *qc = MT_thread_get_qry_ctx();
-               ATOMIC_BASE_TYPE sz = 0;
-               if (qc) {
-                       sz = ATOMIC_ADD(&qc->datasize, h->size);
-                       sz += h->size;
-                       if (qc->maxmem > 0 && sz > qc->maxmem) {
-                               HEAPfree(h, true);
-                               GDKerror("Query using too much memory.\n");
-                               return GDK_FAIL;
-                       }
-               }
-       }
        return GDK_SUCCEED;
 }
 
@@ -226,6 +240,7 @@ gdk_return
 HEAPextend(Heap *h, size_t size, bool mayshare)
 {
        size_t osize = h->size;
+       QryCtx *qc = NULL;
 
        if (size <= h->size)
                return GDK_SUCCEED;     /* nothing to do */
@@ -256,6 +271,15 @@ HEAPextend(Heap *h, size_t size, bool ma
                if (size == 0)
                        size = GDK_mmap_pagesize;
 
+               if (h->farmid == 1 && (qc = MT_thread_get_qry_ctx()) != NULL) {
+                       ATOMIC_BASE_TYPE sz = ATOMIC_ADD(&qc->datasize, size - 
osize);
+                       sz += size - osize;
+                       if (qc->maxmem > 0 && sz > qc->maxmem) {
+                               GDKerror("Query using too much memory.\n");
+                               ATOMIC_SUB(&qc->datasize, size - osize);
+                               return GDK_FAIL;
+                       }
+               }
                p = GDKmremap(path,
                              h->storage == STORE_PRIV ?
                                MMAP_COPY | MMAP_READ | MMAP_WRITE :
@@ -265,20 +289,10 @@ HEAPextend(Heap *h, size_t size, bool ma
                if (p) {
                        h->size = size;
                        h->base = p;
-                       if (h->farmid == 1) {
-                               QryCtx *qc = MT_thread_get_qry_ctx();
-                               ATOMIC_BASE_TYPE sz = 0;
-                               if (qc) {
-                                       sz = ATOMIC_ADD(&qc->datasize, size - 
osize);
-                                       sz += size - osize;
-                                       if (qc->maxmem > 0 && sz > qc->maxmem) {
-                                               GDKerror("Query using too much 
memory.\n");
-                                               return GDK_FAIL;
-                                       }
-                               }
-                       }
                        return GDK_SUCCEED; /* success */
                }
+               if (qc)
+                       ATOMIC_SUB(&qc->datasize, size - osize);
                failure = "GDKmremap() failed";
        } else {
                /* extend a malloced heap, possibly switching over to
@@ -296,26 +310,26 @@ HEAPextend(Heap *h, size_t size, bool ma
                /* try GDKrealloc if the heap size stays within
                 * reasonable limits */
                if (!must_mmap) {
+                       if (h->farmid == 1 &&(qc = MT_thread_get_qry_ctx()) != 
NULL) {
+                               ATOMIC_BASE_TYPE sz = ATOMIC_ADD(&qc->datasize, 
size - osize);
+                               sz += size - osize;
+                               if (qc->maxmem > 0 && sz > qc->maxmem) {
+                                       GDKerror("Query using too much 
memory.\n");
+                                       ATOMIC_SUB(&qc->datasize, size - osize);
+                                       *h = bak;
+                                       return GDK_FAIL;
+                               }
+                       }
                        h->newstorage = h->storage = STORE_MEM;
                        h->base = GDKrealloc(h->base, size);
                        TRC_DEBUG(HEAP, "Extending malloced heap %s %zu->%zu 
%p->%p\n", h->filename, bak.size, size, bak.base, h->base);
                        if (h->base) {
-                               if (h->farmid == 1) {
-                                       QryCtx *qc = MT_thread_get_qry_ctx();
-                                       ATOMIC_BASE_TYPE sz = 0;
-                                       if (qc) {
-                                               sz = ATOMIC_ADD(&qc->datasize, 
size - osize);
-                                               sz += size - osize;
-                                               if (qc->maxmem > 0 && sz > 
qc->maxmem) {
-                                                       GDKerror("Query using 
too much memory.\n");
-                                                       return GDK_FAIL;
-                                               }
-                                       }
-                               }
                                return GDK_SUCCEED; /* success */
                        }
                        /* bak.base is still valid and may get restored */
                        failure = "h->storage == STORE_MEM && !must_map && 
!h->base";
+                       if (qc != NULL)
+                               ATOMIC_SUB(&qc->datasize, size - osize);
                }
 
                if (!GDKinmemory(h->farmid)) {
@@ -336,6 +350,18 @@ HEAPextend(Heap *h, size_t size, bool ma
                        } else {
                                /* no pre-existing heap file, so create a new
                                 * one */
+                               if (h->farmid == 1 && (qc = 
MT_thread_get_qry_ctx()) != NULL) {
+                                       ATOMIC_BASE_TYPE sz = 0;
+                                       h->size = (h->size + GDK_mmap_pagesize 
- 1) & ~(GDK_mmap_pagesize - 1);
+                                       sz = ATOMIC_ADD(&qc->datasize, h->size);
+                                       sz += h->size;
+                                       if (qc->maxmem > 0 && sz > qc->maxmem) {
+                                               GDKerror("Query using too much 
memory.\n");
+                                               sz = ATOMIC_ADD(&qc->datasize, 
h->size);
+                                               *h = bak;
+                                               return GDK_FAIL;
+                                       }
+                               }
                                h->base = HEAPcreatefile(h->farmid, &h->size, 
h->filename);
                                h->hasfile = true;
                                if (h->base) {
@@ -343,21 +369,11 @@ HEAPextend(Heap *h, size_t size, bool ma
                                        if (bak.free > 0)
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to