Author: stsp
Date: Fri Nov 27 11:58:41 2009
New Revision: 884842

URL: http://svn.apache.org/viewvc?rev=884842&view=rev
Log:
Fix a bug in svnsync causing stale sync-locks on mirror repositories.

* subversion/svnsync/main.c
  (get_lock): The lock attempt is done in iteration N, and success is
   checked in iteration N+1. Prevent the case where svnsync attempts
   to take the lock in the very last iteration, doesn't check for
   success, and ends up erroring out, leaving behind a stale lock.

Found by: Jon Foster <[email protected]>
Based on patch by: philip

Modified:
    subversion/trunk/subversion/svnsync/main.c

Modified: subversion/trunk/subversion/svnsync/main.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnsync/main.c?rev=884842&r1=884841&r2=884842&view=diff
==============================================================================
--- subversion/trunk/subversion/svnsync/main.c (original)
+++ subversion/trunk/subversion/svnsync/main.c Fri Nov 27 11:58:41 2009
@@ -276,7 +276,8 @@
 
   subpool = svn_pool_create(pool);
 
-  for (i = 0; i < 10; ++i)
+#define SVNSYNC_LOCK_RETRIES 10
+  for (i = 0; i < SVNSYNC_LOCK_RETRIES; ++i)
     {
       svn_pool_clear(subpool);
       SVN_ERR(check_cancel(NULL));
@@ -299,8 +300,9 @@
               apr_sleep(apr_time_from_sec(1));
             }
         }
-      else
+      else if (i < SVNSYNC_LOCK_RETRIES - 1)
         {
+          /* Except in the very last iteration, try to set the lock. */
           SVN_ERR(svn_ra_change_rev_prop(session, 0, SVNSYNC_PROP_LOCK,
                                          mylocktoken, subpool));
         }


Reply via email to