Changeset: f294289175c3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f294289175c3
Modified Files:
        gdk/gdk.h
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_private.h
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_statement.c
        sql/server/rel_exp.c
        sql/server/rel_exp.h
        sql/server/rel_optimizer.c
        sql/server/rel_rel.c
        sql/server/rel_schema.c
        sql/server/rel_select.c
        sql/server/rel_updates.c
        sql/storage/store.c
        sql/test/SQLancer/Tests/sqlancer19.SQL.py
        tools/monetdbe/monetdbe.c
Branch: properties
Log Message:

Merged with default


diffs (truncated from 159060 to 300 lines):

diff --git a/README.rst b/README.rst
--- a/README.rst
+++ b/README.rst
@@ -109,8 +109,7 @@ The following packages are optional:
 ``unixODBC-devel``, ``valgrind-devel``.
 
 On Ubuntu and Debian the following packages are required:
-``bison``, ``cmake``, ``gcc``, ``libssl-dev``, ``pkg-config``,
-``python3``.
+``bison``, ``cmake``, ``gcc``, ``pkg-config``, ``python3``.
 
 The following packages are optional but recommended:
 ``libbz2-dev``, ``uuid-dev``, ``libpcre3-dev``, ``libreadline-dev``,
diff --git a/clients/ChangeLog.Jan2022 b/clients/ChangeLog.Jan2022
--- a/clients/ChangeLog.Jan2022
+++ b/clients/ChangeLog.Jan2022
@@ -1,3 +1,10 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Wed Feb 16 2022 Sjoerd Mullender <sjo...@acm.org>
+- Improved the handling of the \r command in mclient.  It now properly
+  counts the header of table, and when a (very) long table is being
+  printed and aborted part way in the built-in pager, not all data is
+  transferred to the client (and then discarded).  Instead at most 1000
+  rows are transferred.
+
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
@@ -1447,6 +1447,7 @@ char *monetdbe_error(monetdbe_database d
 char *monetdbe_execute(monetdbe_statement *stmt, monetdbe_result **result, 
monetdbe_cnt *affected_rows);
 char *monetdbe_get_autocommit(monetdbe_database dbhdl, int *result);
 char *monetdbe_get_columns(monetdbe_database dbhdl, const char *schema_name, 
const char *table_name, size_t *column_count, monetdbe_column **columns);
+const char *monetdbe_get_mapi_port(void);
 int monetdbe_in_transaction(monetdbe_database dbhdl);
 const void *monetdbe_null(monetdbe_database dbhdl, monetdbe_types t);
 int monetdbe_open(monetdbe_database *db, char *url, monetdbe_options *opts);
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1320,9 +1320,10 @@ RAWrenderer(MapiHdl hdl)
        }
 }
 
-static void
+static int
 SQLheader(MapiHdl hdl, int *len, int fields, char more)
 {
+       int rows = 1;                           /* start with the separator row 
*/
        SQLseparator(len, fields, '-');
        if (mapi_get_name(hdl, 0)) {
                int i;
@@ -1339,11 +1340,13 @@ SQLheader(MapiHdl hdl, int *len, int fie
                        names[i] = mapi_get_name(hdl, i);
                        numeric[i] = 0;
                }
-               SQLrow(len, numeric, names, fields, 1, more);
+               rows += SQLrow(len, numeric, names, fields, 1, more);
+               rows++;                                 /* add a separator row 
*/
                SQLseparator(len, fields, '=');
                free(names);
                free(numeric);
        }
+       return rows;
 }
 
 static void
@@ -1560,7 +1563,7 @@ SQLrenderer(MapiHdl hdl)
                        break;
        }
 
-       SQLheader(hdl, len, printfields, fields != printfields);
+       rows = SQLheader(hdl, len, printfields, fields != printfields);
 
        while ((rfields = fetch_row(hdl)) != 0) {
                if (mnstr_errnr(toConsole))
@@ -1603,8 +1606,10 @@ SQLrenderer(MapiHdl hdl)
                if (ps > 0 && rows >= ps && fromConsole != NULL) {
                        SQLpagemove(len, printfields, &ps, &silent);
                        rows = 0;
-                       if (silent)
-                               continue;
+                       if (silent) {
+                               mapi_finish(hdl);
+                               break;
+                       }
                }
 
                rows += SQLrow(len, numeric, rest, printfields, 2, 0);
@@ -3502,7 +3507,7 @@ main(int argc, char **argv)
                exit(2);
        }
 
-       mapi_cache_limit(mid, -1);
+       mapi_cache_limit(mid, 1000);
        mapi_setAutocommit(mid, autocommit);
        if (mode == SQL && !settz)
                mapi_set_time_zone(mid, 0);
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -3591,7 +3591,6 @@ mapi_param_store(MapiHdl hdl)
                                                free(val);
                                                return;
                                        }
-                                       hdl->query = q;
                                }
                                snprintf(hdl->query + k, lim - k, "'%s'", val);
                                free(val);
@@ -3608,7 +3607,6 @@ mapi_param_store(MapiHdl hdl)
                                                free(val);
                                                return;
                                        }
-                                       hdl->query = q;
                                }
                                snprintf(hdl->query + k, lim - k, "'%s'", val);
                                free(val);
diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -46,7 +46,10 @@ function(monetdb_configure_defines)
   check_include_file("sys/un.h" HAVE_SYS_UN_H)
   check_include_file("sys/wait.h" HAVE_SYS_WAIT_H)
   check_include_file("unistd.h" HAVE_UNISTD_H)
-  check_include_file("uuid/uuid.h" HAVE_UUID_UUID_H)
+  cmake_push_check_state()
+    set(CMAKE_REQUIRED_INCLUDES 
"${CMAKE_REQUIRED_INCLUDES};${UUID_INCLUDE_DIR}")
+    check_include_file("uuid/uuid.h" HAVE_UUID_UUID_H)
+  cmake_pop_check_state()
   check_include_file("winsock2.h" HAVE_WINSOCK_H)
 
   find_library(GETOPT_LIB "getopt.lib")
diff --git a/common/stream/Tests/urlstream.py b/common/stream/Tests/urlstream.py
--- a/common/stream/Tests/urlstream.py
+++ b/common/stream/Tests/urlstream.py
@@ -18,6 +18,22 @@ def pickport():
         s.close()
         return port
 
+
+def wait_for_server(port, timeout):
+    deadline = time.time() + timeout
+    while time.time() < deadline:
+        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        s.settimeout(0.1)
+        try:
+            s.connect(('localhost', port))
+            break
+        except ConnectionRefusedError:
+            time.sleep(0.1)
+        finally:
+            s.close()
+    print(f'Warning: waited {timeout} seconds for the server to start but 
could still not connect', file=OUTPUT)
+
+
 class Handler(http.server.BaseHTTPRequestHandler):
     def log_message(self, format, *args):
         # add a # at the beginning of the line to not mess up Mtest diffs
@@ -66,16 +82,20 @@ def runserver(port):
 port = pickport()
 t = threading.Thread(target=lambda: runserver(port), daemon=True)
 t.start()
-time.sleep(0.5)
+wait_for_server(port, 5.0)
+
 url = f'http://localhost:{port}'
 
 def streamcat(suffix):
     u = url + suffix
     cmd = ['streamcat', 'read', u, 'urlstream']
-    print(f'FETCHING {suffix}', end="", file=OUTPUT)
+    print(f'FETCHING {suffix}', file=OUTPUT)
     PIPE = subprocess.PIPE
     p = subprocess.run(cmd, check=False, stdout=PIPE, stderr=PIPE, timeout=10)
     print(f' yielded return code {p.returncode}', file=OUTPUT)
+    print(f' wrote {len(p.stdout)} bytes to stdout', file=OUTPUT)
+    if p.stderr:
+        print(f' stderr={p.stderr!r}', file=OUTPUT)
     return (p.returncode, p.stdout, p.stderr)
 
 def run_tests():
@@ -101,5 +121,5 @@ try:
 except Exception as e:
     output = OUTPUT.getvalue()
     if output:
-        print(output)
+        print(output, file=sys.stderr)
     raise e
diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Vcs-Hg: https://dev.monetdb.org/hg/Monet
 Build-Depends: debhelper (>= 9), cmake (>= 3.12), bison,
  libbz2-dev, libcurl4-gnutls-dev, libgeos-dev (>= 3.4.0),
  libpcre3-dev, libreadline-dev, liblzma-dev, liblz4-dev (>= 1.8.0),
- libssl-dev, libxml2-dev, pkg-config,
+ libxml2-dev, pkg-config,
  python3, python3-dev, python3-numpy,
  unixodbc-dev, uuid-dev, zlib1g-dev, r-base-dev,
  libcfitsio-dev
diff --git a/documentation/source/manual_pages/monetdbd.rst.in 
b/documentation/source/manual_pages/monetdbd.rst.in
--- a/documentation/source/manual_pages/monetdbd.rst.in
+++ b/documentation/source/manual_pages/monetdbd.rst.in
@@ -126,7 +126,8 @@ using the **set** command. The following
 
 **listenaddr**
    This property specifies an address that is allowed to connect to the
-   server. The following possibilities exist:
+   server. This property is ignored if the property **forward** is set
+   to **proxy** (the default). The following possibilities exist:
 
    **localhost**
       The server only listens on the IPv4 and IPv6 loopback interface
@@ -239,7 +240,8 @@ using the **set** command. The following
 REMOTE DATABASES
 ================
 
-**Deprecation notice:** This feature is deprecated and may be removed in the 
future.
+**Deprecation notice:** This feature is deprecated and may be removed in
+the future.
 
 The neighbor discovery capabilities of *monetdbd* allow a user to
 contact a remote database transparently, as if it were a local database.
@@ -312,7 +314,8 @@ user to decide how to use the tags.
 MULTIPLEX-FUNNELS
 =================
 
-**Deprecation notice:** This feature is deprecated and may be removed in the 
future.
+**Deprecation notice:** This feature is deprecated and may be removed in
+the future.
 
 *Monetdbd* implements multiplex-funnel capabilities. As the name
 suggests two techniques are combined, the multiplexer and the funnel.
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -89,6 +89,7 @@ target_sources(bat
 
 target_include_directories(bat
   PUBLIC
+  
$<$<BOOL:${UUID_FOUND}>:$<TARGET_PROPERTY:UUID::UUID,INTERFACE_INCLUDE_DIRECTORIES>>
   $<TARGET_PROPERTY:stream,INTERFACE_INCLUDE_DIRECTORIES>
   $<TARGET_PROPERTY:matomic,INTERFACE_INCLUDE_DIRECTORIES>
   $<TARGET_PROPERTY:mstring,INTERFACE_INCLUDE_DIRECTORIES>
@@ -105,6 +106,7 @@ target_link_libraries(bat
   mutils
   $<$<NOT:$<PLATFORM_ID:Windows>>:m>
   $<$<PLATFORM_ID:Windows>:ws2_32>
+  $<$<BOOL:${UUID_FOUND}>:UUID::UUID>
   $<$<BOOL:${KVM_FOUND}>:KVM::KVM>
   ${CMAKE_DL_LIBS}
   Threads::Threads)
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -343,6 +343,9 @@
 
 typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return;
 
+gdk_export _Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char 
*format, ...)
+       __attribute__((__format__(__printf__, 1, 2)));
+
 #include "gdk_system.h"
 #include "gdk_posix.h"
 #include "stream.h"
@@ -1170,10 +1173,11 @@ typedef var_t stridx_t;
 
 #define BUNtvaroff(bi,p) VarHeapVal((bi).base, (p), (bi).width)
 
-#define BUNtloc(bi,p)  (ATOMstorage((bi).type) == TYPE_msk ? Tmsk(&(bi), p) : 
(void *) ((char *) (bi).base + ((p) << (bi).shift)))
+#define BUNtmsk(bi,p)  Tmsk(&(bi), (p))
+#define BUNtloc(bi,p)  (assert((bi).type != TYPE_msk), ((void *) ((char *) 
(bi).base + ((p) << (bi).shift))))
 #define BUNtpos(bi,p)  Tpos(&(bi),p)
 #define BUNtvar(bi,p)  (assert((bi).type && (bi).b->tvarsized), (void *) 
((bi).vh->base+BUNtvaroff(bi,p)))
-#define BUNtail(bi,p)  
((bi).type?(bi).b->tvarsized?BUNtvar(bi,p):BUNtloc(bi,p):BUNtpos(bi,p))
+#define BUNtail(bi,p)  
((bi).type?(bi).b->tvarsized?BUNtvar(bi,p):(bi).type==TYPE_msk?BUNtmsk(bi,p):BUNtloc(bi,p):BUNtpos(bi,p))
 
 #define BUNlast(b)     (assert((b)->batCount <= BUN_MAX), (b)->batCount)
 
@@ -1624,12 +1628,6 @@ gdk_export gdk_return GDKtracer_fill_com
                      format, ##__VA_ARGS__)
 #define GDKsyserror(format, ...)       GDKsyserr(errno, format, ##__VA_ARGS__)
 
-gdk_export _Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char 
*format, ...)
-       __attribute__((__format__(__printf__, 1, 2)));
-       /*
-gdk_export void GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...)
-       __attribute__((__format__(__printf__, 1, 2)));
-       */
 gdk_export void GDKclrerr(void);
 
 
@@ -1675,6 +1673,8 @@ tfastins_nocheckVAR(BAT *b, BUN p, const
                ((uint64_t *) b->theap->base)[p] = (uint64_t) d;
                break;
 #endif
+       default:
+               MT_UNREACHABLE();
        }
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to