Changeset: 0bfbeee010c4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0bfbeee010c4
Branch: logger-fix
Log Message:

merged with sep2022


diffs (truncated from 408 to 300 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -48606,7 +48606,7 @@ Write db snapshot to the given tar(.gz) 
 sql
 hot_snapshot
 unsafe pattern sql.hot_snapshot(X_0:str, X_1:bit):void 
-SQLhot_snapshot_wrap;
+SQLhot_snapshot;
 Write db snapshot to the given tar(.gz/.lz4/.bz/.xz) file on either server or 
client
 sql
 importColumn
diff --git a/clients/Tests/MAL-signatures.test 
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -37006,7 +37006,7 @@ Write db snapshot to the given tar(.gz) 
 sql
 hot_snapshot
 unsafe pattern sql.hot_snapshot(X_0:str, X_1:bit):void 
-SQLhot_snapshot_wrap;
+SQLhot_snapshot;
 Write db snapshot to the given tar(.gz/.lz4/.bz/.xz) file on either server or 
client
 sql
 importColumn
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -550,6 +550,9 @@ heapinit(BAT *b, const char *buf,
                return -1;
        }
 
+       if (strcmp(type, "wkba") == 0)
+               TRC_WARNING(GDK, "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);
                return -1;
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -100,10 +100,11 @@ HASHclear(Hash *h)
        memset(h->Bckt, 0xFF, h->nbucket * h->width);
 }
 
-#define HASH_VERSION           4
-/* this is only for the change of hash function of the UUID type; if
- * HASH_VERSION is increased again from 4, the code associated with
- * HASH_VERSION_NOUUID must be deleted */
+#define HASH_VERSION           5
+/* this is only for the change of hash function of the UUID type and MBR
+ * type; if HASH_VERSION is increased again from 5, the code associated
+ * with HASH_VERSION_NOUUID and HASH_VERSION_NOMBR must be deleted */
+#define HASH_VERSION_NOMBR     4
 #define HASH_VERSION_NOUUID    3
 #define HASH_HEADER_SIZE       7       /* nr of size_t fields in header */
 
@@ -508,7 +509,17 @@ BATcheckhash(BAT *b)
                                                         ((size_t) 1 << 24) |
 #endif
                                                         HASH_VERSION_NOUUID) &&
-                                                strcmp(ATOMname(b->ttype), 
"uuid") != 0)
+                                                strcmp(ATOMname(b->ttype), 
"uuid") != 0 &&
+                                                strcmp(ATOMname(b->ttype), 
"mbr") != 0)
+#endif
+#ifdef HASH_VERSION_NOMBR
+                                            /* if not uuid, also allow 
previous version */
+                                            || (hdata[0] == (
+#ifdef PERSISTENTHASH
+                                                        ((size_t) 1 << 24) |
+#endif
+                                                        HASH_VERSION_NOMBR) &&
+                                                strcmp(ATOMname(b->ttype), 
"mbr") != 0)
 #endif
                                                    ) &&
                                            hdata[1] > 0 &&
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -5169,7 +5169,15 @@ wkbHASH(const void *W)
        BUN h = 0;
 
        for (i = 0; i < (w->len - 1); i += 2) {
-               int a = *(w->data + i), b = *(w->data + i + 1);
+               BUN a = ((unsigned char *) w->data)[i];
+               BUN b = ((unsigned char *) w->data)[i + 1];
+#if '\377' < 0                                 /* char is signed? */
+               /* maybe sign extend */
+               if (a & 0x80)
+                       a |= ~(BUN)0x7f;
+               if (b & 0x80)
+                       b |= ~(BUN)0x7f;
+#endif
                h = (h << 3) ^ (h >> 11) ^ (h >> 17) ^ (b << 8) ^ a;
        }
        return h;
@@ -5396,7 +5404,8 @@ static BUN
 mbrHASH(const void *ATOM)
 {
        const mbr *atom = ATOM;
-       return (BUN) (((int) atom->xmin * (int)atom->ymin) *((int) atom->xmax * 
(int)atom->ymax));
+       return ATOMhash(TYPE_flt, &atom->xmin) ^ ATOMhash(TYPE_flt, 
&atom->ymin) ^
+               ATOMhash(TYPE_flt, &atom->xmax) ^ ATOMhash(TYPE_flt, 
&atom->ymax);
 }
 
 static const void *
@@ -5622,7 +5631,15 @@ wkbaHASH(const void *WARRAY)
        for (j = 0; j < wArray->itemsNum; j++) {
                wkb *w = wArray->data[j];
                for (i = 0; i < (w->len - 1); i += 2) {
-                       int a = *(w->data + i), b = *(w->data + i + 1);
+                       BUN a = ((unsigned char *) w->data)[i];
+                       BUN b = ((unsigned char *) w->data)[i + 1];
+#if '\377' < 0                                 /* char is signed? */
+                       /* maybe sign extend */
+                       if (a & 0x80)
+                               a |= ~(BUN)0x7f;
+                       if (b & 0x80)
+                               b |= ~(BUN)0x7f;
+#endif
                        h = (h << 3) ^ (h >> 11) ^ (h >> 17) ^ (b << 8) ^ a;
                }
        }
diff --git a/monetdb5/modules/mal/mat.c b/monetdb5/modules/mal/mat.c
--- a/monetdb5/modules/mal/mat.c
+++ b/monetdb5/modules/mal/mat.c
@@ -141,8 +141,9 @@ MATpackIncrement(Client cntxt, MalBlkPtr
                        throw(MAL, "mat.pack", SQLSTATE(HY013) MAL_MALLOC_FAIL);
                }
                /* allocate enough space for the vheap, but not for strings,
-                * since BATappend does clever things for strings */
-               if ( b->tvheap && bn->tvheap && ATOMstorage(b->ttype) != 
TYPE_str){
+                * since BATappend does clever things for strings, and not for
+                * vheap views since they may well get shared */
+               if (b->tvheap && b->tvheap->parentid == b->batCacheid && 
bn->tvheap && ATOMstorage(b->ttype) != TYPE_str){
                        newsize =  b->tvheap->size * pieces;
                        if (HEAPextend(bn->tvheap, newsize, true) != 
GDK_SUCCEED) {
                                BBPunfix(b->batCacheid);
diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c
--- a/monetdb5/optimizer/opt_pipes.c
+++ b/monetdb5/optimizer/opt_pipes.c
@@ -56,8 +56,8 @@ static struct PIPELINES {
         "optimizer.generator();"
         //"optimizer.candidates();" only for decoration in explain
         //"optimizer.mask();"
-        "optimizer.garbageCollector();"
-        "optimizer.profiler();",
+        "optimizer.profiler();"
+        "optimizer.garbageCollector();",
         "stable", NULL, 1},
 #ifdef USE_STRIMPS_OPTIMIZERS
        {"minimal_strimps_pipe",
@@ -121,8 +121,8 @@ static struct PIPELINES {
         "optimizer.postfix();"
 //      "optimizer.jit();" awaiting the new batcalc api
         "optimizer.wlc();"
-        "optimizer.garbageCollector();"
-        "optimizer.profiler();",
+        "optimizer.profiler();"
+        "optimizer.garbageCollector();",
         "stable", NULL, 1},
 #ifdef USE_STRIMPS_OPTIMIZERS
        {"strimps_pipe",
@@ -157,8 +157,8 @@ static struct PIPELINES {
         "optimizer.postfix();"
 //      "optimizer.jit();" awaiting the new batcalc api
         "optimizer.wlc();"
-        "optimizer.garbageCollector();"
-        "optimizer.profiler();",
+        "optimizer.profiler();"
+        "optimizer.garbageCollector();",
         "stable", NULL, 1},
 #endif  // USE_STRIMPS_OPTIMIZERS
        {"default_fast",
@@ -201,8 +201,8 @@ static struct PIPELINES {
         "optimizer.postfix();"
 //      "optimizer.jit();" awaiting the new batcalc api
         "optimizer.wlc();"
-        "optimizer.garbageCollector();"
-        "optimizer.profiler();",
+        "optimizer.profiler();"
+        "optimizer.garbageCollector();",
         "stable", NULL, 1},
 #endif
 /* The no_mitosis pipe line is (and should be kept!) identical to the
@@ -245,8 +245,8 @@ static struct PIPELINES {
         "optimizer.postfix();"
 //      "optimizer.jit();" awaiting the new batcalc api
         "optimizer.wlc();"
-        "optimizer.garbageCollector();"
-        "optimizer.profiler();",
+        "optimizer.profiler();"
+        "optimizer.garbageCollector();",
         "stable", NULL, 1},
 /* The sequential pipe line is (and should be kept!) identical to the
  * default pipeline, except that optimizers mitosis & dataflow are
@@ -289,8 +289,8 @@ static struct PIPELINES {
         "optimizer.postfix();"
 //      "optimizer.jit();" awaiting the new batcalc api
         "optimizer.wlc();"
-        "optimizer.garbageCollector();"
-        "optimizer.profiler();",
+        "optimizer.profiler();"
+        "optimizer.garbageCollector();",
         "stable", NULL, 1},
 /* Experimental pipelines stressing various components under
  * development.  Do not use any of these pipelines in production
@@ -437,8 +437,8 @@ getPipeCatalog(bat *nme, bat *def, bat *
 static str
 validatePipe(MalBlkPtr mb)
 {
-       int mitosis = FALSE, deadcode = FALSE, mergetable = FALSE, multiplex = 
FALSE;
-       int bincopyfrom = FALSE, garbage = FALSE, generator = FALSE, remap =  
FALSE;
+       bool mitosis = false, deadcode = false, mergetable = false, multiplex = 
false;
+       bool bincopyfrom = false, garbage = false, generator = false, remap =  
false;
        int i;
        InstrPtr p;
 
@@ -455,42 +455,45 @@ validatePipe(MalBlkPtr mb)
        for (i = 1; i < mb->stop - 1; i++){
                p = getInstrPtr(mb, i);
                const char *fname = getFunctionId(p);
+               if (garbage)
+                       throw(MAL, "optimizer.validate", SQLSTATE(42000) 
"'garbageCollector' should be used as the last one\n");
+               garbage = false;
                if (fname != NULL) {
                        if (strcmp(fname, "deadcode") == 0)
-                               deadcode = TRUE;
+                               deadcode = true;
                        else if (strcmp(fname, "remap") == 0)
-                               remap = TRUE;
+                               remap = true;
                        else if (strcmp(fname, "mitosis") == 0)
-                               mitosis = TRUE;
+                               mitosis = true;
                        else if (strcmp(fname, "bincopyfrom") == 0)
-                               bincopyfrom = TRUE;
+                               bincopyfrom = true;
                        else if (strcmp(fname, "mergetable") == 0)
-                               mergetable = TRUE;
+                               mergetable = true;
                        else if (strcmp(fname, "multiplex") == 0)
-                               multiplex = TRUE;
+                               multiplex = true;
                        else if (strcmp(fname, "generator") == 0)
-                               generator = TRUE;
+                               generator = true;
                        else if (strcmp(fname, "garbageCollector") == 0)
-                               garbage = TRUE;
+                               garbage = true;
                } else
                        throw(MAL, "optimizer.validate", SQLSTATE(42000) 
"Missing optimizer call\n");
        }
 
-       if (mitosis == TRUE && mergetable == FALSE)
+       if (mitosis && !mergetable)
                throw(MAL, "optimizer.validate", SQLSTATE(42000) "'mitosis' 
needs 'mergetable'\n");
 
        /* several optimizer should be used */
-       if (multiplex == 0)
+       if (!multiplex)
                throw(MAL, "optimizer.validate", SQLSTATE(42000) "'multiplex' 
should be used\n");
-       if (deadcode == FALSE)
+       if (!deadcode)
                throw(MAL, "optimizer.validate", SQLSTATE(42000) "'deadcode' 
should be used at least once\n");
-       if (garbage == FALSE)
+       if (!garbage)
                throw(MAL, "optimizer.validate", SQLSTATE(42000) 
"'garbageCollector' should be used as the last one\n");
-       if (remap == FALSE)
+       if (!remap)
                throw(MAL, "optimizer.validate", SQLSTATE(42000) "'remap' 
should be used\n");
-       if (generator == FALSE)
+       if (!generator)
                throw(MAL, "optimizer.validate", SQLSTATE(42000) "'generator' 
should be used\n");
-       if (bincopyfrom == FALSE)
+       if (!bincopyfrom)
                throw(MAL, "optimizer.validate", SQLSTATE(42000) "'bincopyfrom' 
should be used\n");
 
        return MAL_SUCCEED;
diff --git a/sql/ChangeLog.Sep2022 b/sql/ChangeLog.Sep2022
--- a/sql/ChangeLog.Sep2022
+++ b/sql/ChangeLog.Sep2022
@@ -1,6 +1,10 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Wed Apr  5 2023 Sjoerd Mullender <sjo...@acm.org>
+- When creating a hot snapshot, allow other clients to proceed, even
+  with updating queries.
+
 * Fri Mar 24 2023 Sjoerd Mullender <sjo...@acm.org>
 - Increased the size of a variable counting the number of changes made
   to the database (e.g. in case more than a 2 billion rows are added to
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -4322,25 +4322,9 @@ SQLsuspend_log_flushing(Client cntxt, Ma
 }
 
 str
-/*SQLhot_snapshot(void *ret, const str *tarfile_arg)*/
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to