Changeset: 64a8583dbdd5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/64a8583dbdd5
Modified Files:
        monetdb5/modules/atoms/str.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 2307 to 300 lines):

diff --git a/ChangeLog.Dec2023 b/ChangeLog.Dec2023
--- a/ChangeLog.Dec2023
+++ b/ChangeLog.Dec2023
@@ -1,3 +1,9 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Thu Jan 11 2024 Sjoerd Mullender <[email protected]>
+- The copyright for the MonetDB software has been transferred to the newly
+  established MonetDB Foundation, a not-for-profit foundation with the
+  express goal of furthering the MonetDB database system.  The license
+  for the software does not change: MonetDB remains fully open source.
+
diff --git a/gdk/ChangeLog.Dec2023 b/gdk/ChangeLog.Dec2023
--- a/gdk/ChangeLog.Dec2023
+++ b/gdk/ChangeLog.Dec2023
@@ -1,3 +1,10 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Fri Mar  1 2024 Sjoerd Mullender <[email protected]>
+- Fixed a regression where bats weren't always cleaned up when they
+  weren't needed anymore.  In particular, after a DELETE FROM table query
+  without a WHERE clause (which deletes all rows from the table), the
+  bats for the table get replaced by new ones, and the old, now unused,
+  bats weren't removed from the database.
+
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -217,6 +217,7 @@ HEAPalloc(Heap *h, size_t nitems, size_t
                        return GDK_FAIL;
                }
                GDKfree(nme);
+               TRC_DEBUG(HEAP, "%s %zu %p (mmap)\n", h->filename, size, 
h->base);
        }
        h->newstorage = h->storage;
        return GDK_SUCCEED;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1224,6 +1224,8 @@ log_read_transaction(logger *lg, uint32_
        bool ok = true;
        ATOMIC_BASE_TYPE dbg = ATOMIC_GET(&GDKdebug);
 
+       (void) maxupdated;      /* only used inside assert() */
+
        if (!lg->flushing)
                ATOMIC_AND(&GDKdebug, ~CHECKMASK);
 
@@ -1251,16 +1253,40 @@ log_read_transaction(logger *lg, uint32_
                        if (updated && BAThash(lg->catalog_id) == GDK_SUCCEED) {
                                BATiter cni = bat_iterator(lg->catalog_id);
                                BUN p;
+                               BUN posnew = BUN_NONE;
+                               BUN posold = BUN_NONE;
                                MT_rwlock_rdlock(&cni.b->thashlock);
                                HASHloop_int(cni, cni.b->thash, p, &l.id) {
-                                       (void)maxupdated;
-                                       assert(p < maxupdated);
-                                       updated[p / 32] |= 1U << (p % 32);
-                                       /* there should only be one hit */
-                                       break;
+                                       lng lid = *(lng *) 
Tloc(lg->catalog_lid, p);
+                                       if (lid == lng_nil || lid > tr->tid)
+                                               posnew = p;
+                                       else if (lid == tr->tid)
+                                               posold = p;
                                }
                                MT_rwlock_rdunlock(&cni.b->thashlock);
                                bat_iterator_end(&cni);
+                               /* Normally at this point, posnew is the
+                                * location of the bat that this
+                                * transaction is working on, and posold
+                                * is the location of the previous
+                                * version of the bat.  If LOG_CREATE,
+                                * both are relevant, since the latter
+                                * is the new bat, and the former is the
+                                * to-be-destroyed bat.  For
+                                * LOG_DESTROY, only posnew should be
+                                * relevant, but for the other types, if
+                                * the table is destroyed later in the
+                                * same transaction, we need posold, and
+                                * else (the normal case) we need
+                                * posnew. */
+                               if (posnew != BUN_NONE) {
+                                       assert(posnew < maxupdated);
+                                       updated[posnew / 32] |= 1U << (posnew % 
32);
+                               }
+                               if ((l.flag == LOG_CREATE || posnew == 
BUN_NONE) && posold != BUN_NONE) {
+                                       assert(posold < maxupdated);
+                                       updated[posold / 32] |= 1U << (posold % 
32);
+                               }
                        }
                        break;
                default:
@@ -2643,8 +2669,7 @@ log_flush(logger *lg, ulng ts)
                                TRC_CRITICAL(GDK, "log_id filename is too 
large\n");
                                return GDK_FAIL;
                        }
-                       if ((filename =
-                            GDKfilepath(BBPselectfarm(PERSISTENT, 0, offheap), 
lg->dir, LOGFILE, id)) == NULL) {
+                       if ((filename = GDKfilepath(BBPselectfarm(PERSISTENT, 
0, offheap), lg->dir, LOGFILE, id)) == NULL) {
                                GDKfree(updated);
                                return GDK_FAIL;
                        }
@@ -3386,8 +3411,9 @@ log_add_bat(logger *lg, BAT *b, log_id i
        bid = b->batCacheid;
        TRC_DEBUG(WAL, "create %d\n", id);
        assert(log_find(lg->catalog_bid, lg->dcatalog, bid) == BUN_NONE);
-       if (BUNappend(lg->catalog_bid, &bid, true) != GDK_SUCCEED || 
BUNappend(lg->catalog_id, &id, true) != GDK_SUCCEED
-           || BUNappend(lg->catalog_cnt, &cnt, false) != GDK_SUCCEED ||
+       if (BUNappend(lg->catalog_bid, &bid, true) != GDK_SUCCEED ||
+           BUNappend(lg->catalog_id, &id, true) != GDK_SUCCEED ||
+           BUNappend(lg->catalog_cnt, &cnt, false) != GDK_SUCCEED ||
            BUNappend(lg->catalog_lid, &lid, false) != GDK_SUCCEED)
                return GDK_FAIL;
        if (lg->current)
diff --git a/geom/monetdb5/geom_atoms.c b/geom/monetdb5/geom_atoms.c
--- a/geom/monetdb5/geom_atoms.c
+++ b/geom/monetdb5/geom_atoms.c
@@ -272,8 +272,8 @@ wkbFROMSTR_withSRID(const char *geomWKT,
 {
        GEOSGeom geosGeometry = NULL;   /* The geometry object that is parsed 
from the src string. */
        GEOSWKTReader *WKT_reader;
-       const char *polyhedralSurface = "POLYHEDRALSURFACE";
-       const char *multiPolygon = "MULTIPOLYGON";
+       static const char polyhedralSurface[] = "POLYHEDRALSURFACE";
+       static const char multiPolygon[] = "MULTIPOLYGON";
        char *geomWKT_new = NULL;
        size_t parsedCharacters = 0;
 
diff --git a/monetdb5/modules/mal/Tests/qgram.maltest 
b/monetdb5/modules/mal/Tests/qgram.maltest
--- a/monetdb5/modules/mal/Tests/qgram.maltest
+++ b/monetdb5/modules/mal/Tests/qgram.maltest
@@ -36,27 +36,27 @@ query IT rowsort
 io.print(b)
 ----
 0
-##h@
+##hä
 1
-#h@l
+#häl
 10
-r@@$
+rłð$
 11
-@@$$
+łð$$
 2
-h@ll
+häll
 3
-@ll@
+ällö
 4
-ll@ 
+llö 
 5
-l@ w
+lö w
 6
-@ w@
+ö wø
 7
- w@r
+ wør
 8
-w@r@
+wørł
 9
-@r@@
+ørłð
 
diff --git a/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_05.test 
b/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_05.test
--- a/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_05.test
+++ b/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_05.test
@@ -54,9 +54,6 @@ 33
 33.000000
 42
 42.000000
-@
-@
-@
 hello
 hello
 hello
@@ -64,6 +61,9 @@ hello
 hello
 hello
 hello
+Ö
+Ö
+Ö
 
 statement ok
 DROP TABLE pyloader05table
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3715,7 +3715,7 @@ temporal_convert(backend *be, stmt *v, s
        bool add_tz = false, pushed = (v->cand && v->cand == sel);
 
        if (before) {
-               if (f->type->eclass == EC_TIMESTAMP_TZ && t->type->eclass == 
EC_TIMESTAMP) {
+               if (f->type->eclass == EC_TIMESTAMP_TZ && (t->type->eclass == 
EC_TIMESTAMP || t->type->eclass == EC_TIME)) {
                        /* call timestamp+local_timezone */
                        convert = "timestamp_add_msec_interval";
                        add_tz = true;
@@ -3728,7 +3728,7 @@ temporal_convert(backend *be, stmt *v, s
                        /* call timestamp+local_timezone */
                        convert = "timestamp_sub_msec_interval";
                        add_tz = true;
-               } else if (f->type->eclass == EC_TIME_TZ && t->type->eclass == 
EC_TIME) {
+               } else if (f->type->eclass == EC_TIME_TZ && (t->type->eclass == 
EC_TIME || t->type->eclass == EC_TIMESTAMP)) {
                        /* call times+local_timezone */
                        convert = "time_add_msec_interval";
                        add_tz = true;
diff --git a/sql/benchmarks/tpcds/Tests/one.test.in 
b/sql/benchmarks/tpcds/Tests/one.test.in
--- a/sql/benchmarks/tpcds/Tests/one.test.in
+++ b/sql/benchmarks/tpcds/Tests/one.test.in
@@ -4616,7 +4616,7 @@ with customer_total_return as
                   ,c_last_review_date,ctr_total_return
 limit 100
 ----
-1300 values hashing to 4b80e4995150e5b42229a363bb57dd07
+1300 values hashing to 46f76e63ac60a7b540f258c4ad0fbfdb
 
 query TIRRRR rowsort
 -- query 31
diff --git 
a/sql/test/BugDay_2005-10-06_2.9.3/Tests/accents_in_strings.SF-926709.test 
b/sql/test/BugDay_2005-10-06_2.9.3/Tests/accents_in_strings.SF-926709.test
--- a/sql/test/BugDay_2005-10-06_2.9.3/Tests/accents_in_strings.SF-926709.test
+++ b/sql/test/BugDay_2005-10-06_2.9.3/Tests/accents_in_strings.SF-926709.test
@@ -14,7 +14,7 @@ query IT rowsort
 SELECT * FROM bugtest
 ----
 1
-Andr@
+André
 1
 test
 
diff --git a/sql/test/BugTracker-2009/Tests/utf8_bug.SF-2822855.test 
b/sql/test/BugTracker-2009/Tests/utf8_bug.SF-2822855.test
--- a/sql/test/BugTracker-2009/Tests/utf8_bug.SF-2822855.test
+++ b/sql/test/BugTracker-2009/Tests/utf8_bug.SF-2822855.test
@@ -19,15 +19,15 @@ select a, length(a) AS len from utf8len
 ----
 0
 1
-@
+€
 1
-@
+€
 1
 
 query T rowsort
 select 'Liever €uro' as "Liever euro"
 ----
-Liever @uro
+Liever €uro
 
 statement ok
 drop table utf8len
diff --git a/sql/test/BugTracker-2014/Tests/BOM-in-string.Bug-3641.test 
b/sql/test/BugTracker-2014/Tests/BOM-in-string.Bug-3641.test
--- a/sql/test/BugTracker-2014/Tests/BOM-in-string.Bug-3641.test
+++ b/sql/test/BugTracker-2014/Tests/BOM-in-string.Bug-3641.test
@@ -6,5 +6,5 @@ select '  '
 query T rowsort
 select '  '
 ----
-  @
+  
 
diff --git a/sql/test/BugTracker-2015/Tests/import-non-ascii.Bug-3864.test 
b/sql/test/BugTracker-2015/Tests/import-non-ascii.Bug-3864.test
--- a/sql/test/BugTracker-2015/Tests/import-non-ascii.Bug-3864.test
+++ b/sql/test/BugTracker-2015/Tests/import-non-ascii.Bug-3864.test
@@ -16,9 +16,9 @@ query IT rowsort
 select * from varcharsize5
 ----
 1
-@@@@@
+不要让早把
 1
-@@@@@
+不要让早把
 
 statement ok
 rollback
diff --git a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test 
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test
--- a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test
+++ b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test
@@ -13776,13 +13776,13 @@ query TT rowsort
 SELECT v, convert(v, time) from T_timestamptz
 ----
 1999-12-31 23:59:59+02:00
-21:59:59
+23:59:59
 2016-01-01 00:00:00+02:00
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to