Changeset: 4629f5947aac for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4629f5947aac
Added Files:
        sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.SQL.bat
        sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.SQL.sh
        sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.err
        sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.out
        sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.sql
        sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.stable.err
        sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.stable.out
        sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.stable.out.int128
        sql/test/Tests/window_functions.sql
        sql/test/Tests/window_functions.stable.err
        sql/test/Tests/window_functions.stable.out
Modified Files:
        gdk/gdk_posix.c
        gdk/gdk_storage.c
        gdk/gdk_system.h
        sql/jdbc/tests/Tests/All
        sql/test/BugTracker-2019/Tests/All
        sql/test/Tests/All
Branch: default
Log Message:

Merge with Apr2019 branch.


diffs (truncated from 1292 to 300 lines):

diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -1091,11 +1091,12 @@ win_mkdir(const char *pathname, const in
 }
 #endif
 
-#ifndef NATIVE_WIN32
-
 void
 MT_sleep_ms(unsigned int ms)
 {
+#ifdef NATIVE_WIN32
+       Sleep(ms);
+#else
 #ifdef HAVE_NANOSLEEP
        (void) nanosleep(&(struct timespec) {.tv_sec = ms / 1000,
                                .tv_nsec = ms == 1 ? 1000 : (long) (ms % 1000) 
* 1000000,},
@@ -1105,14 +1106,5 @@ MT_sleep_ms(unsigned int ms)
                      &(struct timeval) {.tv_sec = ms / 1000,
                                      .tv_usec = ms == 1 ? 1 : (ms % 1000) * 
1000,});
 #endif
+#endif
 }
-
-#else /* WIN32 */
-
-void
-MT_sleep_ms(unsigned int ms)
-{
-       Sleep(ms);
-}
-
-#endif
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -758,6 +758,7 @@ BATsave(BAT *bd)
        gdk_return err = GDK_SUCCEED;
        const char *nme;
        BAT bs;
+       Heap vhs;
        BAT *b = bd;
 
        assert(!GDKinmemory());
@@ -778,16 +779,12 @@ BATsave(BAT *bd)
        /* copy the descriptor to a local variable in order to let our
         * messing in the BAT descriptor not affect other threads that
         * only read it. */
-       bs = *BBP_desc(b->batCacheid);
-       /* fix up internal pointers */
+       bs = *b;
        b = &bs;
 
        if (b->tvheap) {
-               b->tvheap = GDKmalloc(sizeof(Heap));
-               if (b->tvheap == NULL) {
-                       return GDK_FAIL;
-               }
-               *b->tvheap = *bd->tvheap;
+               vhs = *bd->tvheap;
+               b->tvheap = &vhs;
        }
 
        /* start saving data */
@@ -795,14 +792,12 @@ BATsave(BAT *bd)
        if (!b->batCopiedtodisk || b->batDirtydesc || b->theap.dirty)
                if (err == GDK_SUCCEED && b->ttype)
                        err = HEAPsave(&b->theap, nme, "tail");
-       if (b->tvheap && (!b->batCopiedtodisk || b->batDirtydesc || 
b->tvheap->dirty))
-               if (b->ttype && b->tvarsized) {
-                       if (err == GDK_SUCCEED)
-                               err = HEAPsave(b->tvheap, nme, "theap");
-               }
-
-       if (b->tvheap)
-               GDKfree(b->tvheap);
+       if (b->tvheap
+           && (!b->batCopiedtodisk || b->batDirtydesc || b->tvheap->dirty)
+           && b->ttype
+           && b->tvarsized
+           && err == GDK_SUCCEED)
+               err = HEAPsave(b->tvheap, nme, "theap");
 
        if (err == GDK_SUCCEED) {
                bd->batCopiedtodisk = true;
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -440,12 +440,11 @@ typedef struct MT_Lock {
                _DBG_LOCK_COUNT_0(l);                                   \
                if (!MT_lock_try(l)) {                                  \
                        /* we didn't get the lock */                    \
-                       int _spincnt = 0;                               \
+                       unsigned _spincnt = 0;                          \
                        _DBG_LOCK_CONTENTION(l);                        \
                        MT_thread_setlockwait(l);                       \
                        do {                                            \
-                               if (++_spincnt == 2048) {               \
-                                       _spincnt = 0;                   \
+                               if ((++_spincnt & 2047) == 0) {         \
                                        _DBG_LOCK_SLEEP(l);             \
                                        MT_sleep_ms(1);                 \
                                }                                       \
diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All
--- a/sql/jdbc/tests/Tests/All
+++ b/sql/jdbc/tests/Tests/All
@@ -42,3 +42,4 @@ HAVE_JDBCTESTS?BugResultSetMetaData_Bug_
 HAVE_JDBCTESTS?Bug_PrepStmtSetObject_CLOB_6349
 HAVE_JDBCTESTS?Bug_Connect_as_voc_getMetaData_Failure_Bug_6388
 HAVE_JDBCTESTS?Bug_PrepStmtSetString_6382
+HAVE_JDBCTESTS?Bug_LargeQueries_6571_6693
diff --git a/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.SQL.bat 
b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.SQL.bat
new file mode 100755
--- /dev/null
+++ b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.SQL.bat
@@ -0,0 +1,1 @@
+@call "%TSTSRCDIR%\Test.SQL.bat" %*
diff --git a/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.SQL.sh 
b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.SQL.sh
new file mode 100755
--- /dev/null
+++ b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.SQL.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+$TSTSRCDIR/Test.SQL.sh $*
diff --git a/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.err 
b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.err
@@ -0,0 +1,38 @@
+stderr of test 'Bug_LargeQueries_6571_6693` in directory 'sql/jdbc/tests` 
itself:
+
+
+# 18:48:54 >  
+# 18:48:54 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34708" "--set" 
"mapi_usock=/var/tmp/mtest-15166/.s.monetdb.34708" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/export/scratch1/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests" 
"--set" "embedded_c=true"
+# 18:48:54 >  
+
+# builtin opt  gdk_dbpath = 
/export/scratch1/dinther/INSTALL/var/monetdb5/dbfarm/demo
+# 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 = 34708
+# cmdline opt  mapi_usock = /var/tmp/mtest-15166/.s.monetdb.34708
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/export/scratch1/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests
+# cmdline opt  embedded_c = true
+#main thread:!ERROR:MALException:client.quit:Server stopped
+
+# 18:48:54 >  
+# 18:48:54 >  "./Bug_LargeQueries_6571_6693.SQL.sh" 
"Bug_LargeQueries_6571_6693"
+# 18:48:54 >  
+
+
+# 18:48:54 >  
+# 18:48:54 >  java Bug_LargeQueries_6571_6693 
"jdbc:monetdb://catskill:34708/mTests_sql_jdbc_tests?user=monetdb&password=monetdb"
+# 18:48:54 >  
+
+
+# 18:48:58 >  
+# 18:48:58 >  "Done."
+# 18:48:58 >  
+
diff --git a/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.out 
b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/jdbc/tests/Tests/Bug_LargeQueries_6571_6693.stable.out
@@ -0,0 +1,51 @@
+stdout of test 'Bug_LargeQueries_6571_6693` in directory 'sql/jdbc/tests` 
itself:
+
+
+# 18:48:54 >  
+# 18:48:54 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34708" "--set" 
"mapi_usock=/var/tmp/mtest-15166/.s.monetdb.34708" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/export/scratch1/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests" 
"--set" "embedded_c=true"
+# 18:48:54 >  
+
+# MonetDB 5 server v11.33.4 (hg id: b99c237c4372+)
+# This is an unreleased version
+# Serving database 'mTests_sql_jdbc_tests', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 31.305 GiB available main-memory.
+# Copyright (c) 1993 - July 2008 CWI.
+# Copyright (c) August 2008 - 2019 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://catskill.da.cwi.nl:34708/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-15166/.s.monetdb.34708
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 18:48:54 >  
+# 18:48:54 >  "./Bug_LargeQueries_6571_6693.SQL.sh" 
"Bug_LargeQueries_6571_6693"
+# 18:48:54 >  
+
+
+# 18:48:54 >  
+# 18:48:54 >  java Bug_LargeQueries_6571_6693 
"jdbc:monetdb://catskill:34708/mTests_sql_jdbc_tests?user=monetdb&password=monetdb"
+# 18:48:54 >  
+
+Created table: tbl6693 Inserting rows. 3 rows inserted
+Script size is 296607
+First test repeat 10 times
+Iteration: 1 2 3 4 5 6 7 8 9 10 
+Completed first test
+Second test repeat 10 times
+Iteration: 1 2 3 4 5 6 7 8 9 10 
+Completed second test
+Script size is 112838
+Third test repeat 3 times
+Iteration: 1 2 3 
+Completed third test
+Cleanup TABLE tbl6693
+Test completed without hanging
+
+
+# 18:48:58 >  
+# 18:48:58 >  "Done."
+# 18:48:58 >  
+
diff --git a/sql/test/BugTracker-2019/Tests/All 
b/sql/test/BugTracker-2019/Tests/All
--- a/sql/test/BugTracker-2019/Tests/All
+++ b/sql/test/BugTracker-2019/Tests/All
@@ -24,3 +24,4 @@ prepare-non-existing-function.Bug-6725
 select-distinct.Bug-6728
 table-duplicate-column.Bug-6729
 view-too-few-rows.Bug-6736
+sum-over-hge.Bug.6738
diff --git a/sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.sql 
b/sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.sql
@@ -0,0 +1,16 @@
+-- no cast to bigint (from hugeint) since the use of hugeint was part of the 
bug
+
+select foo,
+       sum(foo) over () as s1,
+       1.0 * sum(foo) over () as s2,
+       1.0 * cast(sum(foo) over () as float) as s3
+  from (select 7 as foo union all select 3 as foo) as t;
+
+select foo,
+       sum(foo) over () / 2
+  from (select 7 as foo union all select 3 as foo) as t;
+
+select foo,
+       sum(foo) over (order by foo) as sumsum1,
+       1.0 * sum(foo) over (order by foo) as cumsum2
+  from (values (1),(2),(3),(4),(5),(6)) as t(foo);
diff --git a/sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.stable.err 
b/sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.stable.err
@@ -0,0 +1,33 @@
+stderr of test 'sum-over-hge.Bug.6738` in directory 'sql/test/BugTracker-2019` 
itself:
+
+
+# 17:10:55 >  
+# 17:10:55 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=39988" "--set" 
"mapi_usock=/var/tmp/mtest-27118/.s.monetdb.39988" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2019"
 "--set" "embedded_c=true"
+# 17:10:55 >  
+
+# builtin opt  gdk_dbpath = /ufs/sjoerd/@Monet-stable/var/monetdb5/dbfarm/demo
+# 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 = 39988
+# cmdline opt  mapi_usock = /var/tmp/mtest-27118/.s.monetdb.39988
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2019
+# cmdline opt  embedded_c = true
+#main thread:!ERROR:MALException:client.quit:Server stopped
+
+# 17:10:55 >  
+# 17:10:55 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-27118" "--port=39988"
+# 17:10:55 >  
+
+
+# 17:10:56 >  
+# 17:10:56 >  "Done."
+# 17:10:56 >  
+
diff --git a/sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.stable.out 
b/sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/sum-over-hge.Bug.6738.stable.out
@@ -0,0 +1,101 @@
+stdout of test 'sum-over-hge.Bug.6738` in directory 'sql/test/BugTracker-2019` 
itself:
+
+
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to