Hi All,

This patch adds a test case to subversion/tests/cmdline/dav-mirror-autocheck.sh to showcase the following bug.

In a master/slave repositories setup where writes are proxied to the master and reads are handles by the slave repository, if the slave repository is behind the master by one or more revisions, certain operations that one would expect to succeed are failing.


Example:

$svn cp -m "Create branch" ^/trunk ^/branches/newbranch (from a working copy of the slave)

will FAIL if the master has an unsynced commit (not yet synced with slave) anywhere below ^/branches.

i.e Coder 1 does a commit to branches/some-other-branch (master has received the commit, slave hasn't yet synced)
    Coder 2 tries to create a new branch via above command. It fails.

I'll shortly file an issue in the tigris tracker for this.

Regards,
Arwin Arni
Index: subversion/tests/cmdline/dav-mirror-autocheck.sh
===================================================================
--- subversion/tests/cmdline/dav-mirror-autocheck.sh    (revision 1094226)
+++ subversion/tests/cmdline/dav-mirror-autocheck.sh    (working copy)
@@ -455,6 +455,43 @@
   url-encodings happening in server side"
 fi
 
+# Test case for out-dated slave commit
+say "Test case for out-dated slave commit"
+
+svn="$SVN --non-interactive --username=jrandom --password=rayjandom"
+# Make a working copy of the slave.
+$svn checkout $SLAVE_URL $HTTPD_ROOT/wc
+cd $HTTPD_ROOT/wc
+# Add a new file named newfile and commit it.
+touch branch/newfile
+$svn add branch/newfile
+$svn commit -mm
+
+say "De-activating post-commit hook on $MASTER_REPOS to make $SLAVE_REPOS go 
out of sync"
+mv "$MASTER_REPOS/hooks/post-commit" "$MASTER_REPOS/hooks/post-commit_"
+
+echo "Change made to file in branch" > $HTTPD_ROOT/wc/branch/newfile
+$svn ci -m "Commit from slave"
+
+MASTER_HEAD=`$SVNLOOK youngest "$MASTER_REPOS"`
+SLAVE_HEAD=`$SVNLOOK youngest "$SLAVE_REPOS"`
+say "Now the slave is at r$SLAVE_HEAD and master is at r$MASTER_HEAD."
+
+# Now any other commit operation will fail with an out-of-date error
+
+$svn cp -m "Creating a branch" ^/trunk ^/branch/newbranch --config-option 
"servers:global:http-library=neon"
+RETVAL=$?
+
+if [ $RETVAL -eq 0 ]; then
+  say "PASS: Commits succeed even with an out-of-date slave"
+else
+  say "FAIL: Commits fail with an out-of-date slave"
+fi
+say "Some house-keeping..."
+say "Re-activating the post-commit hook on the master repo: $MASTER_REPOS."
+mv "$MASTER_REPOS/hooks/post-commit_" "$MASTER_REPOS/hooks/post-commit"
+say "Syncing slave with master."
+$SVNSYNC --non-interactive sync "$SYNC_URL" --username=svnsync 
--password=svnsync 
 # shut it down
 echo -n "${SCRIPT}: stopping httpd: "
 $HTTPD -f $HTTPD_CONFIG -k stop
* subversion/tests/cmdline/dav-mirror-autocheck.sh:
  Add a test-case to showcase an out-of-date slave related bug

Patch by: Arwin Arni <arwin{_AT_}collab.net>

Reply via email to