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 2020/02/19 20:54:51 UTC

[couchdb] branch fix/single-node-status created (now 8269b43)

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

jan pushed a change to branch fix/single-node-status
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 8269b43  fix: show single node  on setup status with single_node=true

This branch includes the following new commits:

     new 5102ab8  Revert "fix: single node state (#2575)"
     new 8269b43  fix: show single node  on setup status with single_node=true

The 2 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.



[couchdb] 01/02: Revert "fix: single node state (#2575)"

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch fix/single-node-status
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 5102ab840658bc2bcd5a168ba0c80a4aa3072524
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Wed Feb 19 21:51:52 2020 +0100

    Revert "fix: single node state (#2575)"
    
    This reverts commit 91ecf6777cc5fff93483b8e92c8daadd7ff33fdc.
---
 src/setup/src/setup.erl | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/setup/src/setup.erl b/src/setup/src/setup.erl
index cc64ae4..3d23229 100644
--- a/src/setup/src/setup.erl
+++ b/src/setup/src/setup.erl
@@ -65,15 +65,13 @@ is_cluster_enabled() ->
     end.
 
 is_single_node_enabled(Dbs) ->
-    % admins != empty AND dbs exist OR `[couchdb] single_node` is set to true
+    % admins != empty AND dbs exist
     Admins = config:get("admins"),
     HasDbs = has_cluster_system_dbs(Dbs),
-    SingleNodeConfig = config:get_boolean("couchdb", "single_node", false),
-    case {Admins, HasDbs, SingleNodeConfig} of
-        {_, _, true} -> true;
-        {[], _, _} -> false;
-        {_, false, _} -> false;
-        {_,_,_} -> true
+    case {Admins, HasDbs} of
+        {[], _} -> false;
+        {_, false} -> false;
+        {_,_} -> true
     end.
 
 cluster_system_dbs() ->


[couchdb] 02/02: fix: show single node on setup status with single_node=true

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch fix/single-node-status
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 8269b43abd2a2eca37a87c8b4ef9c6e1e6c6d74e
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Wed Feb 19 21:55:15 2020 +0100

    fix: show single node  on setup status with single_node=true
---
 src/setup/src/setup_httpd.erl | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/setup/src/setup_httpd.erl b/src/setup/src/setup_httpd.erl
index f4e05ce..1d31a6c 100644
--- a/src/setup/src/setup_httpd.erl
+++ b/src/setup/src/setup_httpd.erl
@@ -31,24 +31,30 @@ handle_setup_req(#httpd{method='GET'}=Req) ->
     ok = chttpd:verify_is_server_admin(Req),
     Dbs = chttpd:qs_json_value(Req, "ensure_dbs_exist", setup:cluster_system_dbs()),
     couch_log:notice("Dbs: ~p~n", [Dbs]),
-    case erlang:list_to_integer(config:get("cluster", "n", undefined)) of
-        1 ->
-            case setup:is_single_node_enabled(Dbs) of
-                false ->
-                    chttpd:send_json(Req, 200, {[{state, single_node_disabled}]});
-                true ->
-                    chttpd:send_json(Req, 200, {[{state, single_node_enabled}]})
-            end;
+    SingleNodeConfig = config:get_boolean("couchdb", "single_node", false),
+    case SingleNodeConfig of
+        true ->
+            chttpd:send_json(Req, 200, {[{state, single_node_enabled}]});
         _ ->
-            case setup:is_cluster_enabled() of
-                false ->
-                    chttpd:send_json(Req, 200, {[{state, cluster_disabled}]});
-                true ->
-                    case setup:has_cluster_system_dbs(Dbs) of
+            case erlang:list_to_integer(config:get("cluster", "n", undefined)) of
+                1 ->
+                    case setup:is_single_node_enabled(Dbs) of
                         false ->
-                            chttpd:send_json(Req, 200, {[{state, cluster_enabled}]});
+                            chttpd:send_json(Req, 200, {[{state, single_node_disabled}]});
                         true ->
-                            chttpd:send_json(Req, 200, {[{state, cluster_finished}]})
+                            chttpd:send_json(Req, 200, {[{state, single_node_enabled}]})
+                    end;
+                _ ->
+                    case setup:is_cluster_enabled() of
+                        false ->
+                            chttpd:send_json(Req, 200, {[{state, cluster_disabled}]});
+                        true ->
+                            case setup:has_cluster_system_dbs(Dbs) of
+                                false ->
+                                    chttpd:send_json(Req, 200, {[{state, cluster_enabled}]});
+                                true ->
+                                    chttpd:send_json(Req, 200, {[{state, cluster_finished}]})
+                            end
                     end
             end
     end;