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

login
register
mail settings
Submitter Siddharth Agarwal
Date Sept. 7, 2013, 8:40 p.m.
Message ID <6d30cb54be060a26ce4a.1378586436@dev1091.prn1.facebook.com>
Download mbox | patch
Permalink /patch/2406/
State Accepted
Commit 0e07c0b5fb1c98f758bda54623a88ea692e1bac9
Headers show

Comments

Siddharth Agarwal - Sept. 7, 2013, 8:40 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@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.

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):