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

[couchdb] branch 3.x-sync created (now b3fcdc3)

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

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


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

This branch includes the following new commits:

     new 5c8dc23  Revert "fix: single node state (#2574)"
     new b3fcdc3  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 (#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.x-sync
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 5c8dc23eddb135d602a211a7f01d8276d921a01d
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() ->


[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.x-sync
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit b3fcdc37b2cb76e085fd165d92cc5cc925412fb3
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;