couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [7/8] couch commit: updated refs/heads/master to 78f575e
Date Thu, 28 Apr 2016 16:26:13 GMT
Rename option `rename_on_delete` to `enable_database_recovery`

Since internally we always rename files before deletion due to
performance optimization, this option got changed to avoid confusion
and clearify the intent.


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

Branch: refs/heads/master
Commit: 5be695824a757f7c88fa2684b6e4ea6aa29bc625
Parents: cc30705
Author: Eric Avdey <eiri@eiri.ca>
Authored: Fri Apr 22 13:51:38 2016 -0300
Committer: Eric Avdey <eiri@eiri.ca>
Committed: Thu Apr 28 13:09:35 2016 -0300

----------------------------------------------------------------------
 src/couch_file.erl          |  5 +++--
 test/couch_file_tests.erl   | 10 +++++-----
 test/couch_server_tests.erl |  4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/5be69582/src/couch_file.erl
----------------------------------------------------------------------
diff --git a/src/couch_file.erl b/src/couch_file.erl
index 37923da..607fd6c 100644
--- a/src/couch_file.erl
+++ b/src/couch_file.erl
@@ -222,8 +222,9 @@ delete(RootDir, Filepath) ->
     delete(RootDir, Filepath, true).
 
 delete(RootDir, FullFilePath, Async) ->
-    RenameOnDelete = config:get_boolean("couchdb", "rename_on_delete", false),
-    case RenameOnDelete of
+    EnableRecovery = config:get_boolean("couchdb",
+        "enable_database_recovery", false),
+    case EnableRecovery of
         true ->
             rename_file(FullFilePath);
         false ->

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/5be69582/test/couch_file_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_file_tests.erl b/test/couch_file_tests.erl
index df122b0..c7bdfca 100644
--- a/test/couch_file_tests.erl
+++ b/test/couch_file_tests.erl
@@ -295,11 +295,11 @@ delete_test_() ->
             end,
             [
                 fun(Cfg) ->
-                    {"rename_on_delete = false",
+                    {"enable_database_recovery = false",
                     make_delete_test_case(Cfg, false)}
                 end,
                 fun(Cfg) ->
-                    {"rename_on_delete = true",
+                    {"enable_database_recovery = true",
                     make_delete_test_case(Cfg, true)}
                 end
             ]
@@ -307,15 +307,15 @@ delete_test_() ->
     }.
 
 
-make_delete_test_case({RootDir, File}, RenameOnDelete) ->
+make_delete_test_case({RootDir, File}, EnableRecovery) ->
     meck:expect(config, get_boolean, fun
-        ("couchdb", "rename_on_delete", _) -> RenameOnDelete
+        ("couchdb", "enable_database_recovery", _) -> EnableRecovery
     end),
     FileExistsBefore = filelib:is_regular(File),
     couch_file:delete(RootDir, File, false),
     FileExistsAfter = filelib:is_regular(File),
     RenamedFiles = filelib:wildcard(filename:rootname(File) ++ "*.deleted.*"),
-    ExpectRenamedCount = if RenameOnDelete -> 1; true -> 0 end,
+    ExpectRenamedCount = if EnableRecovery -> 1; true -> 0 end,
     [
         ?_assert(FileExistsBefore),
         ?_assertNot(FileExistsAfter),

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/5be69582/test/couch_server_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_server_tests.erl b/test/couch_server_tests.erl
index fcabbe5..c8f8381 100644
--- a/test/couch_server_tests.erl
+++ b/test/couch_server_tests.erl
@@ -26,7 +26,7 @@ setup() ->
     Db.
 
 setup(rename) ->
-    config:set("couchdb", "rename_on_delete", "true", false),
+    config:set("couchdb", "enable_database_recovery", "true", false),
     setup();
 setup(_) ->
     setup().
@@ -36,7 +36,7 @@ teardown(Db) ->
     (catch file:delete(Db#db.filepath)).
 
 teardown(rename, Db) ->
-    config:set("couchdb", "rename_on_delete", "false", false),
+    config:set("couchdb", "enable_database_recovery", "false", false),
     teardown(Db);
 teardown(_, Db) ->
     teardown(Db).


Mime
View raw message