Browse files

MB-7569 Ignore eacces errors on delete dir init

Ignore those and have index cleanup delete any files in
that directory too. Index cleanup is already periodically
called by the compaction scheduler (ns_server), so that we
don't risk having files in the delete directory that are
never deleted.

Change-Id: Ib55bdeab07deed876822c21acacbfebda7fb639e
Reviewed-on: http://review.couchbase.org/24398
Reviewed-by: Sriram Melkote <siri.couchbase@gmail.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
  • Loading branch information...
1 parent 059b672 commit dc873ddd49d011dd927a847212aa25c71f5ad69b @fdmanana fdmanana committed with fdmanana Feb 4, 2013
Showing with 7 additions and 3 deletions.
  1. +1 −0 src/couch_set_view/src/couch_set_view.erl
  2. +3 −2 src/couchdb/couch_file.erl
  3. +3 −1 src/couchdb/couch_view.erl
View
1 src/couch_set_view/src/couch_set_view.erl
@@ -484,6 +484,7 @@ cleanup_index_files(SetName) ->
[SetName, string:join(DeleteFiles, "\n")])
end,
RootDir = couch_config:get("couchdb", "view_index_dir"),
+ couch_file:init_delete_dir(RootDir),
lists:foreach(
fun(File) -> couch_file:delete(RootDir, File, false) end,
DeleteFiles).
View
5 src/couchdb/couch_file.erl
@@ -247,8 +247,9 @@ init_delete_dir(RootDir) ->
file2:ensure_dir(filename:join(Dir,"foo")),
file2:fold_files(Dir, ".*", true,
fun(Filename, _) ->
- ok = file2:delete(Filename)
- end, ok).
+ _ = file2:delete(Filename)
+ end, ok),
+ ok.
read_header(Fd) ->
View
4 src/couchdb/couch_view.erl
@@ -122,12 +122,14 @@ cleanup_index_files(Db) ->
re:run(FilePath, RegExp, [{capture, none}]) =:= nomatch]
end,
+ RootDir = couch_config:get("couchdb", "view_index_dir"),
+ couch_file:init_delete_dir(RootDir),
+
case DeleteFiles of
[] ->
ok;
_ ->
?LOG_DEBUG("deleting unused view index files: ~p", [DeleteFiles]),
- RootDir = couch_config:get("couchdb", "view_index_dir"),
[couch_file:delete(RootDir, File, false) || File <- DeleteFiles]
end,
ok.

0 comments on commit dc873dd

Please sign in to comment.