Changeset: 0bcd8eb11a87 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0bcd8eb11a87
Added Files:
        
sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out.single
Modified Files:
        common/utils/msabaoth.c
        monetdb5/optimizer/opt_mergetable.c
        sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out
        sql/test/subquery/Tests/subquery4.sql
        tools/merovingian/daemon/client.c
        tools/merovingian/daemon/controlrunner.c
        tools/merovingian/daemon/forkmserver.c
        tools/merovingian/daemon/handlers.c
        tools/merovingian/daemon/merovingian.c
        tools/merovingian/daemon/merovingian.h
        tools/merovingian/daemon/multiplex-funnel.c
Branch: default
Log Message:

Merge with Jun2020 branch.


diffs (truncated from 1392 to 300 lines):

diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -617,7 +617,7 @@ msab_getSingleStatus(const char *pathbuf
         */
        snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname,
                         _sabaoth_internal_uuid);
-       if (stat(buf, &statbuf) != -1) {
+       if (stat(buf, &statbuf) == 0) {
                /* database has the same process signature as ours, which
                 * means, it must be us, rely on the uplog state */
                snprintf(log, sizeof(log), "%s/%s/%s", pathbuf, dbname, 
UPLOGFILE);
@@ -641,7 +641,7 @@ msab_getSingleStatus(const char *pathbuf
                        (void)fclose(f);
                }
        } else if (snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname, 
".gdk_lock"),
-                          ((fd = MT_lockf(buf, F_TEST)) == -2)) {
+                          ((fd = MT_lockf(buf, F_TLOCK)) == -2)) {
                /* Locking failed; this can be because the lockfile couldn't
                 * be created.  Probably there is no Mserver running for
                 * that case also.
@@ -650,15 +650,18 @@ msab_getSingleStatus(const char *pathbuf
        } else if (fd == -1) {
                /* file is locked, so mserver is running, see if the database
                 * has finished starting */
-               snprintf(buf, sizeof(buf), "%s/%s/%s",
-                                pathbuf, dbname, STARTEDFILE);
+               snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname, 
STARTEDFILE);
                if (stat(buf, &statbuf) == -1) {
                        sdb->state = SABdbStarting;
                } else {
                        sdb->state = SABdbRunning;
                }
        } else {
-               /* file is not locked, check for a crash in the uplog */
+               /* file was not locked (we just locked it), check for a crash
+                * in the uplog */
+               snprintf(log, sizeof(log), "%s/%s/%s", pathbuf, dbname, 
STARTEDFILE);
+               /* just to be sure, remove the .started file */
+               (void) remove(log);             /* may fail, that's fine */
                snprintf(log, sizeof(log), "%s/%s/%s", pathbuf, dbname, 
UPLOGFILE);
                if ((f = fopen(log, "r")) != NULL) {
                        (void)fseek(f, -1, SEEK_END);
@@ -675,28 +678,27 @@ msab_getSingleStatus(const char *pathbuf
                        /* no uplog, so presumably never started */
                        sdb->state = SABdbInactive;
                }
+               MT_lockf(buf, F_ULOCK);
+               close(fd);
        }
        snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname, 
MAINTENANCEFILE);
-       sdb->locked = stat(buf, &statbuf) != -1;
+       sdb->locked = stat(buf, &statbuf) == 0;
 
        /* add scenarios that are supported */
        sdb->scens = NULL;
        snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname, SCENARIOFILE);
        if ((f = fopen(buf, "r")) != NULL) {
                sablist* np = NULL;
-               while (fgets(data, 8095, f) != NULL) {
+               while (fgets(data, (int) sizeof(data), f) != NULL) {
                        if (*data != '\0' && data[strlen(data) - 1] == '\n')
                                data[strlen(data) - 1] = '\0';
                        if (sdb->scens == NULL) {
-                               sdb->scens = malloc(sizeof(sablist));
-                               sdb->scens->val = strdup(data);
-                               sdb->scens->next = NULL;
-                               np = sdb->scens;
+                               np = sdb->scens = malloc(sizeof(sablist));
                        } else {
                                np = np->next = malloc(sizeof(sablist));
-                               np->val = strdup(data);
-                               np->next = NULL;
                        }
+                       np->val = strdup(data);
+                       np->next = NULL;
                }
                (void)fclose(f);
        }
@@ -706,19 +708,16 @@ msab_getSingleStatus(const char *pathbuf
        snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname, CONNECTIONFILE);
        if ((f = fopen(buf, "r")) != NULL) {
                sablist* np = NULL;
-               while (fgets(data, 8095, f) != NULL) {
+               while (fgets(data, (int) sizeof(data), f) != NULL) {
                        if (*data != '\0' && data[strlen(data) - 1] == '\n')
                                data[strlen(data) - 1] = '\0';
                        if (sdb->conns == NULL) {
-                               sdb->conns = malloc(sizeof(sablist));
-                               sdb->conns->val = strdup(data);
-                               sdb->conns->next = NULL;
-                               np = sdb->conns;
+                               np = sdb->conns = malloc(sizeof(sablist));
                        } else {
                                np = np->next = malloc(sizeof(sablist));
-                               np->val = strdup(data);
-                               np->next = NULL;
                        }
+                       np->val = strdup(data);
+                       np->next = NULL;
                }
                (void)fclose(f);
        }
diff --git a/monetdb5/optimizer/opt_mergetable.c 
b/monetdb5/optimizer/opt_mergetable.c
--- a/monetdb5/optimizer/opt_mergetable.c
+++ b/monetdb5/optimizer/opt_mergetable.c
@@ -2250,7 +2250,7 @@ OPTmergetableImplementation(Client cntxt
                }
 
                /* select on insert, should use last tid only */
-               if (0)
+               if (/* DISABLES CODE */ (0))
                if (match == 1 && fm == 2 && isSelect(p) && p->retc == 1 &&
                   (m=is_a_mat(getArg(p,fm), &ml)) >= 0 && 
                   !ml.v[m].packed && /* not packed yet */ 
diff --git 
a/sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out 
b/sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out
--- a/sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out
+++ b/sql/test/BugTracker-2016/Tests/decimal_vs_integer.Bug-3941.stable.out
@@ -1,32 +1,9 @@
 stdout of test 'decimal_vs_integer.Bug-3941` in directory 
'sql/test/BugTracker-2016` itself:
 
 
-# 15:01:29 >  
-# 15:01:29 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=37542" "--set" 
"mapi_usock=/var/tmp/mtest-23330/.s.monetdb.37542" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2016"
 "--set" "mal_listing=0" "--set" "embedded_r=yes"
-# 15:01:29 >  
-
-# MonetDB 5 server v11.21.12
-# This is an unreleased version
-# Serving database 'mTests_sql_test_BugTracker-2016', using 4 threads
-# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit 
integers dynamically linked
-# Found 7.332 GiB available main-memory.
-# Copyright (c) 1993-July 2008 CWI.
-# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
-# Visit http://www.monetdb.org/ for further information
-# Listening for connection requests on mapi:monetdb://localhost.nes.nl:37542/
-# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-23330/.s.monetdb.37542
-# MonetDB/GIS module loaded
-# Start processing logs sql/sql_logs version 52200
-# Start reading the write-ahead log 'sql_logs/sql/log.11'
-# Finished reading the write-ahead log 'sql_logs/sql/log.11'
-# Finished processing logs sql/sql_logs
-# MonetDB/SQL module loaded
-# MonetDB/R   module loaded
-
-
-# 15:01:30 >  
-# 15:01:30 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-23330" "--port=37542"
-# 15:01:30 >  
+# 09:23:08 >  
+# 09:23:08 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-21127" "--port=34996"
+# 09:23:08 >  
 
 #start transaction;
 #create table tmp(i decimal(8));
@@ -43,30 +20,32 @@ function user.s4_0():void;
 end user.s4_0;
 #inline               actions= 0 time=1 usec 
 #remap                actions= 0 time=1 usec 
-#costmodel            actions= 1 time=0 usec 
+#costmodel            actions= 1 time=1 usec 
 #coercion             actions= 0 time=1 usec 
-#aliases              actions= 1 time=3 usec 
-#evaluate             actions= 1 time=11 usec 
-#emptybind            actions= 3 time=9 usec 
+#aliases              actions= 1 time=4 usec 
+#evaluate             actions= 1 time=12 usec 
+#emptybind            actions= 2 time=10 usec 
 #pushselect           actions= 0 time=2 usec 
 #aliases              actions= 1 time=3 usec 
-#mergetable           actions= 0 time=15 usec 
-#deadcode             actions= 5 time=5 usec 
+#mitosis              actions=1 time=0 usec 
+#mergetable           actions= 0 time=18 usec 
+#deadcode             actions= 5 time=7 usec 
 #aliases              actions= 0 time=0 usec 
-#constants            actions= 1 time=4 usec 
-#commonTerms          actions= 0 time=1 usec 
-#projectionpath       actions= 0 time=1 usec 
-#deadcode             actions= 0 time=3 usec 
-#reorder              actions= 1 time=8 usec 
+#constants            actions= 1 time=6 usec 
+#commonTerms          actions= 0 time=3 usec 
+#projectionpath       actions= 0 time=2 usec 
+#deadcode             actions= 0 time=6 usec 
+#reorder              actions= 1 time=16 usec 
 #matpack              actions= 0 time=0 usec 
-#dataflow             actions= 0 time=4 usec 
+#dataflow             actions= 0 time=5 usec 
 #multiplex            actions= 0 time=1 usec 
 #profiler             actions= 1 time=0 usec 
-#candidates           actions= 1 time=0 usec 
-#deadcode             actions= 0 time=2 usec 
+#candidates           actions= 1 time=1 usec 
+#deadcode             actions= 0 time=4 usec 
+#postfix              actions= 0 time=2 usec 
 #wlc                  actions= 0 time=0 usec 
-#garbagecollector     actions= 1 time=5 usec 
-#total                actions=29 time=155 usec 
+#garbagecollector     actions= 1 time=34 usec 
+#total                actions=29 time=239 usec 
 #explain select count(*) from tmp where i = '20160222';
 % .explain # table_name
 % mal # name
@@ -78,32 +57,34 @@ function user.s6_0():void;
     X_19:lng := aggr.count(X_16:bat[:oid]);
     sql.resultSet("sys.%1":str, "%1":str, "bigint":str, 64:int, 0:int, 7:int, 
X_19:lng);
 end user.s6_0;
-#inline               actions= 0 time=0 usec 
+#inline               actions= 0 time=1 usec 
 #remap                actions= 0 time=1 usec 
 #costmodel            actions= 1 time=1 usec 
 #coercion             actions= 0 time=1 usec 
 #aliases              actions= 1 time=3 usec 
-#evaluate             actions= 1 time=9 usec 
-#emptybind            actions= 3 time=6 usec 
+#evaluate             actions= 1 time=16 usec 
+#emptybind            actions= 2 time=7 usec 
 #pushselect           actions= 0 time=2 usec 
 #aliases              actions= 1 time=3 usec 
-#mergetable           actions= 0 time=15 usec 
-#deadcode             actions= 5 time=5 usec 
+#mitosis              actions=1 time=1 usec 
+#mergetable           actions= 0 time=17 usec 
+#deadcode             actions= 5 time=6 usec 
 #aliases              actions= 0 time=0 usec 
-#constants            actions= 0 time=3 usec 
+#constants            actions= 0 time=5 usec 
 #commonTerms          actions= 0 time=2 usec 
 #projectionpath       actions= 0 time=1 usec 
-#deadcode             actions= 0 time=3 usec 
-#reorder              actions= 1 time=9 usec 
+#deadcode             actions= 0 time=6 usec 
+#reorder              actions= 1 time=15 usec 
 #matpack              actions= 0 time=0 usec 
-#dataflow             actions= 0 time=3 usec 
+#dataflow             actions= 0 time=4 usec 
 #multiplex            actions= 0 time=1 usec 
-#profiler             actions= 1 time=1 usec 
-#candidates           actions= 1 time=0 usec 
-#deadcode             actions= 0 time=3 usec 
+#profiler             actions= 1 time=0 usec 
+#candidates           actions= 1 time=1 usec 
+#deadcode             actions= 0 time=4 usec 
+#postfix              actions= 0 time=2 usec 
 #wlc                  actions= 0 time=0 usec 
-#garbagecollector     actions= 1 time=5 usec 
-#total                actions=29 time=140 usec 
+#garbagecollector     actions= 1 time=29 usec 
+#total                actions=29 time=215 usec 
 #explain select count(*) from tmp where i = 201602221;
 % .explain # table_name
 % mal # name
@@ -122,33 +103,35 @@ exit X_81:bit;
     sql.resultSet("sys.%1":str, "%1":str, "bigint":str, 64:int, 0:int, 7:int, 
X_22:lng);
 end user.s8_0;
 #inline               actions= 0 time=1 usec 
-#remap                actions= 1 time=6 usec 
-#costmodel            actions= 1 time=0 usec 
-#coercion             actions= 0 time=1 usec 
+#remap                actions= 1 time=7 usec 
+#costmodel            actions= 1 time=1 usec 
+#coercion             actions= 0 time=2 usec 
 #aliases              actions= 1 time=4 usec 
-#evaluate             actions= 1 time=8 usec 
-#emptybind            actions= 2 time=6 usec 
-#pushselect           actions= 0 time=3 usec 
-#aliases              actions= 1 time=3 usec 
-#mergetable           actions= 0 time=18 usec 
-#deadcode             actions= 4 time=5 usec 
+#evaluate             actions= 1 time=11 usec 
+#emptybind            actions= 1 time=7 usec 
+#pushselect           actions= 0 time=2 usec 
+#aliases              actions= 1 time=4 usec 
+#mitosis              actions=1 time=1 usec 
+#mergetable           actions= 0 time=19 usec 
+#deadcode             actions= 2 time=6 usec 
 #aliases              actions= 0 time=1 usec 
-#constants            actions= 2 time=4 usec 
+#constants            actions= 1 time=6 usec 
 #commonTerms          actions= 0 time=2 usec 
 #projectionpath       actions= 0 time=2 usec 
-#deadcode             actions= 0 time=3 usec 
-#reorder              actions= 1 time=10 usec 
-#matpack              actions= 0 time=0 usec 
-#dataflow             actions= 0 time=4 usec 
+#deadcode             actions= 0 time=5 usec 
+#reorder              actions= 1 time=13 usec 
+#matpack              actions= 0 time=8 usec 
+#dataflow             actions= 1 time=26 usec 
 #multiplex            actions= 0 time=1 usec 
 #profiler             actions= 1 time=1 usec 
-#candidates           actions= 1 time=0 usec 
-#deadcode             actions= 0 time=3 usec 
+#candidates           actions= 1 time=1 usec 
+#deadcode             actions= 0 time=5 usec 
+#postfix              actions= 0 time=3 usec 
 #wlc                  actions= 0 time=0 usec 
-#garbagecollector     actions= 1 time=6 usec 
-#total                actions=29 time=152 usec 
+#garbagecollector     actions= 1 time=19 usec 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to