subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1150302 - /subversion/trunk/subversion/libsvn_repos/commit.c
Date Sun, 24 Jul 2011 08:51:37 GMT
Author: rhuijben
Date: Sun Jul 24 08:51:36 2011
New Revision: 1150302

URL: http://svn.apache.org/viewvc?rev=1150302&view=rev
Log:
Don't abort an fs transaction twice when committing the fs transaction fails.
The second time will only try to delete data which is already gone.

This fixes the error in commit_tests.py 54: pre-commit hook failure case
testing, that was uncovered by recent error handling changes.

* subversion/libsvn_repos/commit.c
  (edit_baton): Add boolean.
  (close_edit): Remember that we already aborted.
  (abort_edit): Only abort the txn if necessary and remember that we aborted.

Modified:
    subversion/trunk/subversion/libsvn_repos/commit.c

Modified: subversion/trunk/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/commit.c?rev=1150302&r1=1150301&r2=1150302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/commit.c (original)
+++ subversion/trunk/subversion/libsvn_repos/commit.c Sun Jul 24 08:51:36 2011
@@ -94,6 +94,9 @@ struct edit_baton
   /* The object representing the root directory of the svn txn. */
   svn_fs_root_t *txn_root;
 
+  /* Avoid aborting an fs transaction more than once */
+  svn_boolean_t txn_aborted;
+
   /** Filled in when the edit is closed: **/
 
   /* The new revision created by this commit. */
@@ -720,6 +723,8 @@ close_edit(void *edit_baton,
          aborted completely.  No second chances;  the user simply
          needs to update and commit again  :) */
 
+      eb->txn_aborted = TRUE;
+
       return svn_error_trace(
                 svn_error_compose_create(err,
                                          svn_fs_abort_txn(eb->txn, pool)));
@@ -768,9 +773,12 @@ abort_edit(void *edit_baton,
            apr_pool_t *pool)
 {
   struct edit_baton *eb = edit_baton;
-  if ((! eb->txn) || (! eb->txn_owner))
+  if ((! eb->txn) || (! eb->txn_owner) || eb->txn_aborted)
     return SVN_NO_ERROR;
-  return svn_fs_abort_txn(eb->txn, pool);
+
+  eb->txn_aborted = TRUE;
+
+  return svn_error_trace(svn_fs_abort_txn(eb->txn, pool));
 }
 
 



Mime
View raw message