views:

1401

answers:

8

A few times already, I got into situations where one of my SVN repository got corrupt and we could do anything with some versions or branches of the project without really knowing what we did. So I'm asking what can cause a repository to become corrupt?

+1  A: 

Potential filesystem corruption or someone mucking around with the internal svn directories?

grepsedawk
A: 

I've had it happen a few times. SVN doesn't seem to cope well if the client goes away while the server is taking a long time to do certain things. I don't know the exact details, but I have done a few kill -9s on what I thought were read-only processes and ended up having to run a svnadmin cleanup afterwards before the server would respond again.

Ant P.
There are no read-only processes in svn; it always creates a transaction, even for updating. See http://svnbook.red-bean.com/en/1.0/ch05.html#svn-ch-5-sect-1.1 for the details.
CesarB
svnadmin doesn't have a cleanup command. svn cleanup is a clientside command. In all cases except file:/// repository access a client crash/hang can never harm the server or the data.. And file:/// access over the network is certainly not recommended practice.
Bert Huijben
@Bert: Whoops, I meant svnadmin recover.
Ant P.
A: 

This is quite common on File based repos, however if you have a single user / service accessing the repo, this will not happen.

PostMan
Could you expand on that please?
Loki
I think I know what you mean. If using something like Windows shares, make sure to only have one user on it.
Loki
+1  A: 

How can a SVN repository become corrupt?

When the power goes to its head.

+1  A: 

There is always the possibility that the hardware is faulty. Things like bit errors in memory can cause silent corruption instead of simply crashing the computer; if a svn server process is the one affected, the repository can become corrupted.

CesarB
A: 

It seems that incompatibilities between clients may cause problems, more specifically with character sets.

Loki
+5  A: 

There are basically three distinct cases:

  1. Faulty hardware (memory, fs corruption, etc.)
  2. User's with login access to the server can corrupt repository files.
  3. Bugs in Subversion.

Faulty hardware is usually the most difficult to spot, except in the most obvious cases. Case 2 is preventable by limiting login access to the server. Everything else is a bug in Subversion. (This includes compatibility issues between client and the server.) You should never be able to corrupt the repository just by using a Subversion client (not even when there is a bug in the client, IMO).

JesperE
A: 

I had a repo corruption that took me a while to figure out. On the server I had accidentally changed the owner of the .svn dir in the repo to some unrelated user. SVN gave me corruption errors after that until I deleted and re-created the repo. Even after I corrected it. smacks forehead

DeviousBlue