Changeset: 6538219ec0df for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6538219ec0df
Modified Files:
        gdk/gdk_bbp.c
Branch: Dec2023
Log Message:

During subcommit, move already created backup files to subcommit directory.
This fixes bug #7501.


diffs (37 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -4109,6 +4109,33 @@ BBPsync(int cnt, bat *restrict subcommit
                        if (lock)
                                MT_lock_set(&GDKswapLock(bid));
                }
+               if (subcommit) {
+                       /* move any tail/theap files we find for this bat that
+                        * are in the BACKUP directory to the SUBCOMMIT
+                        * directory */
+                       char fname[16]; /* plenty big enough */
+                       if (snprintf(fname, sizeof(fname), "%o", i) < 16) {
+                               /* the snprintf never fails, any of the
+                                * below may fail */
+                               if (GDKmove(0, BAKDIR, fname, "tail", SUBDIR, 
fname, "tail", false) == GDK_SUCCEED)
+                                       TRC_DEBUG(BAT_, "moved %s.tail from %s 
to %s\n",
+                                                 fname, BAKDIR, SUBDIR);
+                               if (GDKmove(0, BAKDIR, fname, "tail1", SUBDIR, 
fname, "tail1", false) == GDK_SUCCEED)
+                                       TRC_DEBUG(BAT_, "moved %s.tail1 from %s 
to %s\n",
+                                                 fname, BAKDIR, SUBDIR);
+                               if (GDKmove(0, BAKDIR, fname, "tail2", SUBDIR, 
fname, "tail2", false) == GDK_SUCCEED)
+                                       TRC_DEBUG(BAT_, "moved %s.tail2 from %s 
to %s\n",
+                                                 fname, BAKDIR, SUBDIR);
+#if SIZEOF_VAR_T == 8
+                               if (GDKmove(0, BAKDIR, fname, "tail4", SUBDIR, 
fname, "tail4", false) == GDK_SUCCEED)
+                                       TRC_DEBUG(BAT_, "moved %s.tail4 from %s 
to %s\n",
+                                                 fname, BAKDIR, SUBDIR);
+#endif
+                               if (GDKmove(0, BAKDIR, fname, "theap", SUBDIR, 
fname, "theap", false) == GDK_SUCCEED)
+                                       TRC_DEBUG(BAT_, "moved %s.theap from %s 
to %s\n",
+                                                 fname, BAKDIR, SUBDIR);
+                       }
+               }
                BAT *b = dirty_bat(&i, subcommit != NULL);
                if (i <= 0 ||
                    (BBP_status(bid) & BBPEXISTING &&
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to