couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [1/2] couch commit: updated refs/heads/master to 6e45e7b
Date Mon, 19 Jan 2015 17:21:37 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/master 74eefe9d6 -> 6e45e7b54


Modify init_delete_dir to be async

In the case when .delete directory contains lots of files.
The deletion of the directory leads to timeout in the supervisor.
Which in it's turn kills the node.

COUCHDB-2524


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/b7e4a440
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/b7e4a440
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/b7e4a440

Branch: refs/heads/master
Commit: b7e4a4409bd9f114011b6a7e970258d34a55996a
Parents: a4dbd64
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Wed Jan 7 11:00:19 2015 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Mon Jan 19 06:54:32 2015 -0800

----------------------------------------------------------------------
 src/couch_file.erl | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/b7e4a440/src/couch_file.erl
----------------------------------------------------------------------
diff --git a/src/couch_file.erl b/src/couch_file.erl
index 3ebf608..1a47d2b 100644
--- a/src/couch_file.erl
+++ b/src/couch_file.erl
@@ -260,10 +260,13 @@ init_delete_dir(RootDir) ->
     % note: ensure_dir requires an actual filename companent, which is the
     % reason for "foo".
     filelib:ensure_dir(filename:join(Dir,"foo")),
-    filelib:fold_files(Dir, ".*", true,
-        fun(Filename, _) ->
-            ok = file:delete(Filename)
-        end, ok).
+    spawn(fun() ->
+        filelib:fold_files(Dir, ".*", true,
+            fun(Filename, _) ->
+                ok = file:delete(Filename)
+            end, ok)
+    end),
+    ok.
 
 
 read_header(Fd) ->


Mime
View raw message