SvnAdmin: Complete Guide to Managing Subversion Repositories

Troubleshooting SvnAdmin: Fix Common Subversion Issues Fast

1. Verify repository health

  • Run: svnadmin verify /path/to/repo
  • If it reports errors: note the revision numbers and error messages.

2. Repair corrupted revisions

  • Attempt recovery by dumping good revisions:
    1. Create a dump of the last good revision range:
      bash
      svnadmin dump /path/to/repo -r 0:GOOD_REV > repo-good.dump
    2. Create a new repository and load the dump:
      bash
      svnadmin create /path/to/newreposvnadmin load /path/to/newrepo < repo-good.dump
  • If only a few revisions are corrupted, skip them by dumping ranges before and after the bad revisions and loading both into a new repo.

3. Fix filesystem permission issues

  • Symptoms: errors opening repository, E175002, permission denied.
  • Fix: ensure repository owner and group match the server process (e.g., www-data or svn) and set permissions:
    bash
    chown -R svnuser:svngroup /path/to/repofind /path/to/repo -type d -exec chmod 2775 {} ;find /path/to/repo -type f -exec chmod 664 {} ;
  • Ensure umask for repository-accessing processes allows group writes.

4. Resolve locking problems

  • Symptom: operations hang or report locked working copies.
  • Client-side: run svn cleanup in the working copy.
  • Server-side repository locks: use svnadmin lslocks and svnadmin rmlocks (if using repository-level lock management), or manually remove lock files in db/locks only as a last resort after backing up the repo.

5. Recover from transaction failures

  • When a transaction fails (txn-), list transactions:
    bash
    svnadmin lstxns /path/to/repo
  • To commit a good transaction:
    bash
    svnadmin resolve /path/to/repo –transaction TXN_ID –accept work

    (Note: svnadmin subcommands vary by Subversion version; consult svnadmin help.)

6. Handle low disk space or quota errors

  • Symptoms: IO errors, aborted commits.
  • Fix: free space or increase quotas, then run:
    bash
    svnadmin recover /path/to/repo
  • After recovery, run svnadmin verify to confirm integrity.

7. Fix repository UUID or format mismatches

  • Symptoms: clients reject repository or migrations fail.
  • Check format and UUID in db/format and db/uuid. To set UUID:
    bash
    svnadmin setuuid /path/to/repo NEW-UUID

8. Troubleshoot auth and hook script failures

  • Check server logs (Apache, svnserve) for permission/auth errors.
  • Hook scripts: ensure executable bit set and environment variables defined; test scripts manually as the repository user. Add logging to hooks to capture runtime errors.

9. Performance issues

  • Common causes: large db/revs or db/transactions, no hot copy backups, inefficient hooks.
  • Mitigations: enable FSFS packing (svnadmin pack), schedule regular svnadmin dump+reload maintenance for very old repositories, optimize hooks, and upgrade Subversion if on an old version.

10. Backup and disaster recovery best practices

  • Regularly run svnadmin hotcopy /path/to/repo /path/to/backup (hotcopy preserves a live repo).
  • Keep offsite copies of dumps: svnadmin dump –incremental.
  • Test restores periodically by loading dumps into a new repo.

Quick checklist (action order)

  1. Run svnadmin verify.
  2. Check disk space and permissions.
  3. Run svnadmin recover if needed.
  4. Use dumps to reconstruct repo excluding corrupted revisions.
  5. Inspect hooks and server logs.
  6. Restore from hotcopy or dump if repair fails.

If you want, I can tailor recovery commands for your Subversion version and repository path—provide the server OS and Subversion version.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *