You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2018/07/13 11:43:49 UTC

[couchdb] 02/03: Deletion responds 200 after a response from every node, and 202 in other case

This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 177c22d0f541fdeb6e0f6457ab6ea9afa7bdea9a
Author: jjrodrig <jj...@gmail.com>
AuthorDate: Thu Mar 29 23:34:42 2018 +0200

    Deletion responds 200 after a response from every node, and 202 in other case
---
 src/fabric/src/fabric_db_delete.erl                      | 4 ++--
 test/javascript/tests-cluster/with-quorum/db-deletion.js | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/fabric/src/fabric_db_delete.erl b/src/fabric/src/fabric_db_delete.erl
index a1b5108..c146cb6 100644
--- a/src/fabric/src/fabric_db_delete.erl
+++ b/src/fabric/src/fabric_db_delete.erl
@@ -79,9 +79,9 @@ maybe_stop(W, Counters) ->
         case {Ok + NotFound, Ok, NotFound} of
         {W, 0, W} ->
             {#shard{dbname=Name}, _} = hd(Counters),
-            couch_log:warning("~p not_found ~s", [?MODULE, Name]),
+            couch_log:warning("~p not_found ~d", [?MODULE, Name]),
             {stop, not_found};
-        {N, M, _} when N >= (W div 2 + 1), M > 0 ->
+        {W, _, _} ->
             {stop, ok};
         {_, M, _} when M > 0 ->
             {stop,accepted};
diff --git a/test/javascript/tests-cluster/with-quorum/db-deletion.js b/test/javascript/tests-cluster/with-quorum/db-deletion.js
index f561e3a..079fb49 100644
--- a/test/javascript/tests-cluster/with-quorum/db-deletion.js
+++ b/test/javascript/tests-cluster/with-quorum/db-deletion.js
@@ -19,10 +19,10 @@ couchTests.db_deletion = function(debug) {
   var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
 
   db.createDb();
-  
-  // DB Deletion should return 200 - Ok
+
+  // DB Deletion should return 202 - Acceted as the custer is not complete
   xhr = CouchDB.request("DELETE", "/" + db_name + "/");
-  T(xhr.status == 200);
+  T(xhr.status == 202);
 
 // DB Deletion should return 404 - Not found
   xhr = CouchDB.request("DELETE", "/not-existing-db/");