Changeset: 76c3677f74c8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/76c3677f74c8
Modified Files:
        gdk/gdk_bbp.c
        sql/server/rel_optimizer.c
Branch: default
Log Message:

Merge with Jul2021 branch.


diffs (164 lines):

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 <sjo...@acm.org>
+- 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 <sjo...@acm.org>
 - 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
@@ -958,7 +958,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/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 <sjo...@acm.org>
+- 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 <y.zh...@cwi.nl>
 - [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 <sjo...@acm.org>
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -8212,10 +8212,11 @@ exp_merge_range(visitor *v, sql_rel *rel
 static int
 reduce_scale(atom *a)
 {
+       int i = 0;
+
 #ifdef HAVE_HGE
        if (a->data.vtype == TYPE_hge) {
                hge v = a->data.val.hval;
-               int i = 0;
 
                if (v != 0)
                        while( (v/10)*10 == v ) {
@@ -8223,12 +8224,10 @@ reduce_scale(atom *a)
                                v /= 10;
                        }
                a->data.val.hval = v;
-               return i;
-       }
+       } else
 #endif
        if (a->data.vtype == TYPE_lng) {
                lng v = a->data.val.lval;
-               int i = 0;
 
                if (v != 0)
                        while( (v/10)*10 == v ) {
@@ -8236,11 +8235,8 @@ reduce_scale(atom *a)
                                v /= 10;
                        }
                a->data.val.lval = v;
-               return i;
-       }
-       if (a->data.vtype == TYPE_int) {
+       } else if (a->data.vtype == TYPE_int) {
                int v = a->data.val.ival;
-               int i = 0;
 
                if (v != 0)
                        while( (v/10)*10 == v ) {
@@ -8248,11 +8244,8 @@ reduce_scale(atom *a)
                                v /= 10;
                        }
                a->data.val.ival = v;
-               return i;
-       }
-       if (a->data.vtype == TYPE_sht) {
+       } else if (a->data.vtype == TYPE_sht) {
                sht v = a->data.val.shval;
-               int i = 0;
 
                if (v != 0)
                        while( (v/10)*10 == v ) {
@@ -8260,9 +8253,9 @@ reduce_scale(atom *a)
                                v /= 10;
                        }
                a->data.val.shval = v;
-               return i;
-       }
-       return 0;
+       }
+       a->tpe.scale -= i;
+       return i;
 }
 
 static sql_rel *
diff --git a/sql/test/SQLancer/Tests/sqlancer19.SQL.py 
b/sql/test/SQLancer/Tests/sqlancer19.SQL.py
--- a/sql/test/SQLancer/Tests/sqlancer19.SQL.py
+++ b/sql/test/SQLancer/Tests/sqlancer19.SQL.py
@@ -88,14 +88,30 @@ with SQLTestCase() as cli:
         .assertSucceeded().assertDataResultMatch([(Decimal('3.571'),)])
     cli.execute("SELECT 3 / 0.84 FROM rt3 where rt3.c0 = 1;") \
         .assertSucceeded().assertDataResultMatch([(Decimal('3.571'),)])
+    cli.execute("SELECT CAST(2 AS DECIMAL) * 0.010 FROM t3 where t3.c0 = 1;") \
+        .assertSucceeded().assertDataResultMatch([(Decimal('0.02000'),)])
+    cli.execute("SELECT CAST(2 AS DECIMAL) * 0.010 FROM rt3 where rt3.c0 = 
1;") \
+        .assertSucceeded().assertDataResultMatch([(Decimal('0.02000'),)])
     cli.execute("SELECT t3.c0 FROM t3 INNER JOIN t3 myx ON t3.c0 = myx.c0 
ORDER BY t3.c0;") \
         
.assertSucceeded().assertDataResultMatch([(1,),(2,),(2,),(2,),(2,),(5,),(5,),(5,),(5,),(7,)])
     cli.execute("SELECT rt3.c0 FROM rt3 INNER JOIN rt3 myx ON rt3.c0 = myx.c0 
ORDER BY rt3.c0;") \
         
.assertSucceeded().assertDataResultMatch([(1,),(2,),(2,),(2,),(2,),(5,),(5,),(5,),(5,),(7,)])
+
+    # Issues related to digits and scale propagation in the sql layer
+    cli.execute("SELECT CAST(2 AS DECIMAL) & CAST(3 AS DOUBLE) FROM t3 where 
t3.c0 = 1;") \
+        .assertSucceeded().assertDataResultMatch([(Decimal('0.002'),)])
+    cli.execute("SELECT CAST(2 AS DECIMAL) & CAST(3 AS DOUBLE) FROM rt3 where 
rt3.c0 = 1;") \
+        .assertSucceeded().assertDataResultMatch([(Decimal('0.002'),)])
     cli.execute("SELECT greatest('69', splitpart('', '191', 2)) FROM t3 where 
t3.c0 = 1;") \
         .assertSucceeded().assertDataResultMatch([('69',)])
     cli.execute("SELECT greatest('69', splitpart('', '191', 2)) FROM rt3 where 
rt3.c0 = 1;") \
         .assertSucceeded().assertDataResultMatch([('69',)])
+
+    # Issues related to comparisons not being correctly delimited on plans, 
which causes ambiguity
+    cli.execute("SELECT TRUE BETWEEN (TRUE BETWEEN FALSE AND FALSE) AND TRUE 
FROM t3 where t3.c0 = 1;") \
+        .assertSucceeded().assertDataResultMatch([(True,)])
+    cli.execute("SELECT TRUE BETWEEN (TRUE BETWEEN FALSE AND FALSE) AND TRUE 
FROM rt3 where rt3.c0 = 1;") \
+        .assertSucceeded().assertDataResultMatch([(True,)])
     cli.execute("SELECT 1 FROM t3 WHERE (t3.c0 BETWEEN t3.c0 AND t3.c0) IS 
NULL;") \
         .assertSucceeded().assertDataResultMatch([])
     cli.execute("SELECT 2 FROM rt3 WHERE (rt3.c0 BETWEEN rt3.c0 AND rt3.c0) IS 
NULL;") \
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to