Changeset: b3df36b99669 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b3df36b99669
Modified Files:
        monetdb5/modules/atoms/json.c
        monetdb5/modules/mal/tablet.c
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_upgrades.c
        sql/server/sql_parser.y
        sql/storage/bat/bat_storage.c
        sql/test/Dependencies/Tests/dependency_owner_schema_3.test
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.int128
        tools/mserver/mserver5.c
Branch: nested
Log Message:

merge with default


diffs (truncated from 6361 to 300 lines):

diff --git a/.github/DISCUSSION_TEMPLATE/general.yml 
b/.github/DISCUSSION_TEMPLATE/general.yml
--- a/.github/DISCUSSION_TEMPLATE/general.yml
+++ b/.github/DISCUSSION_TEMPLATE/general.yml
@@ -31,6 +31,6 @@ body:
   - type: markdown
     attributes:
       value: |
-        If the above is not provided and cannot be inferred from your GitHub 
profile page,
-        we might close your discussion without further review. Refer to the
+        If we find the above answers questionable and it is not obvious from 
your GitHub profile page,
+        we reserve the right to close your discussion without further review. 
Please refer to the
         [reasoning behind this 
rule](https://berthub.eu/articles/posts/anonymous-help/) if you have questions.
diff --git a/.github/DISCUSSION_TEMPLATE/questions.yml 
b/.github/DISCUSSION_TEMPLATE/questions.yml
--- a/.github/DISCUSSION_TEMPLATE/questions.yml
+++ b/.github/DISCUSSION_TEMPLATE/questions.yml
@@ -25,6 +25,6 @@ body:
   - type: markdown
     attributes:
       value: |
-        If the above is not provided and cannot be inferred from your GitHub 
profile page,
-        we might close your question without further review. Refer to the
+        If we find the above answers questionable and it is not obvious from 
your GitHub profile page,
+        we reserve the right to close your question without further review. 
Please refer to the
         [reasoning behind this 
rule](https://berthub.eu/articles/posts/anonymous-help/) if you have questions.
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml 
b/.github/ISSUE_TEMPLATE/bug_report.yml
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -77,6 +77,6 @@ body:
   - type: markdown
     attributes:
       value: |
-        If the above is not given and is not obvious from your GitHub profile 
page,
-        we might close your issue without further review. Please refer to the
+        If we find the above answers questionable and it is not obvious from 
your GitHub profile page,
+        we reserve the right to close your issue without further review. 
Please refer to the
         [reasoning behind this 
rule](https://berthub.eu/articles/posts/anonymous-help/) if you have questions.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml 
b/.github/ISSUE_TEMPLATE/feature_request.yml
--- a/.github/ISSUE_TEMPLATE/feature_request.yml
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -52,6 +52,6 @@ body:
   - type: markdown
     attributes:
       value: |
-        If the above is not provided and cannot be inferred from your GitHub 
profile page,
-        we might close your issue without further review. Refer to the
+        If we find the above answers questionable and it is not obvious from 
your GitHub profile page,
+        we reserve the right to close your issue without further review. 
Please refer to the
         [reasoning behind this 
rule](https://berthub.eu/articles/posts/anonymous-help/) if you have questions.
diff --git a/cmake/Modules/FindValgrind.cmake b/cmake/Modules/FindValgrind.cmake
--- a/cmake/Modules/FindValgrind.cmake
+++ b/cmake/Modules/FindValgrind.cmake
@@ -6,33 +6,21 @@
 # VALGRIND_FOUND       - True if valgrind found.
 
 find_path(VALGRIND_INCLUDE_DIR
-  NAMES valgrind.h)
-
-find_library(VALGRIND_LIBRARIES
-  NAMES valgrind)
+  NAMES valgrind.h
+  PATH_SUFFIXES valgrind)
 
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Valgrind
   DEFAULT_MSG
-  VALGRIND_LIBRARIES
   VALGRIND_INCLUDE_DIR)
 
-mark_as_advanced(VALGRIND_INCLUDE_DIR
-  VALGRIND_LIBRARIES)
+mark_as_advanced(VALGRIND_INCLUDE_DIR)
 
 if(VALGRIND_FOUND)
-  if(NOT TARGET VALGRIND::VALGRIND AND
-      (EXISTS "${VALGRIND_LIBRARIES}"))
+  if(NOT TARGET VALGRIND::VALGRIND)
     add_library(VALGRIND::VALGRIND UNKNOWN IMPORTED)
     set_target_properties(VALGRIND::VALGRIND
       PROPERTIES
       INTERFACE_INCLUDE_DIRECTORIES "${VALGRIND_INCLUDE_DIR}")
-
-    if(EXISTS "${VALGRIND_LIBRARIES}")
-      set_target_properties(VALGRIND::VALGRIND
-        PROPERTIES
-        IMPORTED_LINK_INTERFACE_LANGUAGES "C"
-        IMPORTED_LOCATION "${VALGRIND_LIBRARIES}")
-    endif()
   endif()
 endif()
diff --git a/common/stream/socket_stream.c b/common/stream/socket_stream.c
--- a/common/stream/socket_stream.c
+++ b/common/stream/socket_stream.c
@@ -426,20 +426,6 @@ socket_read(stream *restrict s, void *re
                        mnstr_set_error_errno(s, errno == EINTR ? 
MNSTR_INTERRUPT : MNSTR_READ_ERROR, NULL);
                        return -1;
                }
-#ifdef HAVE_SYS_UN_H
-               /* when reading a block size in a block stream
-                * (elmsize==2,cnt==1), we may actually get an "OOB" message
-                * when this is a Unix domain socket */
-               if (s->putoob == socket_putoob_unix &&
-                       elmsize == 2 && cnt == 1 && nr == 2 &&
-                       ((char *)buf)[0] == OOBMSG0 &&
-                       ((char *)buf)[1] == OOBMSG1) {
-                       /* also read (and discard) the "pay load" */
-                       (void) recv(s->stream_data.s, buf, 1, 0);
-                       mnstr_set_error(s, MNSTR_INTERRUPT, "query abort from 
client");
-                       return -1;
-               }
-#endif
                break;
        }
        if (nr == 0) {
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -100,6 +100,7 @@ target_include_directories(bat
   $<TARGET_PROPERTY:matomic,INTERFACE_INCLUDE_DIRECTORIES>
   $<TARGET_PROPERTY:mstring,INTERFACE_INCLUDE_DIRECTORIES>
   
$<$<BOOL:${RTREE_FOUND}>:$<TARGET_PROPERTY:rtree::rtree,INTERFACE_INCLUDE_DIRECTORIES>>
+  
$<$<BOOL:${VALGRIND_FOUND}>:$<TARGET_PROPERTY:VALGRIND::VALGRIND,INTERFACE_INCLUDE_DIRECTORIES>>
   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monetdb>
   $<$<BOOL:${OPENSSL_FOUND}>:${OPENSSL_INCLUDE_DIR}>)
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -428,6 +428,7 @@ typedef struct BAT {
        MT_RWLock thashlock;    /* lock specifically for hash management */
        MT_Lock batIdxLock;     /* lock to manipulate other indexes/properties 
*/
        Heap *oldtail;          /* old tail heap, to be destroyed after commit 
*/
+       QryCtx *qc;             /* query context of owner if transient */
 } BAT;
 
 /* some access functions for the bitmask type */
@@ -465,10 +466,26 @@ gdk_export size_t HEAPmemsize(Heap *h);
 gdk_export void HEAPdecref(Heap *h, bool remove);
 gdk_export void HEAPincref(Heap *h);
 
-#define VIEWtparent(x) ((x)->theap == NULL || (x)->theap->parentid == 
(x)->batCacheid ? 0 : (x)->theap->parentid)
-#define VIEWvtparent(x)        ((x)->tvheap == NULL || (x)->tvheap->parentid 
== (x)->batCacheid ? 0 : (x)->tvheap->parentid)
+__attribute__((__pure__))
+static inline bat
+VIEWtparent(const BAT *b)
+{
+       return b->theap == NULL || b->theap->parentid == b->batCacheid ? 0 : 
b->theap->parentid;
+}
 
-#define isVIEW(x)      (VIEWtparent(x) != 0 || VIEWvtparent(x) != 0)
+__attribute__((__pure__))
+static inline bat
+VIEWvtparent(const BAT *b)
+{
+       return b->tvheap == NULL || b->tvheap->parentid == b->batCacheid ? 0 : 
b->tvheap->parentid;
+}
+
+__attribute__((__pure__))
+static inline bool
+isVIEW(const BAT *b)
+{
+       return VIEWtparent(b) != 0 || VIEWvtparent(b) != 0;
+}
 
 typedef struct {
        char *logical;          /* logical name (may point at bak) */
@@ -1101,10 +1118,14 @@ BATsettrivprop(BAT *b)
                                /* the only value is NIL */
                                b->tminpos = BUN_NONE;
                                b->tmaxpos = BUN_NONE;
+                               b->tnil = true;
+                               b->tnonil = false;
                        } else {
                                /* the only value is both min and max */
                                b->tminpos = 0;
                                b->tmaxpos = 0;
+                               b->tnonil = true;
+                               b->tnil = false;
                        }
                } else {
                        b->tsorted = false;
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -176,6 +176,7 @@ BATcreatedesc(oid hseq, int tt, bool hea
                .theap = h,
                .tvheap = vh,
                .creator_tid = MT_getpid(),
+               .qc = role == TRANSIENT ? MT_thread_get_qry_ctx() : NULL,
        };
 
        if (bn->theap) {
@@ -786,6 +787,13 @@ COLcopy2(BAT *b, int tt, bool writable, 
                         * offset heap is only (less than) half the size
                         * of the parent's offset heap */
                        slowcopy = true;
+               } else if (bi.vh && role == PERSISTENT && !writable) {
+                       /* writable usually means no view, but
+                        * role==PERSISTENT already implies that, so we
+                        * use it to decide whether we can do a faster
+                        * memcpy (if true) or must do a slower
+                        * individual insert (if false) */
+                       slowcopy = true;
                }
        }
 
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1675,6 +1675,7 @@ BBPtrim(bool aggressive, bat nbat)
                MT_lock_unset(&GDKswapLock(bid));
                if (swap) {
                        TRC_DEBUG(BAT, "unload and free bat %d\n", bid);
+                       MT_thread_set_qry_ctx(b->qc);
                        if (BBPfree(b) != GDK_SUCCEED)
                                GDKerror("unload failed for bat %d", bid);
                        n++;
@@ -1687,6 +1688,7 @@ BBPtrim(bool aggressive, bat nbat)
                        MT_sleep_ms(2);
                }
        }
+       MT_thread_set_qry_ctx(NULL);
        if (n > 0)
                TRC_INFO(BAT, "unloaded %d bats, %zu%s bytes in "LLFMT" 
usec%s\n", n, mem, humansize(mem, (char[24]){0}, 24), GDKusec() - t0, 
aggressive ? " (also hot)" : "");
        return changed;
diff --git a/gdk/gdk_calc_addsub.c b/gdk/gdk_calc_addsub.c
--- a/gdk/gdk_calc_addsub.c
+++ b/gdk/gdk_calc_addsub.c
@@ -1456,12 +1456,10 @@ addstr_loop(BAT *b1, const char *l, BAT 
                        llen = strlen(l);
                        rlen = strlen(r);
                        if (llen + rlen >= slen) {
-                               /* ma_close(&ta_state); */
-                               /* ta_state = ma_open(ta); */
-                               slen = llen + rlen + 1024;
-                               s = ma_alloc(ta, slen);
+                               s = ma_realloc(ta, s, llen + rlen + 1024, slen);
                                if (s == NULL)
                                        goto bailout;
+                               slen = llen + rlen + 1024;
                        }
                        (void) stpcpy(stpcpy(s, l), r);
                        if (tfastins_nocheckVAR(bn, i, s) != GDK_SUCCEED)
diff --git a/gdk/gdk_cand.h b/gdk/gdk_cand.h
--- a/gdk/gdk_cand.h
+++ b/gdk/gdk_cand.h
@@ -143,7 +143,12 @@ candmask_pop(uint32_t x)
 #undef BUILTIN_USED
 }
 
-#define canditer_next_dense(ci)                ((ci)->seq + (ci)->next++)
+static inline oid
+canditer_next_dense(struct canditer *ci)
+{
+       return ci->seq + ci->next++;
+}
+
 static inline oid
 canditer_next(struct canditer *ci)
 {
@@ -192,7 +197,14 @@ gdk_export oid canditer_peekprev(const s
        __attribute__((__pure__));
 gdk_export oid canditer_idx(const struct canditer *ci, BUN p)
        __attribute__((__pure__));
-#define canditer_idx_dense(ci, p) ((p >= (ci)->ncand)?oid_nil:((ci)->seq + p))
+
+__attribute__((__pure__))
+static inline oid
+canditer_idx_dense(const struct canditer *ci, BUN p)
+{
+       return p >= ci->ncand ? oid_nil : ci->seq + p;
+}
+
 gdk_export void canditer_setidx(struct canditer *ci, BUN p);
 gdk_export void canditer_reset(struct canditer *ci);
 
@@ -207,6 +219,7 @@ canditer_search_dense(const struct candi
        else
                return o - ci->seq;
 }
+
 gdk_export BUN canditer_search(const struct canditer *ci, oid o, bool next)
        __attribute__((__pure__));
 
@@ -228,6 +241,7 @@ canditer_contains(const struct canditer 
        }
        return canditer_search(ci, o, false) != BUN_NONE;
 }
+
 gdk_export oid canditer_mask_next(const struct canditer *ci, oid o, bool next)
        __attribute__((__pure__));
 
diff --git a/gdk/gdk_hash.h b/gdk/gdk_hash.h
--- a/gdk/gdk_hash.h
+++ b/gdk/gdk_hash.h
@@ -157,9 +157,9 @@ HASHgetlink(const Hash *h, BUN i)
 }
 
 /* mix_bte(0x80) == 0x80 */
-#define mix_bte(X)     ((unsigned int) (unsigned char) (X))
+#define mix_bte(X)     ((unsigned int) (uint8_t) (X))
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to