persistent-nodemap: respect the mmap setting when refreshing data stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 21 Dec 2023 01:45:43 +0100
branchstable
changeset 51265 85d96517e650
parent 51175 1486d8c63f64
child 51277 d7155949535e
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.
mercurial/revlogutils/nodemap.py
--- 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