Upgrade can leave a broken repository (with backup)

Bug #145812 reported by James Westby
4
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned

Bug Description

I just had the following sequence:

Using saved location: http://people.samba.org/bzr/jelmer/bzr-rebase/trunk/
bzr: ERROR: Tags not supported by BzrBranch5('file:///home/jw2328/.bazaar/plugins/rebase/'); you may be able to use bzr upgrade --dirstate-tags.

"Hmm, isn't --dirstate-tags default now?"

jw2328@twitch:plugins/rebase:1017:3% bzr upgrade
starting upgrade of file:///home/jw2328/.bazaar/plugins/rebase/
making backup of tree history
file:///home/jw2328/.bazaar/plugins/rebase/.bzr has been backed up to file:///home/jw2328/.bazaar/plugins/rebase/.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: Cannot convert to format <RepositoryFormatKnit1>. Does not support rich root data.

"Ok, that's not good, let's try --dirstate-tags explictly"

jw2328@twitch:plugins/rebase:1018:3% bzr upgrade --dirstate-tags
bzr: ERROR: No repository present: "file:///home/jw2328/.bazaar/plugins/rebase/"

jw2328@twitch:plugins/rebase:1026:3% ls .bzr/
total 48
drwxr-xr-x 3 jw2328 jw2328 4096 2007-09-27 21:58 branch
-rw-r--r-- 1 jw2328 jw2328 35 2007-07-12 18:12 branch-format
drwxr-xr-x 2 jw2328 jw2328 4096 2007-07-12 18:12 branch-lock
drwxr-xr-x 3 jw2328 jw2328 4096 2007-07-12 18:31 checkout
-rw-r--r-- 1 jw2328 jw2328 82 2007-07-12 18:12 README
drwxr-xr-x 5 jw2328 jw2328 4096 2007-07-12 18:12 repository.backup

"Ah, repository backed up, but not there"

Now the upgrade failed and no commands work. Surely a failure to upgrade due to the
type should notice before removing the repository.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 145812] Upgrade can leave a broken repository (with backup)

 status triaged
 importance low

The code path upgrade uses in this case is:
'backup'
'create a new repository in the requested format'
'perform a fetch'

The problem is that the api that is failing currently has to be called
to fail.

-Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Changed in bzr:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Chandler Carruth (chandlerc) wrote :

I just did an upgrade which left my repository in a wonderfully messed up state.

Thinking (incorrectly) I knew how to repair this, I copied backup.bzr to .bzr immediately, and expected to continue on my merry way. I was quite mistaken. My repository remained broken, and I thought I had potentially erased or permanently lost the entire repository of history. spiv from IRC helped me to recover by simply *also* moving "repository.backup" to "repository" *within* the ".bzr" (what was my backup.bzr) directory. This is highly unintuitive and confusing, but much worse, it's not mentioned anywhere, leaving me to potentially ruin my repository without knowing it could still be salvaged.

I'm all for fixing the upgrade breakage, but could the error information provide detaild and safe steps to fix the repository as well? That would be very helpful.

-Chandler

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Why provide the information? If bzr knows what to do to undo the breakage, it should do that itself. It shouldn't be that hard to automate

  mv .bzr failed-upgrade.bzr
  mv backup.bzr .bzr

Leaving a broken repository lying around is rather unfriendly.

Revision history for this message
Martin Pool (mbp) wrote :

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

  tags upgrade
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAklv4fYACgkQPGPKP6Cz6IswYwCfXl/htpqA4AnuNAhUjuolGoPt
yeAAn22gJhOX2/W4P6X2iDsVe0JILi28
=i8k3
-----END PGP SIGNATURE-----

Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
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.