Changeset: acd55cbdb900 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/acd55cbdb900
Modified Files:
        gdk/ChangeLog.Jan2022
        sql/storage/bat/bat_logger.c
Branch: Jan2022
Log Message:

Merge with Jul2021 branch.


diffs (45 lines):

diff --git a/gdk/ChangeLog.Jan2022 b/gdk/ChangeLog.Jan2022
--- a/gdk/ChangeLog.Jan2022
+++ b/gdk/ChangeLog.Jan2022
@@ -1,6 +1,11 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Wed Aug 10 2022 Sjoerd Mullender <[email protected]>
+- A bug was fixed when upgrading a database from the Oct2020 releases
+  (11.39.X) or older when the write-ahead log (WAL) was not empty and
+  contained instructions to create new tables.
+
 * Tue Aug  2 2022 Sjoerd Mullender <[email protected]>
 - When destroying a bat, make sure there are no files left over in
   the BACKUP directory since they can cause problems when the bat id
diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -1821,6 +1821,26 @@ upgrade(old_logger *lg)
                bat_destroy(b1);
        }
 
+       /* add all bats that were added by processing the WAL and that have
+        * not been deleted since to the list of new bats */
+       bids = (const int *) Tloc(lg->catalog_bid, 0);
+       for (BUN p = lg->catalog_bid->batInserted, q = 
lg->catalog_bid->batCount;
+                p < q;
+                p++) {
+               bat bid = bids[p];
+               if (BUNfnd(lg->lg->catalog_bid, &(int){bid}) != BUN_NONE) {
+                       b = BATdescriptor(bid);
+                       if (b) {
+                               if (BATmode(b, false) != GDK_SUCCEED ||
+                                       BUNappend(lg->add, &(int){bid}, false) 
!= GDK_SUCCEED) {
+                                       BBPunfix(bid);
+                                       goto bailout;
+                               }
+                               BBPkeepref(bid);
+                       }
+               }
+       }
+
        rc = GDK_SUCCEED;
 
   bailout:
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to