Changeset: dcbdb4e378d0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/dcbdb4e378d0 Modified Files: gdk/ChangeLog.Jul2021 sql/storage/bat/bat_logger.c Branch: Jul2021 Log Message:
Fixed an upgrade bug when the WAL is not empty. diffs (42 lines): diff --git a/gdk/ChangeLog.Jul2021 b/gdk/ChangeLog.Jul2021 --- a/gdk/ChangeLog.Jul2021 +++ b/gdk/ChangeLog.Jul2021 @@ -1,3 +1,8 @@ # 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. + 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 @@ -1804,6 +1804,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]
