changeset 51151:85d96517e650 stable

persistent-nodemap: respect the mmap setting when refreshing data After writing updated data, we reload the in-memory data. However, that logic was… wrong. We were doing file read when mmap was requested and when the configuration was requesting to not use mmap… we were using it. This should now be fine.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 21 Dec 2023 01:45:43 +0100
parents 1486d8c63f64
children d7155949535e
files mercurial/revlogutils/nodemap.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/nodemap.py	Thu Dec 07 03:49:48 2023 +0100
+++ b/mercurial/revlogutils/nodemap.py	Thu Dec 21 01:45:43 2023 +0100
@@ -206,11 +206,11 @@
                 fd.write(data)
                 if feed_data:
                     if use_mmap:
+                        fd.flush()
+                        new_data = util.buffer(util.mmapread(fd, new_length))
+                    else:
                         fd.seek(0)
                         new_data = fd.read(new_length)
-                    else:
-                        fd.flush()
-                        new_data = util.buffer(util.mmapread(fd, new_length))
             target_docket.data_length = new_length
             target_docket.data_unused = new_unused