You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wo...@apache.org on 2020/02/20 00:01:40 UTC

[couchdb] branch 3.0.x updated (5f6a76d -> 03a77db)

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

wohali pushed a change to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


    from 5f6a76d  bump docs rev (#2579)
     new 72ce32e  Revert "fix: single node state (#2574)"
     new 03a77db  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.


Summary of changes:
 src/setup/src/setup.erl       | 12 +++++-------
 src/setup/src/setup_httpd.erl | 36 +++++++++++++++++++++---------------
 2 files changed, 26 insertions(+), 22 deletions(-)


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

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

wohali pushed a commit to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 03a77db6ca41ab48a198f36c1dfab48d18ade624
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..949675b 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 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;


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

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

wohali pushed a commit to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git

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

    Revert "fix: single node state (#2574)"
    
    This reverts commit afef1b2f5823f6269ecb4a845e286e9d0c0f4f35.
---
 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() ->