[PATCH 2 of 6] revlog.revision: fix cache preload for inline revlogs

Siddharth Agarwal sid0 at fb.com
Sat Sep 7 15:40:36 CDT 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1378582966 25200
#      Sat Sep 07 12:42:46 2013 -0700
# Node ID 6d30cb54be060a26ce4a042be8ff43b88afc9829
# Parent  338cb41f98bf07596ba4b3b29d624ed77b4f18a1
revlog.revision: fix cache preload for inline revlogs

Previously the length of data preloaded did not account for the interleaved io
contents. This meant that we'd sometimes have cache misses in _chunks despite
the preloading.

Having a correctly filled out cache will become essential in an upcoming patch.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -845,9 +845,11 @@
 
     def _chunkraw(self, startrev, endrev):
         start = self.start(startrev)
-        length = self.end(endrev) - start
+        end = self.end(endrev)
         if self._inline:
             start += (startrev + 1) * self._io.size
+            end += (endrev + 1) * self._io.size
+        length = end - start
         return self._getchunk(start, length)
 
     def _chunk(self, rev):


More information about the Mercurial-devel mailing list