Patchwork [STABLE] revlog: make sure we never use sparserevlog without general delta (issue6056)

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 31, 2019, 10:49 p.m.
Message ID <20190201074939.629f85964b3e23cf7fdb7534@tcha.org>
Download mbox | patch
Permalink /patch/38275/
State New
Headers show

Comments

Yuya Nishihara - Jan. 31, 2019, 10:49 p.m.
On Thu, 31 Jan 2019 10:12:25 -0500, Boris FELD wrote:
> On 30/01/2019 17:43, Yuya Nishihara wrote:
> > On Wed, 30 Jan 2019 14:18:29 -0500, Boris FELD wrote:
> >> On 29/01/2019 07:11, Yuya Nishihara wrote:
> >>> On Tue, 29 Jan 2019 09:25:34 +0100, Mathias De Maré wrote:
> >>>> On Mon, Jan 28, 2019 at 1:21 PM Yuya Nishihara <yuya@tcha.org> wrote:
> >>>>> On Fri, 25 Jan 2019 15:00:52 -0500, Boris Feld wrote:
> >>>>>> # HG changeset patch
> >>>>>> # User Boris Feld <boris.feld@octobus.net>
> >>>>>> # Date 1548372167 18000
> >>>>>> #      Thu Jan 24 18:22:47 2019 -0500
> >>>>>> # Branch stable
> >>>>>> # Node ID c7661fdcaeac457aa5b8ae6b6a10b259713934b9
> >>>>>> # Parent  26ee61c33dee366576a0f7266fea9834985e78ec
> >>>>>> # EXP-Topic issue6056
> >>>>>> # Available At https://bitbucket.org/octobus/mercurial-devel/
> >>>>>> #              hg pull https://bitbucket.org/octobus/mercurial-devel/
> >>>>> -r c7661fdcaeac
> >>>>>> revlog: make sure we never use sparserevlog without general delta
> >>>>> (issue6056)
> >>>>>> We are getting user report where the delta code tries to use
> >>>>> `sparse-revlog`
> >>>>>> logic on repository where `generaldelta` is disabled. This can't work so
> >>>>> we
> >>>>>> ensure the two booleans have a consistent value.
> >>>>>>
> >>>>>> Creating this kind of repository is not expected to be possible and we
> >>>>> weren't
> >>>>>> able to create one for testing purpose. But if users run into this, we
> >>>>> better
> >>>>>> put stronger protection.
> >>>>> Mathias, do you have any idea how the broken repository could be created?
> >>>>>
> >>>> I think the issue might be related to our use of streaming clonebundles and
> >>>> a mismatch between some repositories on our server.
> >>>> For one specific repository, I see on the server that .hg/requires contains
> >>>> "revlogv1 store fncache dotencode".
> >>>> On the client that cloned (and cannot commit), the requires contains:
> >>>> "dotencode fncache generaldelta revlogv1 sparserevlog store"
> >>> That makes sense, thanks.
> >>>
> >>> The problem could be reproduced by adding --config format.usegeneraldelta=0
> >>> --config format.sparse-revlog=0 to test-clonebundles.t.
> >> Where are you adding this? We could not reproduce on our side.
> > Added it to "hg init server", and some repository mutation to clones.
> Do you have an exact patch to share? Adding it to `init` only was not
> enough.

Maybe this isn't the best way to reproduce the issue, but it failed:

Patch

diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -2,7 +2,7 @@ 
 
 Set up a server
 
-  $ hg init server
+  $ hg init server --config format.usegeneraldelta=0 --config format.sparse-revlog=0
   $ cd server
   $ cat >> .hg/hgrc << EOF
   > [extensions]
@@ -295,7 +295,7 @@  Stream clone bundles are supported
 
   $ hg -R server debugcreatestreamclonebundle packed.hg
   writing 613 bytes for 4 files
-  bundle requirements: generaldelta, revlogv1, sparserevlog
+  bundle requirements: revlogv1
 
 No bundle spec should work
 
@@ -310,6 +310,67 @@  No bundle spec should work
   finished applying clone bundle
   searching for changes
   no changes found
+  $ cat stream-clone-no-spec/.hg/requires
+  dotencode
+  fncache
+  generaldelta
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugrevlog stream-clone-no-spec/.hg/store/00manifest.i
+  format : 1
+  flags  : inline
+  
+  revisions     :   2
+      merges    :   0 ( 0.00%)
+      normal    :   2 (100.00%)
+  revisions     :   2
+      empty     :   0 ( 0.00%)
+                     text  :   0 (100.00%)
+                     delta :   0 (100.00%)
+      snapshot  :   1 (50.00%)
+        lvl-0   :         1 (50.00%)
+      deltas    :   1 (50.00%)
+  revision size : 103
+      snapshot  :  46 (44.66%)
+        lvl-0   :        46 (44.66%)
+      deltas    :  57 (55.34%)
+  
+  chunks        :   2
+      0x00      :   1 (50.00%)
+      0x75 (u)  :   1 (50.00%)
+  chunks size   : 103
+      0x00      :  57 (55.34%)
+      0x75 (u)  :  46 (44.66%)
+  
+  avg chain length  :   0
+  max chain length  :   1
+  max chain reach   : 103
+  compression ratio :   1
+  
+  uncompressed data size (min/max/avg) : 45 / 90 / 67
+  full revision size (min/max/avg)     : 46 / 46 / 46
+  inter-snapshot size (min/max/avg)    : 0 / 0 / 0
+  delta size (min/max/avg)             : 57 / 57 / 57
+  
+  deltas against prev  : 1 (100.00%)
+      where prev = p1  : 1     (100.00%)
+      where prev = p2  : 0     ( 0.00%)
+      other            : 0     ( 0.00%)
+  $ cd stream-clone-no-spec
+  $ touch a
+  $ hg ci -Am a 2>&1 | grep -v '^  '
+  adding a
+  transaction abort!
+  rollback completed
+  ** unknown exception encountered, please report by visiting
+  ** https://mercurial-scm.org/wiki/BugTracker
+  ** Python 2.7.15+ (default, Nov 28 2018, 16:27:22) [GCC 8.2.0]
+  ** Mercurial Distributed SCM (version 4.9rc0+144-e0926bcc387e)
+  ** Extensions loaded: 
+  Traceback (most recent call last):
+  UnboundLocalError: local variable 'parents' referenced before assignment
+  $ cd ..
 
 Bundle spec without parameters should work