[Commented On] D10785: revlog: use dedicated code for reading sidedata
baymax (Baymax, Your Personal Patch-care Companion)
phabricator at mercurial-scm.org
Fri Jun 4 13:55:39 UTC 2021
baymax added a comment.
baymax updated this revision to Diff 28444.
✅ refresh by Heptapod after a successful CI run (🐙 💚)
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D10785?vs=28395&id=28444
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D10785/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D10785
AFFECTED FILES
mercurial/configitems.py
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -803,6 +803,10 @@
with func() as fp:
yield fp
+ def _sidedatareadfp(self):
+ """file object suitable to read sidedata"""
+ return self._datareadfp()
+
def tiprev(self):
return len(self.index) - 1
@@ -2068,7 +2072,19 @@
if sidedata_size == 0:
return {}
- comp_segment = self._getsegment(sidedata_offset, sidedata_size)
+ # XXX this need caching, as we do for data
+ with self._sidedatareadfp() as sdf:
+ sdf.seek(sidedata_offset)
+ comp_segment = sdf.read(sidedata_size)
+
+ if len(comp_segment) < sidedata_size:
+ filename = self._datafile
+ length = sidedata_size
+ offset = sidedata_offset
+ got = len(comp_segment)
+ m = PARTIAL_READ_MSG % (filename, length, offset, got)
+ raise error.RevlogError(m)
+
comp = self.index[rev][11]
if comp == COMP_MODE_PLAIN:
segment = comp_segment
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1161,6 +1161,7 @@
# keeping references to the affected revlogs, especially memory-wise when
# rewriting sidedata.
# * introduce a proper solution to reduce the number of filelog related files.
+# * use caching for reading sidedata (similar to what we do for data).
# * Improvement to consider
# - avoid compression header in chunk using the default compression?
# - forbid "inline" compression mode entirely?
To: marmoute, indygreg, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210604/f226d6ad/attachment-0002.html>
More information about the Mercurial-patches
mailing list