Changeset: cc4c2e909c01 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cc4c2e909c01
Modified Files:
        gdk/gdk_storage.c
Branch: Mar2025
Log Message:

Don't truncate pre-exisiting heap files, but do truncate pre-existing text 
files.
See comment in code.


diffs (19 lines):

diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -231,7 +231,14 @@ GDKfdlocate(int farmid, const char *nme,
        }
 
        if (strchr(mode, 'w')) {
-               flags |= O_WRONLY | O_CREAT | O_TRUNC;
+               flags |= O_WRONLY | O_CREAT;
+               /* HACK ALERT: text files also get truncated but binary
+                * files not!  This is because mmap extend depends on
+                * files not getting truncated, and a second hot
+                * snapshot needs to completely overwrite a pre-existing
+                * (from an earlier snapshot) BBP.dir file. */
+               if (strchr(mode, 'b') == NULL)
+                       flags |= O_TRUNC;
        } else if (!strchr(mode, '+')) {
                flags |= O_RDONLY;
        } else {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to