Changeset: 904dc03bb737 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=904dc03bb737
Added Files:
        sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.sql
        sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.stable.err
        sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.stable.out
Modified Files:
        clients/php/lib/php_mapi.inc
        gdk/gdk_hash.c
        gdk/gdk_search.c
        monetdb5/modules/mal/batcalc.c
        sql/test/BugTracker-2016/Tests/All
        testing/Mtest.py.in
Branch: embedded
Log Message:

merge with default


diffs (294 lines):

diff --git a/clients/php/lib/php_mapi.inc b/clients/php/lib/php_mapi.inc
--- a/clients/php/lib/php_mapi.inc
+++ b/clients/php/lib/php_mapi.inc
@@ -308,7 +308,7 @@
                if ($merovingian_iter == NULL) {
                        if (socket_connect($socket, $host, $port) == FALSE) {
                $last_error = socket_strerror(socket_last_error());
-               exit();
+               throw new Exception('Cannot connect to server: ' . $last_error);
             }
                }
 
@@ -417,7 +417,7 @@
                # get the first 2 bytes
                if ( ($header = socket_read($socket, 2)) == FALSE) {
                        $last_error = socket_strerror(socket_last_error());
-                       exit();
+                       throw new Exception('Lost connection with the server: ' 
. $last_error);
                }
                $data = "";
 
@@ -431,7 +431,7 @@
                while ((ord($header[0]) & 1) == 0 ) {
                        if ( ($header = socket_read($socket, 2)) == FALSE) {
                                $last_error = 
socket_strerror(socket_last_error());
-                               exit();
+                               throw new Exception('Lost connection with the 
server: ' . $last_error);
                        }
 
                        $chunk_size = ( ((ord($header[1]))  << 7) | 
(ord($header[0]) >> 1) );
@@ -440,7 +440,7 @@
                        while (strlen($block) < $chunk_size) {
                                if ( ($block .= socket_read($socket, 
$chunk_size - strlen($block))) == FALSE) {
                                        $last_error = 
socket_strerror(socket_last_error());
-                                       exit();
+                                       throw new Exception('Lost connection 
with the server: ' . $last_error);
                                }
                        }
 
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -285,29 +285,30 @@ BAThashsync(void *arg)
        Heap *hp = hs->hp;
        int fd;
        lng t0 = GDKusec();
+       const char *failed = " failed";
 
-       if (HEAPsave(hp, hp->filename, NULL) != GDK_SUCCEED ||
-           (fd = GDKfdlocate(hp->farmid, hp->filename, "rb+", NULL)) < 0) {
-               BBPunfix(hs->id);
-               GDKfree(arg);
-               return;
+       if (HEAPsave(hp, hp->filename, NULL) == GDK_SUCCEED &&
+           (fd = GDKfdlocate(hp->farmid, hp->filename, "rb+", NULL)) >= 0) {
+               ((size_t *) hp->base)[0] |= 1 << 24;
+               if (write(fd, hp->base, SIZEOF_SIZE_T) >= 0) {
+                       failed = ""; /* not failed */
+                       if (!(GDKdebug & FORCEMITOMASK)) {
+#if defined(NATIVE_WIN32)
+                               _commit(fd);
+#elif defined(HAVE_FDATASYNC)
+                               fdatasync(fd);
+#elif defined(HAVE_FSYNC)
+                               fsync(fd);
+#endif
+                       }
+               } else {
+                       perror("write hash");
+               }
+               close(fd);
        }
-       ((size_t *) hp->base)[0] |= 1 << 24;
-       if (write(fd, hp->base, SIZEOF_SIZE_T) < 0)
-               perror("write hash");
-       if (!(GDKdebug & FORCEMITOMASK)) {
-#if defined(NATIVE_WIN32)
-               _commit(fd);
-#elif defined(HAVE_FDATASYNC)
-               fdatasync(fd);
-#elif defined(HAVE_FSYNC)
-               fsync(fd);
-#endif
-       }
-       close(fd);
        BBPunfix(hs->id);
        GDKfree(arg);
-       ALGODEBUG fprintf(stderr, "#BAThash: persisting hash %s (" LLFMT " 
usec)\n", hp->filename, GDKusec() - t0);
+       ALGODEBUG fprintf(stderr, "#BAThash: persisting hash %s (" LLFMT " 
usec)%s\n", hp->filename, GDKusec() - t0, failed);
 }
 #endif
 
@@ -500,7 +501,12 @@ BAThash(BAT *b, BUN masksize)
                                BBPfix(b->batCacheid);
                                hs->id = b->batCacheid;
                                hs->hp = hp;
-                               MT_create_thread(&tid, BAThashsync, hs, 
MT_THR_DETACHED);
+                               if (MT_create_thread(&tid, BAThashsync, hs,
+                                                    MT_THR_DETACHED) < 0) {
+                                       /* couldn't start thread: clean up */
+                                       BBPunfix(b->batCacheid);
+                                       GDKfree(hs);
+                               }
                        }
                } else
                        ALGODEBUG fprintf(stderr, "#BAThash: NOT persisting 
hash %d\n", b->batCacheid);
diff --git a/monetdb5/modules/mal/batcalc.c b/monetdb5/modules/mal/batcalc.c
--- a/monetdb5/modules/mal/batcalc.c
+++ b/monetdb5/modules/mal/batcalc.c
@@ -1373,12 +1373,12 @@ CMDifthen(Client cntxt, MalBlkPtr mb, Ma
                        if (b1 != NULL)
                                bn = COLcopy(b1, b1->ttype, 0, TRANSIENT);
                        else
-                               bn = BATconst(b2, b2->ttype, 
getArgReference(stk, pci, 2), TRANSIENT);
+                               bn = BATconst(b2, b2->ttype, 
VALptr(&stk->stk[getArg(pci, 2)]), TRANSIENT);
                } else {
                        if (b2 != NULL)
                                bn = COLcopy(b2, b2->ttype, 0, TRANSIENT);
                        else
-                               bn = BATconst(b1, b1->ttype, 
getArgReference(stk, pci, 3), TRANSIENT);
+                               bn = BATconst(b1, b1->ttype, 
VALptr(&stk->stk[getArg(pci, 3)]), TRANSIENT);
                }
        }
        if (b)
diff --git a/sql/test/BugTracker-2016/Tests/All 
b/sql/test/BugTracker-2016/Tests/All
--- a/sql/test/BugTracker-2016/Tests/All
+++ b/sql/test/BugTracker-2016/Tests/All
@@ -7,3 +7,4 @@ DISTINCT_with_correlated_scalar_subquery
 create_table_from_complex_query.Bug-3921
 projectionpath-prefix.Bug
 prepare-utf8.Bug-3930
+case-with-string-Bug.3932
diff --git a/sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.sql 
b/sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.sql
@@ -0,0 +1,10 @@
+START TRANSACTION;
+
+CREATE TABLE bug3932 (a VARCHAR(5), b VARCHAR(10));
+INSERT INTO bug3932 VALUES ('12345','1234567890');
+
+SELECT CASE WHEN 1=2 THEN a ELSE b END FROM bug3932;
+
+SELECT CASE WHEN 1=2 THEN a ELSE 'lala' END FROM bug3932;
+
+ROLLBACK;
diff --git 
a/sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.stable.err 
b/sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.stable.err
@@ -0,0 +1,37 @@
+stderr of test 'case-with-string-Bug.3932` in directory 
'sql/test/BugTracker-2016` itself:
+
+
+# 15:45:32 >  
+# 15:45:32 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=32329" "--set" 
"mapi_usock=/var/tmp/mtest-12599/.s.monetdb.32329" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2016" 
"--set" "mal_listing=0" "--set" "embedded_r=yes"
+# 15:45:32 >  
+
+# builtin opt  gdk_dbpath = /ufs/sjoerd/Monet-stable/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = no
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 32329
+# cmdline opt  mapi_usock = /var/tmp/mtest-12599/.s.monetdb.32329
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbpath = 
/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2016
+# cmdline opt  mal_listing = 0
+# cmdline opt  embedded_r = yes
+# cmdline opt  gdk_debug = 536870922
+
+# 15:45:33 >  
+# 15:45:33 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-12599" "--port=32329"
+# 15:45:33 >  
+
+
+# 15:45:33 >  
+# 15:45:33 >  "Done."
+# 15:45:33 >  
+
diff --git 
a/sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.stable.out 
b/sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2016/Tests/case-with-string-Bug.3932.stable.out
@@ -0,0 +1,88 @@
+stdout of test 'case-with-string-Bug.3932` in directory 
'sql/test/BugTracker-2016` itself:
+
+
+# 15:45:32 >  
+# 15:45:32 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=32329" "--set" 
"mapi_usock=/var/tmp/mtest-12599/.s.monetdb.32329" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2016" 
"--set" "mal_listing=0" "--set" "embedded_r=yes"
+# 15:45:32 >  
+
+# MonetDB 5 server v11.21.14 (hg id: 517d097f1eda+)
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2016', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit 
integers dynamically linked
+# Found 15.589 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://madrid.da.cwi.nl:32329/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-12599/.s.monetdb.32329
+# MonetDB/GIS module loaded
+# Start processing logs sql/sql_logs version 52200
+# Finished processing logs sql/sql_logs
+# MonetDB/SQL module loaded
+# MonetDB/R   module loaded
+
+Ready.
+# SQL catalog created, loading sql scripts once
+# loading sql script: 09_like.sql
+# loading sql script: 10_math.sql
+# loading sql script: 11_times.sql
+# loading sql script: 12_url.sql
+# loading sql script: 13_date.sql
+# loading sql script: 14_inet.sql
+# loading sql script: 15_querylog.sql
+# loading sql script: 16_tracelog.sql
+# loading sql script: 17_temporal.sql
+# loading sql script: 20_vacuum.sql
+# loading sql script: 21_dependency_functions.sql
+# loading sql script: 22_clients.sql
+# loading sql script: 23_skyserver.sql
+# loading sql script: 24_zorder.sql
+# loading sql script: 25_debug.sql
+# loading sql script: 26_sysmon.sql
+# loading sql script: 27_rejects.sql
+# loading sql script: 39_analytics.sql
+# loading sql script: 39_analytics_hge.sql
+# loading sql script: 40_geom.sql
+# loading sql script: 40_json.sql
+# loading sql script: 40_json_hge.sql
+# loading sql script: 41_md5sum.sql
+# loading sql script: 45_uuid.sql
+# loading sql script: 46_gsl.sql
+# loading sql script: 51_sys_schema_extension.sql
+# loading sql script: 72_fits.sql
+# loading sql script: 74_netcdf.sql
+# loading sql script: 75_storagemodel.sql
+# loading sql script: 80_statistics.sql
+# loading sql script: 80_udf.sql
+# loading sql script: 80_udf_hge.sql
+# loading sql script: 85_bam.sql
+# loading sql script: 90_generator.sql
+# loading sql script: 90_generator_hge.sql
+# loading sql script: 99_system.sql
+
+# 15:45:33 >  
+# 15:45:33 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-12599" "--port=32329"
+# 15:45:33 >  
+
+#START TRANSACTION;
+#CREATE TABLE bug3932 (a VARCHAR(5), b VARCHAR(10));
+#INSERT INTO bug3932 VALUES ('12345','1234567890');
+[ 1    ]
+#SELECT CASE WHEN 1=2 THEN a ELSE b END FROM bug3932;
+% .L # table_name
+% isnull_=_single_value # name
+% varchar # type
+% 10 # length
+[ "1234567890" ]
+#SELECT CASE WHEN 1=2 THEN a ELSE 'lala' END FROM bug3932;
+% .L # table_name
+% isnull_=_single_value # name
+% varchar # type
+% 4 # length
+[ "lala"       ]
+#ROLLBACK;
+
+# 15:45:33 >  
+# 15:45:33 >  "Done."
+# 15:45:33 >  
+
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3790,7 +3790,7 @@ def main(argv) :
     BACK = os.getcwd()
     try:
         os.chdir(TSTSRCBASE)
-        proc = process.Popen(['hg', 'root'], stdout = process.PIPE)
+        proc = process.Popen(['hg', 'root'], stdout = process.PIPE, stderr = 
process.PIPE)
         out, err = proc.communicate()
         if proc.returncode == 0:
             CONDITIONALS['MERCURIAL'] = '#' # True
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to