[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Happy Trails to you!

From: Glenn A. Thompson <gthompson_at_cdr.net>
Date: 2002-10-16 17:34:57 CEST

Ha, made you look!

happy "trail.c" that is:-)

Below is a change to trail.c that I think is "more" correct than the
current implemention.
While creating an abstracted trail implemention, I noticed that the undo
logic was not completely correct.
I beleive my change is more correct. Given the sparse use of the
"record" functions this change will not yield a fix to any existing
problem. However, it will be more correct for future use.
I can submit a real patch if you like. Otherwise it will be represented
(differently however) in a coming fs-refactoring patch.

Thanks,
gat

Index: trail.c
===================================================================
--- trail.c
+++ trail.c Wed Oct 16 11:14:41 2002
@@ -86,17 +86,18 @@
 {
   struct undo *undo;

+ /* According to the example in the Berkeley DB manual, txn_commit
+ doesn't return DB_LOCK_DEADLOCK --- all deadlocks are reported
+ earlier. */
+ SVN_ERR (DB_WRAP (fs, "committing Berkeley DB transaction",
+ trail->db_txn->commit (trail->db_txn, 0)));
+
   /* Undo those changes which should persist only while the
      transaction is active. */
   for (undo = trail->undo; undo; undo = undo->prev)
     if (undo->when & undo_on_success)
       undo->func (undo->baton);

- /* According to the example in the Berkeley DB manual, txn_commit
- doesn't return DB_LOCK_DEADLOCK --- all deadlocks are reported
- earlier. */
- SVN_ERR (DB_WRAP (fs, "committing Berkeley DB transaction",
- trail->db_txn->commit (trail->db_txn, 0)));

   /* Do a checkpoint here, if enough has gone on.
      The checkpoint parameters below are pretty arbitrary. Perhaps
@@ -128,10 +129,20 @@

       if (! svn_err)
         {
+ svn_error_t *commit_err;
           /* The transaction succeeded! Commit it. */
- SVN_ERR (commit_trail (trail, fs));
-
- return SVN_NO_ERROR;
+ commit_err = commit_trail (trail, fs);
+ if ( commit_err == SVN_NO_ERROR )
+ {
+ return SVN_NO_ERROR;
+ }
+ else
+ {
+ for (undo = trail->undo; undo; undo = undo->prev)
+ if (undo->when & undo_on_failure)
+ undo->func (undo->baton);
+ return commit_err;
+ }
         }

       /* Is this a real error, or do we just need to retry? */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 16 17:31:08 2002

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.