You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/01/20 17:40:44 UTC

[GitHub] [couchdb] willholley opened a new pull request #2475: Add POST /_node//_config/_reload

willholley opened a new pull request #2475: Add POST /_node/<node>/_config/_reload
URL: https://github.com/apache/couchdb/pull/2475
 
 
   <!-- Thank you for your contribution!
   
        Please file this form by replacing the Markdown comments
        with your text. If a section needs no action - remove it.
   
        Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
        of code collaboration. Positive feedback is represented +1 from committers
        and negative is a -1. The -1 also means veto, and needs to be addressed
        to proceed. Once there are no objections, the PR can be merged by a
        CouchDB committer.
   
        See: http://couchdb.apache.org/bylaws.html#decisions for more info. -->
   
   ## Overview
   
   <!-- Please give a short brief for the pull request,
        what problem it solves or how it makes things better. -->
   
   Using the backend port 5986 it was possible to reload config from disk
   using the _config/_reload endpoint. This ports it to the `/_node` API on the frontend port.
   
   ## Testing recommendations
   
   <!-- Describe how we can test your changes.
        Does it provides any behaviour that the end users
        could notice? -->
   
   Launch CouchDB e.g. using `./dev/run`. Change the `local.ini` somehow and run:
   
   ```
   curl localhost:15984/_node/_local/_config/_reload -XPOST
   ```
   
   Verify the change using 
   
   ```
   curl localhost:15984/_node/_local/_config`
   ```
   
   ## Related Issues or Pull Requests
   
   <!-- If your changes affects multiple components in different
        repositories please put links to those issues or pull requests here.  -->
   
   ## Checklist
   
   - [ ] Code is written and works correctly
   - [ ] Changes are covered by tests
   - [ ] Any new configurable parameters are documented in `rel/overlay/etc/default.ini`
   - [ ] A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] willholley commented on a change in pull request #2475: Add POST /_node//_config/_reload

Posted by GitBox <gi...@apache.org>.
willholley commented on a change in pull request #2475: Add POST /_node/<node>/_config/_reload
URL: https://github.com/apache/couchdb/pull/2475#discussion_r368854659
 
 

 ##########
 File path: test/elixir/test/config_test.exs
 ##########
 @@ -174,4 +174,11 @@ defmodule ConfigTest do
       set_config(context, section, "wohali", "rules", 403)
     end)
   end
+
+  test "Reload config", context do
+    url = "#{context[:config_url]}/_reload"
+    resp = Couch.post(url)
+
+    assert resp.status_code == 200
 
 Review comment:
   yes - I couldn't see a good way to test this, though that test should perhaps exist for `couch_config` rather than this endpoint specifically. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] willholley commented on a change in pull request #2475: Add POST /_node//_config/_reload

Posted by GitBox <gi...@apache.org>.
willholley commented on a change in pull request #2475: Add POST /_node/<node>/_config/_reload
URL: https://github.com/apache/couchdb/pull/2475#discussion_r368855435
 
 

 ##########
 File path: test/elixir/test/config_test.exs
 ##########
 @@ -174,4 +174,11 @@ defmodule ConfigTest do
       set_config(context, section, "wohali", "rules", 403)
     end)
   end
+
+  test "Reload config", context do
+    url = "#{context[:config_url]}/_reload"
+    resp = Couch.post(url)
+
+    assert resp.status_code == 200
 
 Review comment:
   the admin case is interesting - I wonder if that's to do with `couchdb_config` not triggering `config_event` notifications on reload.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] willholley commented on a change in pull request #2475: Add POST /_node//_config/_reload

Posted by GitBox <gi...@apache.org>.
willholley commented on a change in pull request #2475: Add POST /_node/<node>/_config/_reload
URL: https://github.com/apache/couchdb/pull/2475#discussion_r368855435
 
 

 ##########
 File path: test/elixir/test/config_test.exs
 ##########
 @@ -174,4 +174,11 @@ defmodule ConfigTest do
       set_config(context, section, "wohali", "rules", 403)
     end)
   end
+
+  test "Reload config", context do
+    url = "#{context[:config_url]}/_reload"
+    resp = Couch.post(url)
+
+    assert resp.status_code == 200
 
 Review comment:
   the admin case is interesting - I wonder if that's to do with couchdb_config not triggering `config_event` notifications on reload.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] jaydoane commented on a change in pull request #2475: Add POST /_node//_config/_reload

Posted by GitBox <gi...@apache.org>.
jaydoane commented on a change in pull request #2475: Add POST /_node/<node>/_config/_reload
URL: https://github.com/apache/couchdb/pull/2475#discussion_r368713773
 
 

 ##########
 File path: src/chttpd/src/chttpd_node.erl
 ##########
 @@ -46,6 +46,14 @@ handle_node_req(#httpd{method='GET', path_parts=[_, Node, <<"_config">>]}=Req) -
     send_json(Req, 200, {KVs});
 handle_node_req(#httpd{path_parts=[_, _Node, <<"_config">>]}=Req) ->
     send_method_not_allowed(Req, "GET");
+% POST /_node/$node/_config/_reload - Flushes unpersisted config values from RAM
+handle_node_req(#httpd{method='POST', path_parts=[_, Node, <<"_config">>, <<"_reload">>]}=Req) ->
 
 Review comment:
   Do we need to send an explicit `405` for non-POST requests to this endpoint? I tried this:
   ```
   $ curl -u adm:pass -H 'Content-Type: application/json' localhost:15984/_node/_local/_config/_reload -XGET | jq .
   {}
   ```
   which doesn't seem right?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] willholley commented on a change in pull request #2475: Add POST /_node//_config/_reload

Posted by GitBox <gi...@apache.org>.
willholley commented on a change in pull request #2475: Add POST /_node/<node>/_config/_reload
URL: https://github.com/apache/couchdb/pull/2475#discussion_r368854659
 
 

 ##########
 File path: test/elixir/test/config_test.exs
 ##########
 @@ -174,4 +174,11 @@ defmodule ConfigTest do
       set_config(context, section, "wohali", "rules", 403)
     end)
   end
+
+  test "Reload config", context do
+    url = "#{context[:config_url]}/_reload"
+    resp = Couch.post(url)
+
+    assert resp.status_code == 200
 
 Review comment:
   yes - I couldn't see a good way to test this, though that test should perhaps exist for `couchdb_config` rather than this endpoint specifically. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] jaydoane commented on a change in pull request #2475: Add POST /_node//_config/_reload

Posted by GitBox <gi...@apache.org>.
jaydoane commented on a change in pull request #2475: Add POST /_node/<node>/_config/_reload
URL: https://github.com/apache/couchdb/pull/2475#discussion_r368716366
 
 

 ##########
 File path: test/elixir/test/config_test.exs
 ##########
 @@ -174,4 +174,11 @@ defmodule ConfigTest do
       set_config(context, section, "wohali", "rules", 403)
     end)
   end
+
+  test "Reload config", context do
+    url = "#{context[:config_url]}/_reload"
+    resp = Couch.post(url)
+
+    assert resp.status_code == 200
 
 Review comment:
   It might be nice to actually demo changing a config value in e.g. a .ini file and see it change with the reload, but I'm not sure if there's a simple way to make that filesystem modification via elixir test.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] willholley merged pull request #2475: Add POST /_node//_config/_reload

Posted by GitBox <gi...@apache.org>.
willholley merged pull request #2475: Add POST /_node/<node>/_config/_reload
URL: https://github.com/apache/couchdb/pull/2475
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services