reconcile raises a KeyError on a fresh branch

Bug #336749 reported by Wouter van Heyst
52
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Jelmer Vernooij
Bazaar Subversion Plugin
Invalid
Undecided
Unassigned

Bug Description

> bzr check https://source/svn/kmx/trunk/spitfire/
    No working tree found at specified location. analyzing repository layout 2000/8393
    Checking repository at 'https://source/svn/kmx/trunk/spitfire/'.
    checked repository <bzrlib.plugins.svn.transport.SvnRaTransport url=https://source/svn/kmx/trunk/spitfire/> format <SvnRepositoryFormat>
       244 revisions
        93 revisions originating in bzr
         1 files were not changed but had their revision/fileid changed
    Checking branch at 'https://source/svn/kmx/trunk/spitfire/'.
    checked branch https://source/svn/kmx/trunk/spitfire format Subversion Smart Server

> bzr branch https://source/svn/kmx/trunk/spitfire/
    Branched 242 revision(s).

> cd spitfire; bzr reconcile
    Reconciling branch file:///tmp/spitfire/
    revision_history ok.
    Reconciling repository file:///tmp/spitfire/
    bzr: ERROR: exceptions.KeyError: '<email address hidden>'

    Traceback (most recent call last):
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/commands.py", line 921, in run_bzr_catch_errors
        return run_bzr(argv)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/commands.py", line 866, in run_bzr
        ret = run(*run_argv)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/commands.py", line 547, in run_argv_aliases
        return self.run(**all_cmd_args)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/builtins.py", line 1450, in run
        reconcile(dir)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/reconcile.py", line 53, in reconcile
        reconciler.reconcile()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/reconcile.py", line 77, in reconcile
        self._reconcile()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/reconcile.py", line 84, in _reconcile
        self._reconcile_repository()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/reconcile.py", line 103, in _reconcile_repository
        repo_reconciler = self.repo.reconcile(thorough=True)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/decorators.py", line 192, in write_locked
        result = unbound(self, *args, **kwargs)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repofmt/pack_repo.py", line 2197, in reconcile
        reconciler.reconcile()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/reconcile.py", line 195, in reconcile
        self._reconcile_steps()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/reconcile.py", line 510, in _reconcile_steps
        new_pack = self._packer.pack(pb=self.pb)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repofmt/pack_repo.py", line 721, in pack
        return self._create_pack_from_packs()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repofmt/pack_repo.py", line 875, in _create_pack_from_packs
        self._copy_text_texts()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repofmt/pack_repo.py", line 1227, in _copy_text_texts
        bad_texts.sort(key=lambda key:rev_order[key[0][1]])
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repofmt/pack_repo.py", line 1227, in <lambda>
        bad_texts.sort(key=lambda key:rev_order[key[0][1]])
    KeyError: '<email address hidden>'

Revision history for this message
Wouter van Heyst (larstiq) wrote :

There may be an interplay between 0.4 and 0.5 revision roundtripping going on or something. In the bzr branch that had been pushed into svn, the KeyErroring revid is a merged revision: 202.1.4

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 336749] Re: reconcile raises a KeyError on a fresh branch

Does "bzr check" on that branch work ok ? (both locally and on the svn
url) ?
--
Jelmer Vernooij <email address hidden> - http://samba.org/~jelmer/
Jabber: <email address hidden>

Revision history for this message
Wouter van Heyst (larstiq) wrote :

Yes and yes.

Revision history for this message
Wouter van Heyst (larstiq) wrote :

Oh, and `bzr branch` not working fwiw:

> bzr branch spitfire.svn boom
    bzr: ERROR: bzrlib.errors.BzrCheckError: Internal check failed: Newly created pack file <bzrlib.repofmt.pack_repo.NewPack object at 0x1dd4990> has delta references to items not in its repository:
    {'texts': [('__init__.py-20080908123649-lz3vayx6gtzjffc0-6',
                '<email address hidden>'),
               ('setup.py-20080908123649-lz3vayx6gtzjffc0-5',
                '<email address hidden>')]}

    Traceback (most recent call last):
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/commands.py", line 921, in run_bzr_catch_errors
        return run_bzr(argv)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/commands.py", line 866, in run_bzr
        ret = run(*run_argv)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/commands.py", line 547, in run_argv_aliases
        return self.run(**all_cmd_args)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/builtins.py", line 1102, in run
        source_branch=br_from)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/bzrdir.py", line 1121, in sprout
        result_repo.fetch(source_repository, revision_id=revision_id)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repository.py", line 1120, in fetch
        find_ghosts=find_ghosts)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/decorators.py", line 192, in write_locked
        result = unbound(self, *args, **kwargs)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repository.py", line 3010, in fetch
        return self._pack(self.source, self.target, revision_ids)
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repository.py", line 3017, in _pack
        revision_ids).pack()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repofmt/pack_repo.py", line 721, in pack
        return self._create_pack_from_packs()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repofmt/pack_repo.py", line 891, in _create_pack_from_packs
        new_pack._check_references()
      File "/home/wouter/src/bzr/bzr.dev/bzrlib/repofmt/pack_repo.py", line 191, in _check_references
        % (self, pformat(missing_items)))
    BzrCheckError: Internal check failed: Newly created pack file <bzrlib.repofmt.pack_repo.NewPack object at 0x1dd4990> has delta references to items not in its repository:
    {'texts': [('__init__.py-20080908123649-lz3vayx6gtzjffc0-6',
                '<email address hidden>'),
               ('setup.py-20080908123649-lz3vayx6gtzjffc0-5',
                '<email address hidden>')]}

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Which bzr-svn / bzr version ?

--
Jelmer Vernooij <email address hidden> - http://samba.org/~jelmer/
Jabber: <email address hidden>

Revision history for this message
Wouter van Heyst (larstiq) wrote :

Sorry, bzr.dev and lp:bzr-svn at <email address hidden> and <email address hidden>

Jelmer Vernooij (jelmer)
Changed in bzr-svn:
assignee: nobody → jelmer
importance: Undecided → Medium
milestone: none → 0.5.3
status: New → Triaged
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This is a bug in reconcile dealing with text revisions that originate in ghost revisions. The attached patch fixes this.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This is triggered by the fact that bzr-svn uses VersionedFiles.add_lines() while in fact it should be using VersionedFiles.add_lines_with_ghosts(), since the left hand side parent may be missing (if merged in from a ghost). Bazaar is using that (missing) lhs text as delta parent and errors out when trying to retrieve it. As a workaround, you can just specify None for the text parents in add_lines(), and that will fix this bug but will also break storage of the text revision graph.

Bazaar needs to add VersionedFiles.add_lines_with_ghosts() and bzr-svn needs to start using it.

Jelmer Vernooij (jelmer)
Changed in bzr:
importance: Undecided → Medium
status: New → Triaged
Changed in bzr-svn:
importance: Medium → High
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

From what I can tell VersionedFiles.add_lines() should already allow ghosts, so closing the bzr-svn specific part of this bug.

Changed in bzr:
importance: Medium → High
Changed in bzr-svn:
status: Triaged → Invalid
Revision history for this message
Ted Gould (ted) wrote :

So, can we milestone this bug on Bazaar then? Like I mentioned on the dup'd bug, this is severly effecting my work flow and making it so that Inkscape nightlies haven't been built for a month or so. Much less than nightly. :)

Revision history for this message
Peter Bienstman (peter-bienstman) wrote :

I'd like to second Ted's request. At the moment, bzr is almost unusable for the development of Mnemosyne, because of this bug.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

I'm afraid I don't know enough about the VersionedFiles internals to fix this bug. Hopefully one of the other Bazaar developers can fix this.

Revision history for this message
Robert Collins (lifeless) wrote :

VFS.add_lines supports ghosts always; bzr can't generate a delta if the LHS parent for a text isn't available.

Revision history for this message
Wouter van Heyst (larstiq) wrote :

On Fri, Mar 13, 2009 at 02:04:24AM -0000, Robert Collins wrote:
> VFS.add_lines supports ghosts always; bzr can't generate a delta if the
> LHS parent for a text isn't available.

Sooo, what's going on here then?

Wouter van Heyst

Revision history for this message
Robert Collins (lifeless) wrote :

I don't know :P. I suggest running with BZR_PDB and investigating :)

Jelmer Vernooij (jelmer)
Changed in bzr-svn:
importance: High → Undecided
assignee: jelmer → nobody
milestone: 0.5.3 → none
Revision history for this message
Ted Gould (ted) wrote :

Here's where I am, I've got people suggesting using Bazaar for Summer of Code. Is there any chance that it'll be usable by then?

http://www.nabble.com/Inkscape-DVCS---was%3A-Re%3A-GSoC-2009---Project-handling-in-the-repository-to22618014.html#a22817431

I believe that you can see a messed up repository by doing:

  bzr branch lp:~ted-gould/inkscape/trunk

Revision history for this message
Robert Collins (lifeless) wrote :

On Wed, 2009-04-01 at 03:05 +0000, Ted Gould wrote:
> Here's where I am, I've got people suggesting using Bazaar for Summer of
> Code. Is there any chance that it'll be usable by then?

AFAIK I'm still waiting on a tarball of a problem repo to examine; I
thought jelmer was changing bzr-svn to use different interfaces which
could alter the behaviour of an import here too.

I agree that this is a pretty serious issue.

-Rob

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

No, as I've mentioned on IRC specifying only the parents that are
present raises an exception when the text is added again later *with*
all the parents.

Cheers,

Jelmer

Revision history for this message
Ted Gould (ted) wrote :

On Wed, 2009-04-01 at 03:22 +0000, Robert Collins wrote:
> AFAIK I'm still waiting on a tarball of a problem repo to examine;

I can upload it, but it's 185M. Does pulling it from
lp:~ted-gould/inkscape/trunk not work?

Revision history for this message
Ted Gould (ted) wrote :

On Wed, 2009-04-01 at 03:22 +0000, Robert Collins wrote:
> AFAIK I'm still waiting on a tarball of a problem repo to examine; I
> thought jelmer was changing bzr-svn to use different interfaces which
> could alter the behaviour of an import here too.

 http://people.ubuntu.com/~ted/inkscapetrunk.tar.gz

Revision history for this message
Ted Gould (ted) wrote :

I think that this bug has all the information it needs. Could someone confirm that and perhaps talk about what the blockers are? It would be nice to get it fixed as it seems to be blocking a few projects from using Bazaar.

Revision history for this message
Ted Gould (ted) wrote :

/me waves

I'm really running out of constructive things to say as comments on this bug...

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Sorry this is taking so long. I just don't have the knowledge to deal with the pack internals. I hope to spend some time during the sprint (same time as UDS) to fix this together with somebody who does.

Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2009-05-12 at 16:00 +0000, Jelmer Vernooij wrote:
> Sorry this is taking so long. I just don't have the knowledge to deal
> with the pack internals. I hope to spend some time during the sprint
> (same time as UDS) to fix this together with somebody who does.

Great! I will be at UDS, so if there is any information or testing I
can provide please grab me! Thanks!

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This is related to bug 373726

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

The reconcile bit of this bug is still open, but the other issues have been fixed in one of the recent versions of Bazaar.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

I've submitted a fix for this to the list.

Changed in bzr:
assignee: nobody → Jelmer Vernooij (jelmer)
status: Triaged → Fix Committed
Revision history for this message
Wouter van Heyst (larstiq) wrote :

This is now fixed for me on the original branch I reported. Reverting bzr.dev to r4403, KeyError. r4404, succes!

Cheers to everyone who worked on it. (Jelmer, I'm going to buy you a beer or equivalent this evening)

Jonathan Lange (jml)
Changed in bzr:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.