revlog: also detect intermediate snapshots
authorPaul Morelle <paul.morelle@octobus.net>
Fri, 20 Jul 2018 13:34:48 +0200
changeset 39150 f39efa885a6d
parent 39149 f8db458651c8
child 39151 07b82f55f351
revlog: also detect intermediate snapshots Also detect intermediate-snapshot done against another previous snapshot. Doing an intermediate snapshot instead of a full one can reduce the number of full snapshots we need. They are especially useful for content with a lot of churn on the same line (eg: the manifest) where having a delta over multiple revisions can end up being significantly smaller than the sum of these revision deltas. A revlog built using intermediate snapshots can be a bit smaller and reuse snapshot much more efficiently. This last property is useful combined with constraints on chain length. Using intermediate snapshot can produce repository with delta chain ten times shorter without impact on the storage size. Shorter chain lengths are faster to restore, greatly improving read performance. This changesets (and the following ones) focus on getting the core principle of intermediate snapshots into Mercurial core. Later changeset will introduce the strategy to create them.
mercurial/revlog.py
--- a/mercurial/revlog.py	Fri Jul 20 13:32:17 2018 +0200
+++ b/mercurial/revlog.py	Fri Jul 20 13:34:48 2018 +0200
@@ -2103,7 +2103,10 @@
         deltap = self.deltaparent(rev)
         if deltap == nullrev:
             return True
-        return False
+        p1, p2 = self.parentrevs(rev)
+        if deltap in (p1, p2):
+            return False
+        return self.issnapshot(deltap)
 
     def revdiff(self, rev1, rev2):
         """return or calculate a delta between two revisions