Changeset: 36890da7c473 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/36890da7c473
Modified Files:
        gdk/ChangeLog.Jun2023
        gdk/gdk_logger.c
Branch: Jun2023
Log Message:

Fix a bug during startup.
If during startup the catalog_bid files contains a reference to a bat
that has already been deleted, and the WAL contains statements to create
a new bat (i.e. a new table), and that already deleted bat's id gets
reused, the logger got confused about this and the bat might not
actually survive the subcommit.
This was fixed by setting the catalog_lid entry to a special value (-1)
that is recognized as meaning, the bat was pre-deleted and the entry
should just be removed from the catalog by cleanup_and_swap.  I.e. no
other actions to be performed.


diffs (38 lines):

diff --git a/gdk/ChangeLog.Jun2023 b/gdk/ChangeLog.Jun2023
--- a/gdk/ChangeLog.Jun2023
+++ b/gdk/ChangeLog.Jun2023
@@ -1,3 +1,9 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Tue Oct 31 2023 Sjoerd Mullender <sjo...@acm.org>
+- A bug was fixed where the administration of which bats were in use was
+  interpreted incorrectly during startup, causing problems later.  One
+  symptom that has been observed was failure to startup with a message
+  that the catalog tables could not be loaded.
+
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1506,7 +1506,7 @@ bm_get_counts(logger *lg)
                        cnt = BATcount(b);
                } else {
                        deleted++;
-                       lid = 1;
+                       lid = BBP_desc(bids[p]) ? 1 : -1;
                }
                if (BUNappend(lg->catalog_cnt, &cnt, false) != GDK_SUCCEED)
                        return GDK_FAIL;
@@ -1693,8 +1693,11 @@ bm_subcommit(logger *lg, uint32_t *updat
                }
                bat col = bids[p];
 
-               if (lids && lids[p] != lng_nil && lids[p] <= lg->saved_tid)
+               if (lids && lids[p] != lng_nil && lids[p] <= lg->saved_tid) {
                        cleanup++;
+                       if (lids[p] == -1)
+                               continue;
+               }
                TRC_DEBUG(WAL, "new %s (%d)\n", BBP_logical(col), col);
                assert(col);
                sizes[i] = cnts ? (BUN) cnts[p] : 0;
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to