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/19 23:31:22 UTC

[couchdb] branch master updated (1e37457 -> 26f9366)

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

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


    from 1e37457  feat(breaking): make _all_dbs admin-only by default (#2577)
     new e0cff2f  Revert "fix: single node state (#2575)"
     new 26f9366  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] 01/02: Revert "fix: single node state (#2575)"

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

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

commit e0cff2f85ec43dbee203e17a3b45d3bd912a8da9
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 wo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 26f93667c9f65f5f977ab7eabd5a65fbe93d07b6
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;