Github user eiri commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/161#discussion_r59083758
  
    --- Diff: src/couch_file.erl ---
    @@ -253,14 +253,23 @@ deleted_filename_suffix() ->
             [Y, Mon, D, H, Min, S, couch_uuids:random()]).
     
     nuke_dir(RootDelDir, Dir) ->
    +    case config:get_boolean("couchdb", "rename_on_delete", false) of
    +        true -> couch_server:delete_file(RootDelDir, Dir, []);
    +        false -> delete_dir(RootDelDir, Dir)
    +    end.
    +
    +delete_dir(RootDelDir, Dir) ->
         FoldFun = fun(File) ->
             Path = Dir ++ "/" ++ File,
             case filelib:is_dir(Path) of
                 true ->
    -                ok = nuke_dir(RootDelDir, Path),
    +                ok = delete_dir(RootDelDir, Path),
                     file:del_dir(Path);
                 false ->
    -                delete(RootDelDir, Path, false)
    +                UUID = couch_uuids:random(),
    +                DelFile = filename:join([RootDelDir, ".delete", UUID]),
    +                file:rename(Path, DelFile),
    +                file:delete(DelFile)
    --- End diff --
    
    Here is JIRA issue that gives more details on rename-then-delete approach: 
https://issues.apache.org/jira/browse/COUCHDB-1003


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to