Deletion responds 200 after a response from every node, and 202 in other case
authorjjrodrig <jjrodrig@gmail.com>
Thu, 29 Mar 2018 21:34:42 +0000 (23:34 +0200)
committerJan Lehnardt <jan@apache.org>
Fri, 13 Jul 2018 11:43:43 +0000 (13:43 +0200)
src/fabric/src/fabric_db_delete.erl
test/javascript/tests-cluster/with-quorum/db-deletion.js

index a1b5108..c146cb6 100644 (file)
@@ -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};
index f561e3a..079fb49 100644 (file)
@@ -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/");