Changeset: 67fdf8a99e72 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/67fdf8a99e72
Modified Files:
        gdk/gdk_bbp.c
        sql/test/sysmon/Tests/All
Branch: strheapvacuum
Log Message:

merge with default


diffs (truncated from 1217 to 300 lines):

diff --git a/cmake/monetdb-functions.cmake b/cmake/monetdb-functions.cmake
--- a/cmake/monetdb-functions.cmake
+++ b/cmake/monetdb-functions.cmake
@@ -9,40 +9,50 @@
 function(monetdb_hg_revision)
   # Get the current version control revision
   if(EXISTS "${CMAKE_SOURCE_DIR}/.hg_archival.txt")
-    execute_process(COMMAND "sed" "-n" "s/^node: 
\\([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\\).*/\\1/p"
 ".hg_archival.txt" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE 
HG_RETURN_CODE
-      OUTPUT_VARIABLE HG_OUPUT_RES OUTPUT_STRIP_TRAILING_WHITESPACE)
-    if(HG_RETURN_CODE EQUAL 0 AND HG_OUPUT_RES)
-      set(MERCURIAL_ID "${HG_OUPUT_RES}" PARENT_SCOPE)
+    file(READ "${CMAKE_SOURCE_DIR}/.hg_archival.txt" HG_ARCHIVAL)
+    if(HG_ARCHIVAL MATCHES ".*node:.*")
+      string(REGEX REPLACE ".*node: 
([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]).*"
 "\\1" HG_NODE "${HG_ARCHIVAL}")
+      if(HG_ARCHIVAL MATCHES ".*local:.*")
+        string(REGEX REPLACE ".*local: ([0-9][0-9]*).*" "\\1" HG_LOCAL 
"${HG_ARCHIVAL}")
+        set(MERCURIAL_ID "${HG_NODE} ${HG_LOCAL}" PARENT_SCOPE)
+      else()
+        set(MERCURIAL_ID "${HG_NODE}" PARENT_SCOPE)
+      endif()
     else()
-      message(FATAL_ERROR "Failed to find mercurial ID")
+      message(WARNING "Failed to find mercurial ID")
+      set(MERCURIAL_ID "Unknown" PARENT_SCOPE)
     endif()
   elseif(EXISTS "${CMAKE_SOURCE_DIR}/.hg")
     find_package(Hg)
     if(HG_FOUND)
       message("hg found: ${HG_EXECUTABLE}")
     else()
-      message(FATAL_ERROR "Failed to find mercurial")
+      message(WARNING "Failed to find mercurial")
+      set(MERCURIAL_ID "Unknown" PARENT_SCOPE)
     endif()
     execute_process(COMMAND "${HG_EXECUTABLE}" "id" "-i" WORKING_DIRECTORY 
"${CMAKE_SOURCE_DIR}" RESULT_VARIABLE HG_RETURN_CODE
       OUTPUT_VARIABLE HG_OUPUT_RES OUTPUT_STRIP_TRAILING_WHITESPACE)
     if(HG_RETURN_CODE EQUAL 0 AND HG_OUPUT_RES)
       set(MERCURIAL_ID "${HG_OUPUT_RES}" PARENT_SCOPE)
     else()
-      message(FATAL_ERROR "Failed to find mercurial ID")
+      message(WARNING "Failed to find mercurial ID")
+      set(MERCURIAL_ID "Unknown" PARENT_SCOPE)
     endif()
   elseif(EXISTS "${CMAKE_SOURCE_DIR}/.git")
     find_package(Git)
     if(GIT_FOUND)
       message("git found: ${GIT_EXECUTABLE}")
     else()
-      message(FATAL_ERROR "Failed to find git")
+      message(WARNING "Failed to find git")
+      set(MERCURIAL_ID "Unknown" PARENT_SCOPE)
     endif()
     execute_process(COMMAND "${GIT_EXECUTABLE}" "rev-parse" "--short" "HEAD" 
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
       RESULT_VARIABLE GIT_RETURN_CODE OUTPUT_VARIABLE GIT_OUPUT_RES 
OUTPUT_STRIP_TRAILING_WHITESPACE)
     if(GIT_RETURN_CODE EQUAL 0 AND GIT_OUPUT_RES)
       set(MERCURIAL_ID "${GIT_OUPUT_RES}" PARENT_SCOPE)
     else()
-      message(FATAL_ERROR "Failed to find git ID")
+      message(WARNING "Failed to find git ID")
+      set(MERCURIAL_ID "Unknown" PARENT_SCOPE)
     endif()
   else()
     set(MERCURIAL_ID "Unknown" PARENT_SCOPE)
diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake
--- a/cmake/monetdb-toolchain.cmake
+++ b/cmake/monetdb-toolchain.cmake
@@ -20,7 +20,11 @@ function(monetdb_default_compiler_option
       add_compile_options("-fsanitize=address")
       add_compile_options("-fno-omit-frame-pointer")
       add_compile_definitions(SANITIZER)
-      add_link_options("-fsanitize=address")
+      if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
+        add_link_options("-fsanitize=address")
+      else()
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address" PARENT_SCOPE)
+      endif()
     else()
       message(FATAL_ERROR "Sanitizer only supported with GCC")
     endif()
diff --git a/gdk/ChangeLog.Jul2021 b/gdk/ChangeLog.Jul2021
--- a/gdk/ChangeLog.Jul2021
+++ b/gdk/ChangeLog.Jul2021
@@ -1,6 +1,16 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Wed Sep 22 2021 Sjoerd Mullender <[email protected]>
+- Some deadlock and race condition issues were fixed.
+- Handling of the list of free bats has been improved, leading to less
+  thread contention.
+- A problem was fixed where the server wouldn't start with a message from
+  BBPcheckbats about files being too small.  The issue was not that the
+  file was too small, but that BBPcheckbats was looking at the wrong file.
+- An issue was fixed where a "short read" error was produced when memory
+  was getting tight.
+
 * Wed Aug 11 2021 Sjoerd Mullender <[email protected]>
 - When appending to a string bat, we made an optimization where the string
   heap was sometimes copied completely to avoid having to insert strings
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -959,7 +959,6 @@ BBPheader(FILE *fp, int *lineno, bat *bb
                TRC_CRITICAL(GDK, "no BBPsize value found\n");
                return 0;
        }
-       sz = (int) (sz * BATMARGIN);
        if (sz > *bbpsize)
                *bbpsize = sz;
        if (bbpversion > GDKLIBRARY_MINMAX_POS) {
diff --git a/gdk/gdk_value.c b/gdk/gdk_value.c
--- a/gdk/gdk_value.c
+++ b/gdk/gdk_value.c
@@ -156,10 +156,11 @@ VALcopy(ValPtr d, const ValRecord *s)
                d->vtype = s->vtype;
        } else if (s->vtype == TYPE_str) {
                d->vtype = TYPE_str;
-               d->val.sval = GDKstrdup(s->val.sval);
+               d->len = strLen(s->val.sval);
+               d->val.sval = GDKmalloc(d->len);
                if (d->val.sval == NULL)
                        return NULL;
-               d->len = strLen(d->val.sval);
+               memcpy(d->val.sval, s->val.sval, d->len);
        } else {
                ptr p = s->val.pval;
 
@@ -217,15 +218,16 @@ VALinit(ValPtr d, int tpe, const void *s
                d->val.uval = *(const uuid *) s;
                break;
        case TYPE_str:
-               d->val.sval = GDKstrdup(s);
+               d->len = strLen(s);
+               d->val.sval = GDKmalloc(d->len);
                if (d->val.sval == NULL)
                        return NULL;
-               d->len = strLen(s);
-               break;
+               memcpy(d->val.sval, s, d->len);
+               return d;
        case TYPE_ptr:
                d->val.pval = *(const ptr *) s;
                d->len = ATOMlen(tpe, *(const ptr *) s);
-               break;
+               return d;
        default:
                assert(ATOMextern(ATOMstorage(tpe)));
                d->len = ATOMlen(tpe, s);
@@ -235,7 +237,7 @@ VALinit(ValPtr d, int tpe, const void *s
                memcpy(d->val.pval, s, d->len);
                return d;
        }
-       d->len = ATOMlen(d->vtype, VALptr(d));
+       d->len = ATOMsize(d->vtype);
        return d;
 }
 
diff --git a/sql/ChangeLog.Jul2021 b/sql/ChangeLog.Jul2021
--- a/sql/ChangeLog.Jul2021
+++ b/sql/ChangeLog.Jul2021
@@ -1,14 +1,23 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Wed Sep 22 2021 Sjoerd Mullender <[email protected]>
+- If the server has been idle for a while with no active clients, the
+  write-ahead log is now rotated.
+- A problem was fixed where files belonging to bats that had been deleted
+  internally were not cleaned up, leading to a growing database (dbfarm)
+  directory.
+- A leak was fixed where extra bats were created but never cleaned up,
+  each taking up several kilobytes of memory.
+
 * Tue Aug 17 2021 Ying Zhang <[email protected]>
 - [This feature was already released in Jul2021 (11.41.5), but the ChangeLog 
was missing]
   Grant indirect privileges.  With "GRANT SELECT ON <my_view> TO
   <another_user>"  and "GRANT EXECUTE ON FUNCTION <my_func> TO
   <another_user>", one can grant access to "my_view" and "my_func"
-  to another user who does not have access to the underlying database 
-  objects (e.g. tables, views) used in "my_view" and "my_func".  The 
-  grantee will only be able to access data revealed by "my_view" or 
+  to another user who does not have access to the underlying database
+  objects (e.g. tables, views) used in "my_view" and "my_func".  The
+  grantee will only be able to access data revealed by "my_view" or
   conduct operations provided by "my_func".
 
 * Mon Aug 16 2021 Sjoerd Mullender <[email protected]>
diff --git a/sql/backends/monet5/sql_execute.c 
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -816,6 +816,21 @@ is_a_number(char *v)
        return 1;
 }
 
+static char *
+parseIdent(char *in, char *out)
+{
+       while (*in && *in != '"') {
+               if (*in == '\\' && (*(in + 1) == '\\' || *(in + 1) == '"')) {
+                       *out++ = *(in + 1);
+                       in+=2;
+               } else {
+                       *out++ = *in++;
+               }
+       }
+       *out++ = '\0';
+       return in;
+}
+
 str
 RAstatement2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
@@ -830,7 +845,6 @@ RAstatement2(Client cntxt, MalBlkPtr mb,
        str msg = MAL_SUCCEED;
        sql_rel *rel;
        list *refs, *ops;
-       char buf[BUFSIZ];
 
        if ((msg = getSQLContext(cntxt, mb, &m, &be)) != NULL)
                return msg;
@@ -843,20 +857,15 @@ RAstatement2(Client cntxt, MalBlkPtr mb,
        if (!m->sa)
                return RAcommit_statement(be, 
createException(SQL,"RAstatement2",SQLSTATE(HY013) MAL_MALLOC_FAIL));
 
-       /* keep copy of signature and relational expression */
-       snprintf(buf, BUFSIZ, "%s %s", sig, expr);
-
        if (!stack_push_frame(m, NULL))
                return RAcommit_statement(be, 
createException(SQL,"RAstatement2",SQLSTATE(HY013) MAL_MALLOC_FAIL));
        ops = sa_list(m->sa);
        while (sig && *sig && !isspace((unsigned char) *sig)) {
-               char *vnme = sig, *tnme;
+               char *vnme = sig, *tnme, *nbuf, *sch, *var;
                char *p = strchr(++sig, (int)' ');
                int d,s,nr = -1;
-               sql_subtype t;
-               //atom *a;
-
-               assert(0);
+               sql_type *t = NULL;
+               sql_subtype tpe;
 
                *p++ = 0;
                /* vnme can be name or number */
@@ -866,29 +875,43 @@ RAstatement2(Client cntxt, MalBlkPtr mb,
                p = strchr(p, (int)'(');
                *p++ = 0;
                tnme = sa_strdup(m->sa, tnme);
-               if (!tnme)
-                       return RAcommit_statement(be, 
createException(SQL,"RAstatement2",SQLSTATE(HY013) MAL_MALLOC_FAIL));
                d = strtol(p, &p, 10);
                p++; /* skip , */
                s = strtol(p, &p, 10);
 
-               sql_find_subtype(&t, tnme, d, s);
-               //a = atom_general(m->sa, &t, NULL);
-               //a->isnull = 0; // disable NULL value optimizations ugh
-               /* the argument list may have holes and maybe out of order, ie
-                * don't use sql_add_arg, but special numbered version
-                * sql_set_arg(m, a, nr);
-                * */
+               if (!sql_find_subtype(&tpe, tnme, d, s)) {
+                       if (!(t = mvc_bind_type(m, tnme))) { /* try an external 
type */
+                               stack_pop_frame(m);
+                               return RAcommit_statement(be, 
createException(SQL,"RAstatement2",SQLSTATE(42000) "SQL type %s(%d, %d) not 
found\n", tnme, d, s));
+                       }
+                       sql_init_subtype(&tpe, t, d, s);
+               }
+
                if (nr >= 0) {
-                       append(ops, exp_atom_ref(m->sa, nr, &t));
-                       //if (!sql_set_arg(m, nr, a)) {
-                       //      sqlcleanup(be, 0);
-                       //      return 
createException(SQL,"RAstatement2",SQLSTATE(HY013) MAL_MALLOC_FAIL);
-                       //}
+                       list_append(ops, exp_atom_ref(m->sa, nr, &tpe));
                } else {
-                       if (!push_global_var(m, "sys", vnme+1, &t))
+                       sql_schema *s;
+
+                       while (*vnme && isdigit(*vnme)) /* skip digit 
characters */
+                               vnme++;
+
+                       nbuf = vnme;
+                       sch = nbuf+1;
+                       assert(*nbuf == '"');
+                       nbuf = parseIdent(nbuf+1, sch);
+                       assert(*nbuf == '\0');
+                       var = nbuf+2;
+                       nbuf = parseIdent(nbuf+2, var);
+
+                       if (!(s = mvc_bind_schema(m, sch))) {
+                               stack_pop_frame(m);
+                               return RAcommit_statement(be, 
createException(SQL,"RAstatement2",SQLSTATE(3F000) "No such schema '%s'", sch));
+                       }
+                       if (!find_global_var(m, s, var) && !push_global_var(m, 
sch, var, &tpe)) {
+                               stack_pop_frame(m);
                                return RAcommit_statement(be, 
createException(SQL,"RAstatement2",SQLSTATE(HY013) MAL_MALLOC_FAIL));
-                       append(ops, exp_var(m->sa, NULL, sa_strdup(m->sa, 
vnme+1), &t, 0));
+                       }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to