Corrupt repository? How to fix?

Robert Collins robertc at robertcollins.net
Wed Jun 9 01:33:01 BST 2010


Hi, it does look like your machine has either:
 - crashed with some pending disk operations completed, out-of-order
 - suffered bitrot of some kind

Firstly, to exclude bzr directly-associated bugs, please do 'md5sum
.bzr/repository/packs/*' which should show something like this:
md5sum .bzr/repository/packs/*
2c7f2301af2a03a1c3dbe2cc53961d78
.bzr/repository/packs/2c7f2301af2a03a1c3dbe2cc53961d78.pack
2fc2a401beb2fd09d041842e3c27ebb7
.bzr/repository/packs/2fc2a401beb2fd09d041842e3c27ebb7.pack
55820034925b36a9045f64caff54dc46
.bzr/repository/packs/55820034925b36a9045f64caff54dc46.pack
670df7a9ab203c3aa6de56cc46296257
.bzr/repository/packs/670df7a9ab203c3aa6de56cc46296257.pack
784f11bb2ef85268d8e9517529d7d3ef
.bzr/repository/packs/784f11bb2ef85268d8e9517529d7d3ef.pack
8732de76dfd1c6448ab66c10c4e515b3
.bzr/repository/packs/8732de76dfd1c6448ab66c10c4e515b3.pack
8d662d2799994561d65b41c99519e702
.bzr/repository/packs/8d662d2799994561d65b41c99519e702.pack
9b432c6d08c1fc6aa6a507e59c158c22
.bzr/repository/packs/9b432c6d08c1fc6aa6a507e59c158c22.pack
a005670caef561488f13b5c21e2426c8
.bzr/repository/packs/a005670caef561488f13b5c21e2426c8.pack
a749ffa1bc01d034b8cc63899296a094
.bzr/repository/packs/a749ffa1bc01d034b8cc63899296a094.pack
be312ba2fb80d2df0049e44c6ff37957
.bzr/repository/packs/be312ba2fb80d2df0049e44c6ff37957.pack
c22f22906e52472341bb39ff913ea85d
.bzr/repository/packs/c22f22906e52472341bb39ff913ea85d.pack
ed9456f513c825624f09575510d90960
.bzr/repository/packs/ed9456f513c825624f09575510d90960.pack

Note that the hash and the filenames should match: if they don't, you
have different data on disk than bzr thought it wrote.

If they do match completely, then we either have:
 - corrupt index, telling us to read the wrong things
 - a bzr bug causing us to write garbage

If they don't match, and you haven't had your machine freeze up just
after doing something in bzr, then you've had serious disk/fs issues
occur, and you should fsck etc and restore from backup.

If they don't match, and you've had your machine freeze up just after
doing something in bzr, then its an out-of-order write biting us, and
thats something that ultimately means you still need to restore from
backup (or pull from other mirrors), but its something that we can
perhaps prevent by fsync/fsyncdiring more, though that has a very
significant performance cost (which is why most? all? vcs's don't do
it, at least by default). (And it's not always enough, see Mac OSX for
instance, where fsync means 'queued to the drive', not 'landed on
disk'.

-Rob



More information about the bazaar mailing list