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

Re: [libsvn_fs_fs] 'Directory not empty' error when removing committed txn

From: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2004-05-09 04:23:41 CEST

Garrett Rooney wrote:

> So I've been playing around with libsvn_fs_fs a bit, and I'm seeing some
> odd errors when committing large numbers of changes (importing the
> subversion tree into a clean repository seems to be a good way to cause
> it). Specifically, it's failing to remove the transaction directory
> once the commit has completed.
>
> The commit succeeds just fine, but it dies with an error like this when
> removing the transaction:
>
> subversion/libsvn_subr/io.c:1154: (apr_err=66)
> svn: Can't remove '/tmp/repos/db/transactions/FTdTod.txn': Directory not
> empty
>
> I don't have time to investigate further at the moment, but I figured
> I'd let people know...

Ok, I've had some time to play with this, and here's what I've figured
out so far.

1) putting a 'if err == enotempty then retry' loop in
svn_fs_fs__purge_txn seems to 'fix' the problem, removing the
transaction directory succeeds after failing 6 times in a row.

2) commits involving less nodes in the filesystem (and thus less files
in the transaction directory) do not seem to have this problem.

I'm totally confused as to what could cause this kind of behavior, but
in case anyone's interested here's my current patch to work around it. I
don't intend to commit this unless someone either explains to me what
the underlying cause is or says they're seeing the same thing and votes
in favor of this kind of work around.

-garrett

Index: subversion/libsvn_fs_fs/fs_fs.c
===================================================================
--- subversion/libsvn_fs_fs/fs_fs.c (revision 9656)
+++ subversion/libsvn_fs_fs/fs_fs.c (working copy)
@@ -2461,23 +2461,32 @@
 {
   const char *txn_dir;
   svn_error_t *err;
+ int retries;
   
   txn_dir = svn_path_join_many (pool, fs->path, SVN_FS_FS__TXNS_DIR,
                                 apr_pstrcat (pool, txn_id,
                                              SVN_FS_FS__TXNS_EXT, NULL), NULL);
 
- /* Umm, we really have no way to determine the difference between a
- transaction not existing, and a transaction not being mutable.
- We'll just always return not-mutable and hope no one passes us
- bogus transaction IDs. */
- err = svn_io_remove_dir (txn_dir, pool);
+ /* For some reason this remove dir doesn't seem to succeed the first few
+ times on Mac OS X if there are a large number of files in the transaction
+ directory. Let's give it a few attempts before we totally give up. */
+ for ( retries = 0;
+ err && APR_STATUS_IS_ENOTEMPTY (err->apr_err) && retries < 20;
+ ++retries )
+ {
+ /* Umm, we really have no way to determine the difference between a
+ transaction not existing, and a transaction not being mutable.
+ We'll just always return not-mutable and hope no one passes us
+ bogus transaction IDs. */
+ err = svn_io_remove_dir (txn_dir, pool);
 
- if (err && APR_STATUS_IS_ENOENT (err->apr_err))
- {
- svn_error_clear (err);
- return svn_fs_fs__err_txn_not_mutable (fs, txn_id);
+ if (err && APR_STATUS_IS_ENOENT (err->apr_err))
+ {
+ svn_error_clear (err);
+ return svn_fs_fs__err_txn_not_mutable (fs, txn_id);
+ }
     }
-
+
   return err;
 }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun May 9 04:23:58 2004

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.