[Updated] D10785: revlog: use dedicated code for reading sidedata
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Mon Jun 7 09:24:33 UTC 2021
Closed by commit rHG75e1104f23a2: revlog: use dedicated code for reading sidedata (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D10785?vs=28444&id=28488
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://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210607/77cb4ce4/attachment-0001.html>
More information about the Mercurial-patches
mailing list