upgrading to rich-root-pack fails

Bug #177874 reported by Lukáš Lalinský
52
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Critical
Aaron Bentley

Bug Description

Trying to upgrade bzr.dev to rich-root-pack fails with:

$ bzr upgrade --rich-root-pack
starting upgrade of file:///tmp/bzr.dev/
making backup of tree history
file:///tmp/bzr.dev/.bzr has been backed up to file:///tmp/bzr.dev/.bzr.backup
if conversion fails, you can move this directory back to .bzr
if it succeeds, you can remove this directory if you wish
starting repository conversion
bzr: ERROR: Revision {('<email address hidden>',)} not present in "<bzrlib.knit.KnitGraphIndex object at 0x85e136c>".

Traceback from ~/.bzr.log:

Traceback (most recent call last):
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/commands.py", line 802, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/commands.py", line 758, in run_bzr
    ret = run(*run_argv)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/builtins.py", line 2432, in run
    upgrade(url, format)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/upgrade.py", line 80, in upgrade
    Convert(url, format)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/upgrade.py", line 38, in __init__
    self.convert()
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/upgrade.py", line 66, in convert
    self.bzrdir = converter.convert(self.bzrdir, self.pb)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/bzrdir.py", line 2237, in convert
    converter.convert(repo, pb)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/repository.py", line 2858, in convert
    self.source_repo.copy_content_into(converted)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/repository.py", line 831, in copy_content_into
    return InterRepository.get(self, destination).copy_content(revision_id)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/repository.py", line 2662, in copy_content
    self.target.fetch(self.source, revision_id=revision_id)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/repository.py", line 873, in fetch
    return inter.fetch(revision_id=revision_id, pb=pb, find_ghosts=find_ghosts)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/decorators.py", line 165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/repository.py", line 2641, in fetch
    pb=pb)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/fetch.py", line 379, in __init__
    last_revision, pb)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/fetch.py", line 103, in __init__
    self.__fetch()
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/fetch.py", line 132, in __fetch
    self._fetch_everything_for_revisions(revs, pp)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/fetch.py", line 166, in _fetch_everything_for_revisions
    self._generate_root_texts(revs)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/fetch.py", line 382, in _generate_root_texts
    self.helper.generate_root_texts(revs)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/fetch.py", line 356, in generate_root_texts
    revision_id, parents, [], parent_texts)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/versionedfile.py", line 122, in add_lines
    left_matching_blocks, nostore_sha, random_id, check_content)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/knit.py", line 924, in _add_lines
    self._check_versions_present(parents)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/knit.py", line 911, in _check_versions_present
    self._index.check_versions_present(version_ids)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/knit.py", line 1809, in check_versions_present
    raise RevisionNotPresent(missing.pop(), self)
RevisionNotPresent: Revision {('<email address hidden>',)} not present in "<bzrlib.knit.KnitGraphIndex object at 0x85e136c>".

Revision history for this message
Lukáš Lalinský (luks) wrote :

Here is the problem:

Most of inventories in bzr.dev have root IDs "TREE_ROOT", but a branch starting from "<email address hidden>" has inventories with root ID "tree_root-20070410133226-3795pjcs6oz73ncz-1". This branch was merged to bzr.dev without a common ancestry in revision "<email address hidden>". But that means that one parent of "<email address hidden>" points to the versioned file "%54%52%45%45_%52%4f%4f%54", the other one to "tree_root-20070410133226-3795pjcs6oz73ncz-1".

I'm not sure what is the right solution here: either can be repositories that don't support rich roots normalized to ROOT_ID, or can be parents of "<email address hidden>" added as ghosts, but I think this will break other things. What I'm wondering about is how this could happen, though. I see that WorkingTree4 generates a new root ID only for repositories that do support rich roots.

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 177874] Re: upgrading to rich-root-pack fails

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lukáš Lalinský wrote:
> Here is the problem:
>
> Most of inventories in bzr.dev have root IDs "TREE_ROOT", but a branch
> starting from
> "<email address hidden>" has
> inventories with root ID "tree_root-20070410133226-3795pjcs6oz73ncz-1".
> This branch was merged to bzr.dev without a common ancestry in revision
> "<email address hidden>". But that
> means that one parent of
> "<email address hidden>" points to
> the versioned file "%54%52%45%45_%52%4f%4f%54", the other one to
> "tree_root-20070410133226-3795pjcs6oz73ncz-1".
>
> I'm not sure what is the right solution here: either can be repositories
> that don't support rich roots normalized to ROOT_ID, or can be parents
> of "<email address hidden>" added as
> ghosts, but I think this will break other things. What I'm wondering
> about is how this could happen, though. I see that WorkingTree4
> generates a new root ID only for repositories that do support rich
> roots.
>

I believe there was some time that we generated unique ids for new projects. It
turned out to not be supported well by older clients, so we reverted that
change. But that doesn't mean people dogfooding on bzr.dev didn't happen to
create a branch or two that runs into this.

%54%52%45%45_%52%4f%4f%54 == TREE_ROOT

I think that:

 if root_id == ROOT_ID or root_id.startswith('tree_root'):
   # Ignore if there is a missing versioned file

It is a bit hackish, but it is working around a very unlikely case.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHa9ghJdeBCYSNAAMRAk+VAJ9msI2+RXHtqUF5bdtn2M652S0VSwCdHmlG
J6SkePCpKZDCgWCIdIV1ReM=
=mWrU
-----END PGP SIGNATURE-----

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Changed in bzr:
importance: Medium → Critical
Revision history for this message
Aaron Bentley (abentley) wrote :

As far as I can tell, the issue was unrelated to the name of the tree-root. TREE_ROOT or ROOT_ID is not hardcoded anywhere. Instead, this appears to be a problem of failing to insert inventories in topological order.

Revision history for this message
Aaron Bentley (abentley) wrote :

Ah, the issue is that the tree root isn't a single value in the ancestry of the tree. It doesn't matter if it's initially set to TREE_ROOT or ghasflkj, but one revision has an ancestor with a different tree-root id, it tries and fails to retrieve it (because it's doing add_lines, not add_lines_with_ghosts).

Aaron Bentley (abentley)
Changed in bzr:
assignee: nobody → abentley
status: Confirmed → Fix Committed
Aaron Bentley (abentley)
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.