Fixing subversion corruption - Berkeley DB
From: Nicholas Walker <NWalker_at_dialogue-marketing.com>
Date: Thu, 9 Apr 2009 10:30:27 -0400
I went through a week of trying to resolve various issues with an old
These steps will not work for an fsfs repository.
I put together a process for how I resolved my issues. I hope it helps
Note: This process does not solve corruption, it just puts the
You'll need to use the Berkeley db utilities that match the version of
1) Copy repository to a temporary location.
a. You can use svnadmin hotcopy REPOS_PATH NEW_REPOS_PATH
2) Resolve pure database corruption
a. This resolves error similar to DB_PAGE_NOT_FOUND error.
b. There are files in [repository Path]/db
i.
ii.
iii.
iv.
v.
vi.
vii.
viii. uuids
c. Each of these represent a database table
d. Run /usr/local/bin/db42/db_dump -r [File] > [File].dump against
i.
ii.
iii. If
e. Run rm [File] for each of the files.
i.
f. Run /usr/local/bin/db42/db_load [File] < [File].dump for each
3) Since the process takes a long time, you may want to make a
4) Resolve repository corruption
a. These errors occur when a transaction for example references a
b. Start a dump of the database
c. If no errors occur during the dump, you are done, and have
d. When you experience an error, you'll have to manually update the
e. Here are steps for several types of errors that I came across.
i.
1. Error along the lines of checksum mismatch on rep "[rep]"
2. There is some reason why the checksum failed because some kind
3. Run /usr/local/bin/db42/db_dump -kp representations >
4. The -kp option dumps the file into a ascii format, so you can
5. Open representations.dump in a text file
6. Search for the representation id. What is in [rep] in the
7. You will see lines like the below
a. 11ti
b. ((fulltext 1 1 (md5 16 \e3\035\f0\19\c5V\07}\92h\ab\80\aam\02))
8. You want to find the line where the rep id matches on the
9. You may find the rep id in other lines within the file, you
10. Change the section md5 16 \e3\035\f0\19\c5V\07}\92h\ab\80\aam\02
11. Run rm representations
12. Run /usr/local/bin/db42/db_load representations <
13. Re-run the dump to verify your changes corrected the problem.
14. Note that the revision that failed is the last revision noted in
15. Continue with the dump until another error occurs
ii.
1. Note the rep id.
2. Run /usr/local/bin/db42/db_dump -kp representations >
3. The -kp option dumps the file into a ascii format, so you can
4. Open representations.dump in a text file
5. Near the top of the file find a representation that is
6. Copy the line of text
7. Insert a representation into the text file that looks like the
8. Run rm representations
9. Run /usr/local/bin/db42/db_load representations <
10. Re-run the dump to verify your changes corrected the problem.
11. Continue with the dump until another error occurs
iii.
1. This one is a pain. A corrupted string may cause any depending
2. Open representations.dump in a text file
3. Search for the string id in the text file.
4. You will find the string in the second line / the data text
5. You should find the string in the last few characters in the
6. ((fulltext 3 2bn (md5 16
7. Copy the data line from one of the first few lines of the file
8. Run rm representations
9. Run /usr/local/bin/db42/db_load representations <
10. Re-run the dump to verify your changes corrected the problem.
11. Continue with the dump until another error occurs
iv.
1. This is an error that results from the fix in the step above
2. Follow the same steps as in the above step to resolve this
3. A difference is you will be looking for rep id now instead of
4. The data line will surely be one that is a delta
v.
1. Part of the dump file will have been generated. Open the dump
a. The last file noted is the file that we want to note.
2. Only way I could find to resolve this is to remove all
a. If you found the exact revision instances that was corrupted,
3. Run /usr/local/bin/db42/db_dump -kp changes > changes.dump
4. The -kp option dumps the file into an ascii format, so you can
5. Open changes.dump in a text file
6. Search for all instances of the file name, and remove them.
7. Run rm changes
8. Run /usr/local/bin/db42/db_load changes < changes.dump
9. Re-run the dump to verify your changes corrected the problem.
10. Continue with the dump until another error occurs
vi.
1. Follow the same steps as in "v" above
5) Run the entire dump, and restore it to a new repository
6) Restore any files that had to be removed during the process of
a. You will lose the history associated with the file that had to
b. Do a svn checkout of both the old, and new repositories, and do
7) Run svnadmin verify on a regular basis, and identify the issues
------------------------------------------------------
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
|
This is an archived mail posted to the Subversion Users mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.