Catching dangling transactions
From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-10-12 01:47:27 CEST
Occasionally I discover transactions hanging around in my private repository, and wonder how they got there. In a suitably controlled environment, it would be nice if the Subversion command-line client would check, after completing its task, that no transactions are left hanging around in the database. I suppose one of the main causes is the client exiting unexpectedly, so only a wrapper could really do this. And of course it would only work for a local repository, and only if it can know which repository is being accessed. And only when there is no concurrent access. Etc.
The script below does the job crudely. It is a wrapper for "svn", and prints a message afterwards if there are dangling transactions in any local repositories that it thinks might have been accessed. Here it shows that a second attempt at an obstructed update leaves a dangling transaction:
~/tmp/svn-sandbox> svn up
~/tmp/svn-sandbox> svn up -r33
~/tmp/svn-sandbox> svn up -r33
I don't know if there is a better way of detecting these bugs; this is certainly inelegant. It could be much cleaner and more accurate if Subversion itself somehow told it which repository had been accessed, but already it it very interesting to me.
- Julian
~/bin/svn:
SVN=~/build/subversion/subversion/clients/cmdline/svn
# If it was a non-repository-contacting subcommand, don't check further.
# We don't know which repositories were accessed, so guess from any WC args:
# Find any local (file://) repositories connected to those WCDIRS.
for REPOS in $REPOSITORIES; do
if [ "$TXNS" ]; then
---------------------------------------------------------------------
|
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.