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:47 UTC

[couchdb] branch master updated (bfc610f -> 71cf9f4)

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

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


    from bfc610f  Make stem_interactive_updates option work again
     new 80e431f  Fix for issue #1136 - Error 500 deleting DB without quorum
     new 177c22d  Deletion responds 200 after a response from every node, and 202 in other case
     new 71cf9f4  Adjust deletion tests in different cluster quorum conditions

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/fabric/src/fabric_db_delete.erl                      |  6 +++---
 test/javascript/run                                      |  8 ++++----
 test/javascript/tests-cluster/with-quorum/db_deletion.js | 12 +++++++++---
 .../tests-cluster/without-quorum/db_creation.js          |  3 +--
 .../tests-cluster/without-quorum/db_deletion.js          | 16 +++++++++-------
 .../without-quorum/db_deletion_overridden_quorum.js      |  8 ++------
 6 files changed, 28 insertions(+), 25 deletions(-)


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

Posted by ja...@apache.org.
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/");


[couchdb] 01/03: Fix for issue #1136 - Error 500 deleting DB without quorum

Posted by ja...@apache.org.
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 80e431f11a401f78651dd4f8f34326b2e5109557
Author: jjrodrig <jj...@gmail.com>
AuthorDate: Thu Feb 1 19:31:29 2018 +0100

    Fix for issue #1136 - Error 500 deleting DB without quorum
    
    Complete deletion tests with not found
---
 src/fabric/src/fabric_db_delete.erl                    |  6 +++---
 test/javascript/run                                    |  8 ++++----
 .../db_creation.js => with-quorum/db-deletion.js}      | 18 ++++++++++--------
 .../without-quorum/{db_creation.js => db-deletion.js}  | 18 ++++++++++--------
 .../tests-cluster/without-quorum/db_creation.js        |  3 +--
 5 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/src/fabric/src/fabric_db_delete.erl b/src/fabric/src/fabric_db_delete.erl
index 9ba55fb..a1b5108 100644
--- a/src/fabric/src/fabric_db_delete.erl
+++ b/src/fabric/src/fabric_db_delete.erl
@@ -81,10 +81,10 @@ maybe_stop(W, Counters) ->
             {#shard{dbname=Name}, _} = hd(Counters),
             couch_log:warning("~p not_found ~s", [?MODULE, Name]),
             {stop, not_found};
-        {W, _, _} ->
-            {stop, ok};
         {N, M, _} when N >= (W div 2 + 1), M > 0 ->
-            {stop, accepted};
+            {stop, ok};
+        {_, M, _} when M > 0 ->
+            {stop,accepted};
         _ ->
             {error, internal_server_error}
         end
diff --git a/test/javascript/run b/test/javascript/run
index 8ae4244..ca69e1f 100755
--- a/test/javascript/run
+++ b/test/javascript/run
@@ -134,10 +134,11 @@ def main():
                 tmp.append(name)
         tests = tmp
 
-    fmt = mkformatter(tests)
     passed = 0
     failed = 0
-    for test in tests:
+    if len(tests) > 0 :
+     fmt = mkformatter(tests)
+     for test in tests:
         result = run_couchjs(test, fmt)
         if result == 0:
             passed += 1
@@ -169,8 +170,7 @@ def build_test_case_paths(path,args=None):
             elif os.path.isfile(pname + ".js"):
                 tests.append(pname + ".js")
             else:
-                sys.stderr.write("Unknown test: " + name + os.linesep)
-                exit(1)
+                sys.stderr.write("Waring - Unknown test: " + name + os.linesep)
     return tests
 
 
diff --git a/test/javascript/tests-cluster/without-quorum/db_creation.js b/test/javascript/tests-cluster/with-quorum/db-deletion.js
similarity index 70%
copy from test/javascript/tests-cluster/without-quorum/db_creation.js
copy to test/javascript/tests-cluster/with-quorum/db-deletion.js
index 0d8ff83..f561e3a 100644
--- a/test/javascript/tests-cluster/without-quorum/db_creation.js
+++ b/test/javascript/tests-cluster/with-quorum/db-deletion.js
@@ -10,19 +10,21 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-// Do DB creation under cluster without quorum conditions.
-couchTests.db_creation = function(debug) {
+// Do DB deletion under cluster with quorum conditions.
+couchTests.db_deletion = function(debug) {
 
   if (debug) debugger;
 
   var db_name = get_random_db_name()
   var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
 
-  // DB Creation should return 202- Accepted
-  xhr = CouchDB.request("PUT", "/" + db_name + "/");
-  T(xhr.status == 202);
-
-  // cleanup
-  // TODO DB deletions fails if the quorum is not met.
+  db.createDb();
+  
+  // DB Deletion should return 200 - Ok
   xhr = CouchDB.request("DELETE", "/" + db_name + "/");
+  T(xhr.status == 200);
+
+// DB Deletion should return 404 - Not found
+  xhr = CouchDB.request("DELETE", "/not-existing-db/");
+  T(xhr.status == 404);
 };
diff --git a/test/javascript/tests-cluster/without-quorum/db_creation.js b/test/javascript/tests-cluster/without-quorum/db-deletion.js
similarity index 72%
copy from test/javascript/tests-cluster/without-quorum/db_creation.js
copy to test/javascript/tests-cluster/without-quorum/db-deletion.js
index 0d8ff83..006345e 100644
--- a/test/javascript/tests-cluster/without-quorum/db_creation.js
+++ b/test/javascript/tests-cluster/without-quorum/db-deletion.js
@@ -10,19 +10,21 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-// Do DB creation under cluster without quorum conditions.
-couchTests.db_creation = function(debug) {
+// Do DB creation under cluster with quorum conditions.
+couchTests.db_deletion = function(debug) {
 
   if (debug) debugger;
 
   var db_name = get_random_db_name()
   var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
 
-  // DB Creation should return 202- Accepted
-  xhr = CouchDB.request("PUT", "/" + db_name + "/");
-  T(xhr.status == 202);
-
-  // cleanup
-  // TODO DB deletions fails if the quorum is not met.
+  db.createDb();
+  
+  // DB Deletion should return 202 - Acepted
   xhr = CouchDB.request("DELETE", "/" + db_name + "/");
+  T(xhr.status == 202);
+  
+  // DB Deletion should return 404 - Not found
+  xhr = CouchDB.request("DELETE", "/not-existing-db/");
+  T(xhr.status == 404);
 };
diff --git a/test/javascript/tests-cluster/without-quorum/db_creation.js b/test/javascript/tests-cluster/without-quorum/db_creation.js
index 0d8ff83..a21d377 100644
--- a/test/javascript/tests-cluster/without-quorum/db_creation.js
+++ b/test/javascript/tests-cluster/without-quorum/db_creation.js
@@ -23,6 +23,5 @@ couchTests.db_creation = function(debug) {
   T(xhr.status == 202);
 
   // cleanup
-  // TODO DB deletions fails if the quorum is not met.
-  xhr = CouchDB.request("DELETE", "/" + db_name + "/");
+  db.deleteDb();
 };


[couchdb] 03/03: Adjust deletion tests in different cluster quorum conditions

Posted by ja...@apache.org.
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 71cf9f4b53728bd5df5f5b5cc349187ca9da67bb
Author: jjrodrig <jj...@gmail.com>
AuthorDate: Mon Jul 9 23:10:42 2018 +0200

    Adjust deletion tests in different cluster quorum conditions
---
 .../tests-cluster/with-quorum/db-deletion.js       | 30 ----------------------
 .../tests-cluster/with-quorum/db_deletion.js       | 12 ++++++---
 .../tests-cluster/without-quorum/db-deletion.js    | 30 ----------------------
 .../tests-cluster/without-quorum/db_deletion.js    | 16 +++++++-----
 .../db_deletion_overridden_quorum.js               |  8 ++----
 5 files changed, 20 insertions(+), 76 deletions(-)

diff --git a/test/javascript/tests-cluster/with-quorum/db-deletion.js b/test/javascript/tests-cluster/with-quorum/db-deletion.js
deleted file mode 100644
index 079fb49..0000000
--- a/test/javascript/tests-cluster/with-quorum/db-deletion.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-// Do DB deletion under cluster with quorum conditions.
-couchTests.db_deletion = function(debug) {
-
-  if (debug) debugger;
-
-  var db_name = get_random_db_name()
-  var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
-
-  db.createDb();
-
-  // DB Deletion should return 202 - Acceted as the custer is not complete
-  xhr = CouchDB.request("DELETE", "/" + db_name + "/");
-  T(xhr.status == 202);
-
-// DB Deletion should return 404 - Not found
-  xhr = CouchDB.request("DELETE", "/not-existing-db/");
-  T(xhr.status == 404);
-};
diff --git a/test/javascript/tests-cluster/with-quorum/db_deletion.js b/test/javascript/tests-cluster/with-quorum/db_deletion.js
index bef4cae..079fb49 100644
--- a/test/javascript/tests-cluster/with-quorum/db_deletion.js
+++ b/test/javascript/tests-cluster/with-quorum/db_deletion.js
@@ -10,15 +10,21 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-// Do DB deletion in a cluster with quorum conditions.
+// Do DB deletion under cluster with quorum conditions.
 couchTests.db_deletion = function(debug) {
 
   if (debug) debugger;
 
   var db_name = get_random_db_name()
   var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
+
   db.createDb();
 
-  db.deleteDb();
-  T(db.last_req.status="200","Should return 200");
+  // DB Deletion should return 202 - Acceted as the custer is not complete
+  xhr = CouchDB.request("DELETE", "/" + db_name + "/");
+  T(xhr.status == 202);
+
+// DB Deletion should return 404 - Not found
+  xhr = CouchDB.request("DELETE", "/not-existing-db/");
+  T(xhr.status == 404);
 };
diff --git a/test/javascript/tests-cluster/without-quorum/db-deletion.js b/test/javascript/tests-cluster/without-quorum/db-deletion.js
deleted file mode 100644
index 006345e..0000000
--- a/test/javascript/tests-cluster/without-quorum/db-deletion.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-// Do DB creation under cluster with quorum conditions.
-couchTests.db_deletion = function(debug) {
-
-  if (debug) debugger;
-
-  var db_name = get_random_db_name()
-  var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
-
-  db.createDb();
-  
-  // DB Deletion should return 202 - Acepted
-  xhr = CouchDB.request("DELETE", "/" + db_name + "/");
-  T(xhr.status == 202);
-  
-  // DB Deletion should return 404 - Not found
-  xhr = CouchDB.request("DELETE", "/not-existing-db/");
-  T(xhr.status == 404);
-};
diff --git a/test/javascript/tests-cluster/without-quorum/db_deletion.js b/test/javascript/tests-cluster/without-quorum/db_deletion.js
index 04b15c0..006345e 100644
--- a/test/javascript/tests-cluster/without-quorum/db_deletion.js
+++ b/test/javascript/tests-cluster/without-quorum/db_deletion.js
@@ -10,19 +10,21 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-// Do DB deletion in a cluster with quorum conditions.
+// Do DB creation under cluster with quorum conditions.
 couchTests.db_deletion = function(debug) {
 
   if (debug) debugger;
 
   var db_name = get_random_db_name()
   var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
-  db.createDb();
 
-  //db.deleteDb();
-  // TODO DB deletions fails if the quorum is not met.
+  db.createDb();
+  
+  // DB Deletion should return 202 - Acepted
   xhr = CouchDB.request("DELETE", "/" + db_name + "/");
-  //T(db.last_req.status="202","Should return 202");
-  console.log("Skipped-TODO: Fix issue 500 Error on delete. 202->"+xhr.status)
-
+  T(xhr.status == 202);
+  
+  // DB Deletion should return 404 - Not found
+  xhr = CouchDB.request("DELETE", "/not-existing-db/");
+  T(xhr.status == 404);
 };
diff --git a/test/javascript/tests-cluster/without-quorum/db_deletion_overridden_quorum.js b/test/javascript/tests-cluster/without-quorum/db_deletion_overridden_quorum.js
index 4a1efce..11b344c 100644
--- a/test/javascript/tests-cluster/without-quorum/db_deletion_overridden_quorum.js
+++ b/test/javascript/tests-cluster/without-quorum/db_deletion_overridden_quorum.js
@@ -19,11 +19,7 @@ couchTests.db_deletion_overridden_quorum = function(debug) {
   var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"},{"w":1});
   db.createDb();
 
-
-  //db.deleteDb();
-  // TODO DB deletions fails if the quorum is not met.
+  // DB deletions does not consider overriden quorum param.
   xhr = CouchDB.request("DELETE", "/" + db_name + "/");
-  //T(db.last_req.status="200","Should return 200");
-  console.log("Skipped-TODO: Fix issue 500 Error on delete - Not considering overriden quorum. 200->"+xhr.status);
-
+  T(db.last_req.status="202","Should return 202");
 };