Changeset: 750af8fa0b35 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/750af8fa0b35
Modified Files:
        sql/backends/monet5/CMakeLists.txt
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/rel_tvtree.c
Branch: tvtree
Log Message:

Merges branch nested


diffs (truncated from 5804 to 300 lines):

diff --git a/clients/ChangeLog.Mar2025 b/clients/ChangeLog.Mar2025
--- a/clients/ChangeLog.Mar2025
+++ b/clients/ChangeLog.Mar2025
@@ -1,3 +1,7 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Tue Feb 18 2025 Sjoerd Mullender <[email protected]>
+- Support for dumping databases from servers from before Jul2021 (11.41.X)
+  has been removed.
+
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -365,7 +365,7 @@ gdk_return MT_alloc_tls(MT_TLS_t *newkey
 int MT_check_nr_cores(void);
 void MT_cond_broadcast(MT_Cond *cond);
 void MT_cond_destroy(MT_Cond *cond);
-void MT_cond_init(MT_Cond *cond);
+void MT_cond_init(MT_Cond *cond, const char *name);
 void MT_cond_signal(MT_Cond *cond);
 void MT_cond_wait(MT_Cond *cond, MT_Lock *lock);
 int MT_create_thread(MT_Id *t, void (*function)(void *), void *arg, enum 
MT_thr_detach d, const char *threadname);
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -298,8 +298,10 @@ bailout:
        return 0;
 }
 
+/* columns sys.db_user_info.max_memory and sys.db_user_info.max_workers
+ * introduced Sep2022 */
 static bool
-has_schema_path(Mapi mid)
+has_schema_max_memory(Mapi mid)
 {
        MapiHdl hdl;
        bool ret;
@@ -308,7 +310,7 @@ has_schema_path(Mapi mid)
        if (answer >= 0)
                return answer;
 
-       if ((hdl = mapi_query(mid, "select id from sys._columns where table_id 
= (select id from sys._tables where name = 'db_user_info' and schema_id = 
(select id from sys.schemas where name = 'sys')) and name = 'schema_path'")) == 
NULL ||
+       if ((hdl = mapi_query(mid, "select id from sys._columns where table_id 
= (select id from sys._tables where name = 'db_user_info' and schema_id = 2000) 
and name = 'max_memory'")) == NULL ||
            mapi_error(mid))
                goto bailout;
        ret = mapi_get_row_count(hdl) == 1;
@@ -334,83 +336,7 @@ bailout:
        return false;
 }
 
-static bool
-has_schema_max_memory(Mapi mid)
-{
-       MapiHdl hdl;
-       bool ret;
-       static int answer = -1;
-
-       if (answer >= 0)
-               return answer;
-
-       if ((hdl = mapi_query(mid, "select id from sys._columns where table_id 
= (select id from sys._tables where name = 'db_user_info' and schema_id = 
(select id from sys.schemas where name = 'sys')) and name = 'max_memory'")) == 
NULL ||
-           mapi_error(mid))
-               goto bailout;
-       ret = mapi_get_row_count(hdl) == 1;
-       while ((mapi_fetch_row(hdl)) != 0) {
-               if (mapi_error(mid))
-                       goto bailout;
-       }
-       if (mapi_error(mid))
-               goto bailout;
-       mapi_close_handle(hdl);
-       answer = ret;
-       return ret;
-
-bailout:
-       if (hdl) {
-               if (mapi_result_error(hdl))
-                       mapi_explain_result(hdl, stderr);
-               else
-                       mapi_explain_query(hdl, stderr);
-               mapi_close_handle(hdl);
-       } else
-               mapi_explain(mid, stderr);
-       return false;
-}
-
-static bool
-has_table_partitions(Mapi mid)
-{
-       MapiHdl hdl;
-       bool ret;
-       static int answer = -1;
-
-       if (answer >= 0)
-               return answer;
-
-       if ((hdl = mapi_query(mid,
-                             "select id from sys._tables"
-                             " where name = 'table_partitions'"
-                             " and schema_id = ("
-                             "select id from sys.schemas"
-                             " where name = 'sys')")) == NULL ||
-           mapi_error(mid))
-               goto bailout;
-       ret = mapi_get_row_count(hdl) == 1;
-       while ((mapi_fetch_row(hdl)) != 0) {
-               if (mapi_error(mid))
-                       goto bailout;
-       }
-       if (mapi_error(mid))
-               goto bailout;
-       mapi_close_handle(hdl);
-       answer = ret;
-       return ret;
-
-bailout:
-       if (hdl) {
-               if (mapi_result_error(hdl))
-                       mapi_explain_result(hdl, stderr);
-               else
-                       mapi_explain_query(hdl, stderr);
-               mapi_close_handle(hdl);
-       } else
-               mapi_explain(mid, stderr);
-       return false;
-}
-
+/* table sys.remote_user_info introduced Jun2023 */
 static bool
 has_remote_user_info_table(Mapi mid)
 {
@@ -424,9 +350,7 @@ has_remote_user_info_table(Mapi mid)
        if ((hdl = mapi_query(mid,
                              "select id from sys._tables"
                              " where name = 'remote_user_info'"
-                             " and schema_id = ("
-                             "select id from sys.schemas"
-                             " where name = 'sys')")) == NULL ||
+                             " and schema_id = 2000")) == NULL ||
            mapi_error(mid))
                goto bailout;
        ret = mapi_get_row_count(hdl) == 1;
@@ -1496,7 +1420,7 @@ describe_table(Mapi mid, const char *sch
                        squoted_print(sqlf, rt_hash, '\'', false);
                        mapi_close_handle(hdl);
                        hdl = NULL;
-               } else if (type == 3 && has_table_partitions(mid)) { /* A merge 
table might be partitioned */
+               } else if (type == 3) { /* A merge table might be partitioned */
                        int properties = 0;
 
                        snprintf(query, maxquerylen, "SELECT tp.type FROM 
sys.table_partitions tp WHERE tp.table_id = '%d'", table_id);
@@ -2820,7 +2744,6 @@ dump_database(Mapi mid, stream *sqlf, co
                             "AND t.sqlname NOT IN 
('geometrya','mbr','url','inet','json','uuid')))"
                "ORDER BY s.name, t.sqlname";
        const char *users =
-               has_schema_path(mid) ?
                has_schema_max_memory(mid) ?
                "SELECT ui.name, "
                       "ui.fullname, "
@@ -2848,18 +2771,6 @@ dump_database(Mapi mid, stream *sqlf, co
                "WHERE ui.default_schema = s.id "
                  "AND ui.name <> 'monetdb' "
                  "AND ui.name <> '.snapshot' "
-               "ORDER BY ui.name" :
-               "SELECT ui.name, "
-                      "ui.fullname, "
-                      "sys.password_hash(ui.name), "
-                      "s.name, "
-                          "cast(null as clob), "
-                          "0, 0, 'default_pipe', cast(null as clob) "
-               "FROM sys.db_user_info ui, "
-                    "sys.schemas s "
-               "WHERE ui.default_schema = s.id "
-                 "AND ui.name <> 'monetdb' "
-                 "AND ui.name <> '.snapshot' "
                "ORDER BY ui.name";
        const char roles[] =
                "SELECT name "
@@ -3036,8 +2947,7 @@ dump_database(Mapi mid, stream *sqlf, co
                  "AND t.system = FALSE "
                  "AND s.id = t.schema_id "
                "ORDER BY id";
-       const char *mergetables =
-               has_table_partitions(mid) ?
+       const char mergetables[] =
                "SELECT subq.s1name, "
                       "subq.t1name, "
                       "subq.s2name, "
@@ -3063,26 +2973,7 @@ dump_database(Mapi mid, stream *sqlf, co
                        "AND t2.schema_id = s2.id "
                      "ORDER BY t1.id, t2.id) subq "
                        "LEFT OUTER JOIN sys.table_partitions "
-                               "ON subq.id = table_partitions.table_id"
-               :
-               "SELECT s1.name, "
-                      "t1.name, "
-                      "s2.name, "
-                      "t2.name, "
-                      "0 "
-               "FROM sys.schemas s1, "
-                    "sys._tables t1, "
-                    "sys.dependencies d, "
-                    "sys.schemas s2, "
-                    "sys._tables t2 "
-               "WHERE t1.type = 3 "
-                 "AND t1.schema_id = s1.id "
-                 "AND s1.name <> 'tmp' "
-                 "AND t1.system = FALSE "
-                 "AND t1.id = d.depend_id "
-                 "AND d.id = t2.id "
-                 "AND t2.schema_id = s2.id "
-               "ORDER BY t1.id, t2.id";
+                               "ON subq.id = table_partitions.table_id";
        /* we must dump views, functions/procedures and triggers in order
         * of creation since they can refer to each other */
        const char views_functions_triggers[] =
diff --git a/documentation/source/manual_pages/mserver5.rst.in 
b/documentation/source/manual_pages/mserver5.rst.in
--- a/documentation/source/manual_pages/mserver5.rst.in
+++ b/documentation/source/manual_pages/mserver5.rst.in
@@ -82,7 +82,8 @@ MSERVER5 OPTIONS
 **--loadmodule=**\ *module*
    Load extra module in the form of a dynamic link library (.dll or .so
    file) which should be located in the lib/monetdb5 directory. This
-   option can be repeated for different modules.
+   option can be repeated for different modules. Also see the
+   **loadmodules** entry in *monetdb*\ (1).
 
 **--without-geom**
    Start the server without *geom* support, even if it is available.
@@ -216,6 +217,9 @@ MSERVER5 OPTIONS
    *monetdbd*\ (1) when creating a new database with an administrator
    password and should not be used otherwise.
 
+**--process-wal-and-exit**
+   Stop the server immediately after processing the write-ahead log.
+
 MSERVER5 PARAMETERS
 ===================
 
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -380,8 +380,6 @@ gdk_export _Noreturn void GDKfatal(_In_z
 #define THRDMASK       (1U)
 #define CHECKMASK      (1U<<1)
 #define CHECKDEBUG     if (ATOMIC_GET(&GDKdebug) & CHECKMASK)
-#define PROPMASK       (1U<<3) /* unused */
-#define PROPDEBUG      if (ATOMIC_GET(&GDKdebug) & PROPMASK) /* unused */
 #define IOMASK         (1U<<4)
 #define BATMASK                (1U<<5)
 #define PARMASK                (1U<<7)
@@ -403,11 +401,6 @@ gdk_export _Noreturn void GDKfatal(_In_z
 
 #define ALLOCMASK      (1U<<26)
 
-/* M5, only; cf.,
- * monetdb5/mal/mal.h
- */
-#define OPTMASK                (1U<<27)
-
 #define HEAPMASK       (1U<<28)
 
 #define FORCEMITOMASK  (1U<<29)
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2221,16 +2221,18 @@ BBPdir_first(bool subcommit, lng logno, 
 
 static bat
 BBPdir_step(bat bid, BUN size, int n, char *buf, size_t bufsize,
-           FILE **obbpfp, FILE *nbbpf, BATiter *bi)
+           FILE **obbpfp, FILE *nbbpf, BATiter *bi, int *nbatp)
 {
        if (n < -1)             /* safety catch */
                return n;
+       int nbat = 0;
        while (n >= 0 && n < bid) {
                if (n > 0) {
                        if (fputs(buf, nbbpf) == EOF) {
                                GDKerror("Writing BBP.dir file failed.\n");
                                goto bailout;
                        }
+                       nbat++;
                }
                if (fgets(buf, (int) bufsize, *obbpfp) == NULL) {
                        if (ferror(*obbpfp)) {
@@ -2254,7 +2256,9 @@ BBPdir_step(bat bid, BUN size, int n, ch
                assert(BBP_status(bid) & BBPPERSISTENT);
                if (new_bbpentry(nbbpf, bid, size, bi) != GDK_SUCCEED)
                        goto bailout;
+               nbat++;
        }
+       *nbatp += nbat;
        return n == -1 ? -1 : n == bid ? 0 : n;
 
   bailout:
@@ -2885,13 +2889,10 @@ incref(bat i, bool logical, bool lock)
                return 0;
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to