[GitHub] couchdb-couch pull request #200: Adding test suite for trancated _update

2016-09-22 Thread kxepal
Github user kxepal commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/200#discussion_r80184463
  
--- Diff: test/couchdb_mrview_tests.erl ---
@@ -0,0 +1,165 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may 
not
+% use this file except in compliance with the License. You may obtain a 
copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations 
under
+% the License.
+
+-module(couchdb_mrview_tests).
+
+-include_lib("couch/include/couch_eunit.hrl").
+-include_lib("couch/include/couch_db.hrl").
+
+
+
+-define(DDOC, {[
+{<<"_id">>, <<"_design/foo">>},
+{<<"shows">>, {[
+{<<"bar">>, <<"function(doc, req) {return 'wosh';}">>}
+]}},
+{<<"updates">>, {[
+{<<"report">>, <<"function(doc, req) {"
+"var data = JSON.parse(req.body); "
+"return ['test', data];"
+"}">>}
+]}}
+]}).
+
+-define(USER, "admin").
+-define(PASS, "pass").
+-define(AUTH, {basic_auth, {?USER, ?PASS}}).
+
+
+start() ->
+Ctx = test_util:start_couch([chttpd]),
+ok = config:set("admins", ?USER, ?PASS, _Persist=false),
+Ctx.
+
+setup(PortType) ->
+ok = meck:new(mochiweb_socket, [passthrough]),
+ok = meck:expect(mochiweb_socket, recv, fun mochiweb_socket_recv/3),
+
+DbName = ?tempdb(),
+ok = create_db(PortType, DbName),
+
+Host = host_url(PortType),
+upload_ddoc(Host, ?b2l(DbName)),
+{Host, ?b2l(DbName)}.
+
+teardown(Ctx) ->
+ok = config:delete("admins", ?USER, _Persist=false),
+test_util:stop_couch(Ctx).
+
+teardown(PortType, {_Host, DbName}) ->
+(catch meck:unload(mochiweb_socket)),
+delete_db(PortType, ?l2b(DbName)),
+ok.
+
+mrview_update_test_() ->
+{
+"Check show functionality",
+{
+setup,
+fun start/0, fun teardown/1,
+[
+make_test_case(clustered, [fun 
should_return_incomplete/2]),
+make_test_case(backdoor, [fun should_return_incomplete/2])
+]
+}
+}.
+
+make_test_case(Mod, Funs) ->
+{
+lists:flatten(io_lib:format("~s", [Mod])),
+{foreachx, fun setup/1, fun teardown/2, [{Mod, Fun} || Fun <- 
Funs]}
+}.
+
+should_return_incomplete(PortType, {Host, DbName}) ->
+?_test(begin
+ ok = create_doc(PortType, ?l2b(DbName), <<"doc_id">>, {[]}),
+ ReqUrl = Host ++ "/" ++ DbName ++ 
"/_design/foo/_update/report/doc_id",
+ {ok, Status, _Headers, Body} =
+  test_request:post(ReqUrl, [?AUTH], <<"{truncated}">>),
+ {Props} = jiffy:decode(Body),
+ ?assertEqual(
+<<"bad_request">>, couch_util:get_value(<<"error">>, Props)),
+ ?assertEqual(
+<<"Incomplete">>, couch_util:get_value(<<"reason">>, Props)),
+ ?assertEqual(400, Status),
+ ok
+end).
+
+create_doc(backdoor, DbName, Id, Body) ->
+JsonDoc = couch_util:json_apply_field({<<"_id">>, Id}, Body),
+Doc = couch_doc:from_json_obj(JsonDoc),
+{ok, Db} = couch_db:open(DbName, [?ADMIN_CTX]),
+{ok, _} = couch_db:update_docs(Db, [Doc]),
+couch_db:ensure_full_commit(Db),
+couch_db:close(Db);
+create_doc(clustered, DbName, Id, Body) ->
+JsonDoc = couch_util:json_apply_field({<<"_id">>, Id}, Body),
+Doc = couch_doc:from_json_obj(JsonDoc),
+{ok, _} = fabric:update_docs(DbName, [Doc], [?ADMIN_CTX]),
+ok.
+
+create_db(backdoor, DbName) ->
+{ok, Db} = couch_db:create(DbName, [?ADMIN_CTX]),
+couch_db:close(Db);
+create_db(clustered, DbName) ->
+{ok, Status, _, _} = test_request:put(db_url(DbName), [?AUTH], ""),
+assert_success(create_db, Status),
+ok.
+
+delete_db(backdoor, DbName) ->
+couch_server:delete(DbName, [?ADMIN_CTX]);
+delete_db(clustered, DbName) ->
+{ok, Status, _, _} = test_request:delete(db_url(DbName), [?AUTH]),
+assert_success(delete_db, Status),
+ok.
+
+assert_success(create_db, Status) ->
+true = lists:member(Status, [201, 202]);
--- End diff --

Shouldn't explicit `?assert` be used? It produces a bit more informative 
error than badmatch if something will go wrong.


---
If 

[jira] [Commented] (COUCHDB-3158) Fix a crash when connection closes for _update

2016-09-22 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15514791#comment-15514791
 ] 

ASF GitHub Bot commented on COUCHDB-3158:
-

GitHub user iilyak opened a pull request:

https://github.com/apache/couchdb-chttpd/pull/140

Handle disconnect when receiving body

When any error happen on an underlying socket mochiweb uses
exit(normal). Add catch for exit:normal and convert it to
exit({bad_request, <<"Incomplete">>}).

COUCHDB-3158

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cloudant/couchdb-chttpd 
69425-handle-truncated-req-in-recv_body

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-chttpd/pull/140.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #140


commit bce8bf0e91948260465af6a78ae93487f57b39f3
Author: ILYA Khlopotov 
Date:   2016-09-22T23:19:39Z

Handle disconnect when receiving body

When any error happen on an underlying socket mochiweb uses
exit(normal). Add catch for exit:normal and convert it to
exit({bad_request, <<"Incomplete">>}).

COUCHDB-3158




> Fix a crash when connection closes for _update 
> ---
>
> Key: COUCHDB-3158
> URL: https://issues.apache.org/jira/browse/COUCHDB-3158
> Project: CouchDB
>  Issue Type: Bug
>Reporter: ILYA
> Attachments: acra
>
>
> There is a crash when the client issue an update request and closes the 
> connection. 
> {{//_design//_update//}}
> The resulting crash dump is:
> {code}
> req_err(3443101085) unknown_error : normal
> [<<"mochiweb_request:recv/3 L180">>,  
> <<"mochiweb_request:stream_unchunked_body/4 L540">>,
> <<"mochiweb_request:recv_body/2 L214">>,
> <<"chttpd_external:-json_req_obj/4-lc$^0/1-0-/4 L67">>,
> <<"chttpd_external:-json_req_obj/4-lc$^0/1-0-/4 L67">>,
> <<"chttpd_external:json_req_obj/4 L67">>,
> <<"chttpd_show:send_doc_update_response/6 L119">>, 
> <<"chttpd:process_request/1 L293">>]
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (COUCHDB-3158) Fix a crash when connection closes for _update

2016-09-22 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15514794#comment-15514794
 ] 

ASF GitHub Bot commented on COUCHDB-3158:
-

GitHub user iilyak opened a pull request:

https://github.com/apache/couchdb-couch/pull/200

Adding test suite for trancated _update

Test suite for https://github.com/apache/couchdb-chttpd/pull/140

COUCHDB-3158

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cloudant/couchdb-couch 
69425-handle-truncated-req-in-recv_body

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-couch/pull/200.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #200


commit 21c374f1dc049d35089092fc513d226f6580a3a6
Author: ILYA Khlopotov 
Date:   2016-09-22T23:11:02Z

Adding test suite for trancated _update

COUCHDB-3158




> Fix a crash when connection closes for _update 
> ---
>
> Key: COUCHDB-3158
> URL: https://issues.apache.org/jira/browse/COUCHDB-3158
> Project: CouchDB
>  Issue Type: Bug
>Reporter: ILYA
> Attachments: acra
>
>
> There is a crash when the client issue an update request and closes the 
> connection. 
> {{//_design//_update//}}
> The resulting crash dump is:
> {code}
> req_err(3443101085) unknown_error : normal
> [<<"mochiweb_request:recv/3 L180">>,  
> <<"mochiweb_request:stream_unchunked_body/4 L540">>,
> <<"mochiweb_request:recv_body/2 L214">>,
> <<"chttpd_external:-json_req_obj/4-lc$^0/1-0-/4 L67">>,
> <<"chttpd_external:-json_req_obj/4-lc$^0/1-0-/4 L67">>,
> <<"chttpd_external:json_req_obj/4 L67">>,
> <<"chttpd_show:send_doc_update_response/6 L119">>, 
> <<"chttpd:process_request/1 L293">>]
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] couchdb-couch pull request #200: Adding test suite for trancated _update

2016-09-22 Thread iilyak
GitHub user iilyak opened a pull request:

https://github.com/apache/couchdb-couch/pull/200

Adding test suite for trancated _update

Test suite for https://github.com/apache/couchdb-chttpd/pull/140

COUCHDB-3158

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cloudant/couchdb-couch 
69425-handle-truncated-req-in-recv_body

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-couch/pull/200.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #200


commit 21c374f1dc049d35089092fc513d226f6580a3a6
Author: ILYA Khlopotov 
Date:   2016-09-22T23:11:02Z

Adding test suite for trancated _update

COUCHDB-3158




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-chttpd pull request #140: Handle disconnect when receiving body

2016-09-22 Thread iilyak
GitHub user iilyak opened a pull request:

https://github.com/apache/couchdb-chttpd/pull/140

Handle disconnect when receiving body

When any error happen on an underlying socket mochiweb uses
exit(normal). Add catch for exit:normal and convert it to
exit({bad_request, <<"Incomplete">>}).

COUCHDB-3158

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cloudant/couchdb-chttpd 
69425-handle-truncated-req-in-recv_body

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-chttpd/pull/140.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #140


commit bce8bf0e91948260465af6a78ae93487f57b39f3
Author: ILYA Khlopotov 
Date:   2016-09-22T23:19:39Z

Handle disconnect when receiving body

When any error happen on an underlying socket mochiweb uses
exit(normal). Add catch for exit:normal and convert it to
exit({bad_request, <<"Incomplete">>}).

COUCHDB-3158




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Created] (COUCHDB-3158) Fix a crash when connection closes for _update

2016-09-22 Thread ILYA (JIRA)
ILYA created COUCHDB-3158:
-

 Summary: Fix a crash when connection closes for _update 
 Key: COUCHDB-3158
 URL: https://issues.apache.org/jira/browse/COUCHDB-3158
 Project: CouchDB
  Issue Type: Bug
Reporter: ILYA


There is a crash when the client issue an update request and closes the 
connection. 
{{//_design//_update//}}

The resulting crash dump is:
{code}
req_err(3443101085) unknown_error : normal
[<<"mochiweb_request:recv/3 L180">>,  
<<"mochiweb_request:stream_unchunked_body/4 L540">>,
<<"mochiweb_request:recv_body/2 L214">>,
<<"chttpd_external:-json_req_obj/4-lc$^0/1-0-/4 L67">>,
<<"chttpd_external:-json_req_obj/4-lc$^0/1-0-/4 L67">>,
<<"chttpd_external:json_req_obj/4 L67">>,
<<"chttpd_show:send_doc_update_response/6 L119">>, 
<<"chttpd:process_request/1 L293">>]
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] couchdb-chttpd issue #135: Handle empty "Access-Control-Request-Headers" hea...

2016-09-22 Thread kxepal
Github user kxepal commented on the issue:

https://github.com/apache/couchdb-chttpd/pull/135
  
cc @rnewson @davisp @iilyak 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-chttpd issue #135: Handle empty "Access-Control-Request-Headers" hea...

2016-09-22 Thread willholley
Github user willholley commented on the issue:

https://github.com/apache/couchdb-chttpd/pull/135
  
I've seen a few users run into this problem. Any chance of getting it 
merged now we past 2.0?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch-replicator pull request #48: Port HTTP 429 Commits

2016-09-22 Thread kxepal
Github user kxepal commented on a diff in the pull request:


https://github.com/apache/couchdb-couch-replicator/pull/48#discussion_r79905411
  
--- Diff: src/couch_replicator_httpc.erl ---
@@ -27,6 +27,9 @@
 
 -define(replace(L, K, V), lists:keystore(K, 1, L, {K, V})).
 -define(MAX_WAIT, 5 * 60 * 1000).
+-define(MAX_BACKOFF_WAIT, 250 * 32768).
--- End diff --

Shouldn't these be configurable?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (COUCHDB-3156) Users could be created by anyone (missing authorization for /_users/* endpoint)

2016-09-22 Thread Alexander Shorin (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15514173#comment-15514173
 ] 

Alexander Shorin commented on COUCHDB-3156:
---

[~afiskon]
I agree, that's a quite specific behaviour that doesn't match any else 
databases I know, but initially there were different ideas and intentions 
applied, so everyone if free to sign up. It has own pro and cons and that 
freedom is too easy to abuse in public service, thanks to our Internet culture. 

In real life it doesn't much different as once user is created, they have to 
communicate with admins in order to receive proper roles and be assigned to 
databases they need or ask to prepare some environment etc. The only difference 
happens in question of who sets the initial password and would user change 
default one. In everything else both your suggestion and current behavior are 
the same.

There is large room for improvements, like let users to reset own password 
using email without asking admins about, but that's all are improvements of 
what CouchDB has now.

> Users could be created by anyone (missing authorization for /_users/* 
> endpoint)
> ---
>
> Key: COUCHDB-3156
> URL: https://issues.apache.org/jira/browse/COUCHDB-3156
> Project: CouchDB
>  Issue Type: Bug
>  Components: HTTP Interface
>Reporter: Aleksander Alekseev
>Priority: Critical
>
> Steps to reproduce:
> 1. Configure a 3-node cluster (not sure if it also reproduces on a 
> single-node setup), make sure you've created an admin user:
> {code}
> curl -X PUT 
> http://127.0.0.1:5984/_node/couchdb@10.110.2.4/_config/admins/admin -d 
> '"password"'
> {code}
> 2. Execute:
> {code}
> curl -X PUT http://localhost:5984/_users/org.couchdb.user:afiskon \
>  -H "Accept: application/json" \
>  -H "Content-Type: application/json" \
>  -d '{"name": "afiskon", "password": "secret", "roles": [], "type": 
> "user"}'
> {code}
> Expected behavior:
> {code}
> {"error":"unauthorized","reason":"You are not a server admin."}
> {code}
> ( User should not be created since no admin username and password were 
> provided. )
> Actual behavior:
> {code}
> {"ok":true,"id":"org.couchdb.user:afiskon","rev":"1-ed29e6531747deca44fad127b033fe59"}
> {code}
> Affected version:
> CouchDB 2.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (COUCHDB-3156) Users could be created by anyone (missing authorization for /_users/* endpoint)

2016-09-22 Thread Alexander Shorin (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15514107#comment-15514107
 ] 

Alexander Shorin commented on COUCHDB-3156:
---

[~afiskon]
>  It also doesn't make sense to deny everyone to create databases and 
> documents (it's what CouchDB currently does after creation of the first 
> admin) and allow to create as many users as you want.

It has. Administrators must create database first and setup it right (security, 
design docs etc) to make it ready for users. Administrators cannot create users 
instead of them because otherwise we have to solve an interesting quest as 
"what password to set by default"? Obliviously, only users themself may answer 
on that. So the simplest solution that works is allow users to register 
themselfs and ack admins to grant them permissions for specific databases. 
That's simple and how it works till today.

What you call the bug is actually major current feature improvement since user 
registration have to be happened in two steps using some middle service as 
conjunction point.

> Users could be created by anyone (missing authorization for /_users/* 
> endpoint)
> ---
>
> Key: COUCHDB-3156
> URL: https://issues.apache.org/jira/browse/COUCHDB-3156
> Project: CouchDB
>  Issue Type: Bug
>  Components: HTTP Interface
>Reporter: Aleksander Alekseev
>Priority: Critical
>
> Steps to reproduce:
> 1. Configure a 3-node cluster (not sure if it also reproduces on a 
> single-node setup), make sure you've created an admin user:
> {code}
> curl -X PUT 
> http://127.0.0.1:5984/_node/couchdb@10.110.2.4/_config/admins/admin -d 
> '"password"'
> {code}
> 2. Execute:
> {code}
> curl -X PUT http://localhost:5984/_users/org.couchdb.user:afiskon \
>  -H "Accept: application/json" \
>  -H "Content-Type: application/json" \
>  -d '{"name": "afiskon", "password": "secret", "roles": [], "type": 
> "user"}'
> {code}
> Expected behavior:
> {code}
> {"error":"unauthorized","reason":"You are not a server admin."}
> {code}
> ( User should not be created since no admin username and password were 
> provided. )
> Actual behavior:
> {code}
> {"ok":true,"id":"org.couchdb.user:afiskon","rev":"1-ed29e6531747deca44fad127b033fe59"}
> {code}
> Affected version:
> CouchDB 2.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (COUCHDB-3156) Users could be created by anyone (missing authorization for /_users/* endpoint)

2016-09-22 Thread Aleksander Alekseev (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15514088#comment-15514088
 ] 

Aleksander Alekseev commented on COUCHDB-3156:
--

[~kxepal] There is no such feature in CouchDB. Documentation section 1.6.2 
clearly describes what this API should and shouldn't do 
http://docs.couchdb.org/en/latest/intro/security.html . If bug exists for many 
years in a project it doesn't make it a right behavior. It also doesn't make 
sense to deny everyone to create databases and documents (it's what CouchDB 
currently does after creation of the first admin) and allow to create as many 
users as you want.

> Users could be created by anyone (missing authorization for /_users/* 
> endpoint)
> ---
>
> Key: COUCHDB-3156
> URL: https://issues.apache.org/jira/browse/COUCHDB-3156
> Project: CouchDB
>  Issue Type: Bug
>  Components: HTTP Interface
>Reporter: Aleksander Alekseev
>Priority: Critical
>
> Steps to reproduce:
> 1. Configure a 3-node cluster (not sure if it also reproduces on a 
> single-node setup), make sure you've created an admin user:
> {code}
> curl -X PUT 
> http://127.0.0.1:5984/_node/couchdb@10.110.2.4/_config/admins/admin -d 
> '"password"'
> {code}
> 2. Execute:
> {code}
> curl -X PUT http://localhost:5984/_users/org.couchdb.user:afiskon \
>  -H "Accept: application/json" \
>  -H "Content-Type: application/json" \
>  -d '{"name": "afiskon", "password": "secret", "roles": [], "type": 
> "user"}'
> {code}
> Expected behavior:
> {code}
> {"error":"unauthorized","reason":"You are not a server admin."}
> {code}
> ( User should not be created since no admin username and password were 
> provided. )
> Actual behavior:
> {code}
> {"ok":true,"id":"org.couchdb.user:afiskon","rev":"1-ed29e6531747deca44fad127b033fe59"}
> {code}
> Affected version:
> CouchDB 2.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (COUCHDB-3156) Users could be created by anyone (missing authorization for /_users/* endpoint)

2016-09-22 Thread Alexander Shorin (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15514030#comment-15514030
 ] 

Alexander Shorin commented on COUCHDB-3156:
---

Vote for closing as Won't Fix or reclassify into Feature request.

Regular users can be created by anyone. That's behaviour since very first 
CouchDB releases when you can sign up and do the stuff. 

The behaviour you want to achieve was always controlled by 
[couch_httpd_auth/require_valid_user|http://docs.couchdb.org/en/latest/config/auth.html#couch_httpd_auth/require_valid_user]
 option which eventually require you to login first to be able call any CouchDB 
API. So, initially, only admins can create users. Other users may register else 
users. No users may set custom roles to bypass database role-based security.

However, there indeed could be setup when only admins should create users. Say, 
some public service with restricted membership. Then, it's all about special 
option that controls _users auth level.

Correct me if I get you wrong.

> Users could be created by anyone (missing authorization for /_users/* 
> endpoint)
> ---
>
> Key: COUCHDB-3156
> URL: https://issues.apache.org/jira/browse/COUCHDB-3156
> Project: CouchDB
>  Issue Type: Bug
>  Components: HTTP Interface
>Reporter: Aleksander Alekseev
>Priority: Critical
>
> Steps to reproduce:
> 1. Configure a 3-node cluster (not sure if it also reproduces on a 
> single-node setup), make sure you've created an admin user:
> {code}
> curl -X PUT 
> http://127.0.0.1:5984/_node/couchdb@10.110.2.4/_config/admins/admin -d 
> '"password"'
> {code}
> 2. Execute:
> {code}
> curl -X PUT http://localhost:5984/_users/org.couchdb.user:afiskon \
>  -H "Accept: application/json" \
>  -H "Content-Type: application/json" \
>  -d '{"name": "afiskon", "password": "secret", "roles": [], "type": 
> "user"}'
> {code}
> Expected behavior:
> {code}
> {"error":"unauthorized","reason":"You are not a server admin."}
> {code}
> ( User should not be created since no admin username and password were 
> provided. )
> Actual behavior:
> {code}
> {"ok":true,"id":"org.couchdb.user:afiskon","rev":"1-ed29e6531747deca44fad127b033fe59"}
> {code}
> Affected version:
> CouchDB 2.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (COUCHDB-3156) Users could be created by anyone (missing authorization for /_users/* endpoint)

2016-09-22 Thread Aleksander Alekseev (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15513925#comment-15513925
 ] 

Aleksander Alekseev commented on COUCHDB-3156:
--

[~wohali] I'm afraid it's not. Here are my exact steps (fortunately I have a 
habit to record such things).

On every node modify /home/couchdb/etc/vm.args like this (ip is different for 
every node):
{code}
-name couchdb@10.110.2.4
-setcookie eY2chohl4siecaib
{code}

Restart all nodes:

{code}
sudo sv restart couchdb
{code}

(!) Create admin user on every node and change bind address:

{code}
curl -X PUT http://127.0.0.1:5984/_node/couchdb@10.110.2.4/_config/admins/admin 
-d '"password"'
curl -X PUT 
http://127.0.0.1:5984/_node/couchdb@10.110.2.4/_config/chttpd/bind_address -d 
'"0.0.0.0"' --user admin
{code}

Join nodes into a cluster. For this on one node I did the following for every 
other node:

{code}
curl -X POST -H "Content-Type: application/json" 
http://127.0.0.1:5984/_cluster_setup -d '{"action": "enable_cluster", 
"bind_address":"0.0.0.0", "username": "admin", "password":"password", "port": 
5984, "remote_node": "10.110.2.5", "remote_current_user": "admin", 
"remote_current_password": "password" }' --user admin

curl -X POST -H "Content-Type: application/json" 
http://127.0.0.1:5984/_cluster_setup -d '{"action": "add_node", 
"host":"10.110.2.7", "port": "5984", "username": "admin", 
"password":"password"}' --user admin
{code}

When all nodes added:

{code}
curl -X POST -H "Content-Type: application/json" 
http://127.0.0.1:5984/_cluster_setup -d '{"action": "finish_cluster"}' --user 
admin
{code}

Re-check that all nodes are in the cluster:

{code}
curl -X GET http://localhost:5984/_membership --user admin
{code}

Next steps - see above.
Previous steps (installing CouchDB) - see 
https://github.com/afiskon/install-couchdb

OS: Ubuntu 16.04 x64. 

> Users could be created by anyone (missing authorization for /_users/* 
> endpoint)
> ---
>
> Key: COUCHDB-3156
> URL: https://issues.apache.org/jira/browse/COUCHDB-3156
> Project: CouchDB
>  Issue Type: Bug
>  Components: HTTP Interface
>Reporter: Aleksander Alekseev
>Priority: Critical
>
> Steps to reproduce:
> 1. Configure a 3-node cluster (not sure if it also reproduces on a 
> single-node setup), make sure you've created an admin user:
> {code}
> curl -X PUT 
> http://127.0.0.1:5984/_node/couchdb@10.110.2.4/_config/admins/admin -d 
> '"password"'
> {code}
> 2. Execute:
> {code}
> curl -X PUT http://localhost:5984/_users/org.couchdb.user:afiskon \
>  -H "Accept: application/json" \
>  -H "Content-Type: application/json" \
>  -d '{"name": "afiskon", "password": "secret", "roles": [], "type": 
> "user"}'
> {code}
> Expected behavior:
> {code}
> {"error":"unauthorized","reason":"You are not a server admin."}
> {code}
> ( User should not be created since no admin username and password were 
> provided. )
> Actual behavior:
> {code}
> {"ok":true,"id":"org.couchdb.user:afiskon","rev":"1-ed29e6531747deca44fad127b033fe59"}
> {code}
> Affected version:
> CouchDB 2.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (COUCHDB-3157) Incorrect URI for attachment to document with slash in id

2016-09-22 Thread Max Chase (JIRA)
Max Chase created COUCHDB-3157:
--

 Summary: Incorrect URI for attachment to document with slash in id
 Key: COUCHDB-3157
 URL: https://issues.apache.org/jira/browse/COUCHDB-3157
 Project: CouchDB
  Issue Type: Bug
  Components: Fauxton
Reporter: Max Chase


This is similar to COUCHDB-3146.

I have a db with custom ids that include a slash. (e.g. "gallery/img"). These 
documents have image attachments, and Fauxton generates URIs in the attachment 
dropdown, of the form "gallery/img/img" rather than "gallery%2Fimg/img", which 
works.

I encountered this on a db replicated from 1.6.1, which did not exhibit this 
issue in Futon, and reproduced it with a new document in another db.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (COUCHDB-3156) Users could be created by anyone (missing authorization for /_users/* endpoint)

2016-09-22 Thread Joan Touzet (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15513756#comment-15513756
 ] 

Joan Touzet commented on COUCHDB-3156:
--

This is a configuration error.

Admins are created node-local. You have only created the admin user on a single 
node. You must repeat your step 1 on all 3 nodes in the cluster (replacing 
couchdb@10.110.2.4 with the node ID of the other 2 nodes).

If you do this and you can still reproduce the problem, then there may be an 
issue.

> Users could be created by anyone (missing authorization for /_users/* 
> endpoint)
> ---
>
> Key: COUCHDB-3156
> URL: https://issues.apache.org/jira/browse/COUCHDB-3156
> Project: CouchDB
>  Issue Type: Bug
>  Components: HTTP Interface
>Reporter: Aleksander Alekseev
>Priority: Critical
>
> Steps to reproduce:
> 1. Configure a 3-node cluster (not sure if it also reproduces on a 
> single-node setup), make sure you've created an admin user:
> {code}
> curl -X PUT 
> http://127.0.0.1:5984/_node/couchdb@10.110.2.4/_config/admins/admin -d 
> '"password"'
> {code}
> 2. Execute:
> {code}
> curl -X PUT http://localhost:5984/_users/org.couchdb.user:afiskon \
>  -H "Accept: application/json" \
>  -H "Content-Type: application/json" \
>  -d '{"name": "afiskon", "password": "secret", "roles": [], "type": 
> "user"}'
> {code}
> Expected behavior:
> {code}
> {"error":"unauthorized","reason":"You are not a server admin."}
> {code}
> ( User should not be created since no admin username and password were 
> provided. )
> Actual behavior:
> {code}
> {"ok":true,"id":"org.couchdb.user:afiskon","rev":"1-ed29e6531747deca44fad127b033fe59"}
> {code}
> Affected version:
> CouchDB 2.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (COUCHDB-3156) Users could be created by anyone (missing authorization for /_users/* endpoint)

2016-09-22 Thread Aleksander Alekseev (JIRA)
Aleksander Alekseev created COUCHDB-3156:


 Summary: Users could be created by anyone (missing authorization 
for /_users/* endpoint)
 Key: COUCHDB-3156
 URL: https://issues.apache.org/jira/browse/COUCHDB-3156
 Project: CouchDB
  Issue Type: Bug
  Components: HTTP Interface
Reporter: Aleksander Alekseev


Steps to reproduce:

1. Configure a 3-node cluster (not sure if it also reproduces on a single-node 
setup), make sure you've created an admin user:

{code}
curl -X PUT http://127.0.0.1:5984/_node/couchdb@10.110.2.4/_config/admins/admin 
-d '"password"'
{code}

2. Execute:

{code}
curl -X PUT http://localhost:5984/_users/org.couchdb.user:afiskon \
 -H "Accept: application/json" \
 -H "Content-Type: application/json" \
 -d '{"name": "afiskon", "password": "secret", "roles": [], "type": "user"}'
{code}

Expected behavior:

User should not be created since no admin username and password were provided.

Actual behavior:

{code}
{"ok":true,"id":"org.couchdb.user:afiskon","rev":"1-ed29e6531747deca44fad127b033fe59"}
{code}

Affected version:

CouchDB 2.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread brkolla
Github user brkolla commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80078401
  
--- Diff: src/fabric_view.erl ---
@@ -308,6 +308,23 @@ get_shards(DbName, #mrargs{stale=Stale})
 get_shards(DbName, #mrargs{stale=false}) ->
 mem3:shards(DbName).
 
+maybe_update_others(DbName, DDoc, ShardsInvolved, ViewName,
+#mrargs{stale=update_after} = Args) ->
+ShardsNeedUpdated = mem3:shards(DbName) -- ShardsInvolved,
+lists:foreach(fun(#shard{node=Node, name=ShardName}) ->
+rpc:cast(Node, fabric_view, maybe_update, [ShardName, DDoc, 
ViewName, Args])
--- End diff --

Done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch-mrview issue #57: Add new function to get the view index pid.

2016-09-22 Thread brkolla
Github user brkolla commented on the issue:

https://github.com/apache/couchdb-couch-mrview/pull/57
  
@rnewson @davisp. Can you please review this too. This change is also 
related to triggering an update with stale=update_after


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread brkolla
Github user brkolla commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80068121
  
--- Diff: src/fabric_view.erl ---
@@ -308,6 +308,23 @@ get_shards(DbName, #mrargs{stale=Stale})
 get_shards(DbName, #mrargs{stale=false}) ->
 mem3:shards(DbName).
 
+maybe_update_others(DbName, DDoc, ShardsInvolved, ViewName,
+#mrargs{stale=update_after} = Args) ->
+ShardsNeedUpdated = mem3:shards(DbName) -- ShardsInvolved,
+lists:foreach(fun(#shard{node=Node, name=ShardName}) ->
+rpc:cast(Node, fabric_view, maybe_update, [ShardName, DDoc, 
ViewName, Args])
+end, ShardsNeedUpdated).
+
+maybe_update(DbName, {DDocId, Rev}, ViewName, Args0) ->
+{ok, Db} = couch_db:open_int(DbName, []),
+DbUpdateSeq = couch_util:with_db(Db, fun(WDb) ->
--- End diff --

Done. Thx


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch issue #185: 3061 adaptive header search

2016-09-22 Thread theburge
Github user theburge commented on the issue:

https://github.com/apache/couchdb-couch/pull/185
  
Thanks for doing the additional investigation @jaydoane. I'm glad the 
performance remains consistently improved.

From memory, I've observed deeply buried headers frequently in MT, although 
admittedly not lots at once (usually a DB or two). However, they're not only on 
.meta files if memory serves, but also on view files (and I'm fairly sure on 
primary database files, although IIRC usually in correlation with some other 
odd behaviour -- so perhaps it shouldn't be considered _normal_ but it's 
certainly possible).

In any case, it's reassuring that the vectored approach is only tried if 
the basic approach fails, given the striking difference in page-in rate.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80063112
  
--- Diff: src/couch_file.erl ---
@@ -531,27 +537,96 @@ find_header(Fd, Block) ->
 {ok, Bin} ->
 {ok, Bin};
 _Error ->
-find_header(Fd, Block -1)
+find_header_pread2(Fd, Block -1)
 end.
 
 load_header(Fd, Block) ->
 {ok, <<1, HeaderLen:32/integer, RestBlock/binary>>} =
 file:pread(Fd, Block * ?SIZE_BLOCK, ?SIZE_BLOCK),
-TotalBytes = calculate_total_read_len(5, HeaderLen),
-case TotalBytes > byte_size(RestBlock) of
+TotalSize = total_read_size(5, HeaderLen),
+case TotalSize > byte_size(RestBlock) of
 false ->
-<> = RestBlock;
+<> = RestBlock;
 true ->
 {ok, Missing} = file:pread(
 Fd, (Block * ?SIZE_BLOCK) + 5 + byte_size(RestBlock),
-TotalBytes - byte_size(RestBlock)),
+TotalSize - byte_size(RestBlock)),
 RawBin = <>
 end,
 <> =
 iolist_to_binary(remove_block_prefixes(5, RawBin)),
 Md5Sig = couch_crypto:hash(md5, HeaderBin),
 {ok, HeaderBin}.
 
+
+%% Read a configurable number of block locations at a time using
+%% file:pread/2.  At each block location, read ?PREFIX_SIZE (5) bytes;
+%% if the first byte is <<1>>, assume it's a header block, and the
+%% next 4 bytes hold the size of the header.
+-spec find_header_pread2(file:fd(), block_id()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(Fd, Block) ->
+find_header_pread2(Fd, Block, read_count()).
+
+-spec find_header_pread2(file:fd(), block_id(), non_neg_integer()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(_Fd, Block, _ReadCount) when Block < 0 ->
+no_valid_header;
+find_header_pread2(Fd, Block, ReadCount) ->
+Locations = block_locations(Block, ReadCount),
+{ok, DataL} = file:pread(Fd, [{L, ?PREFIX_SIZE} || L <- Locations]),
+case locate_header(Fd, header_locations(Locations, DataL)) of
--- End diff --

Or `find_newest_valid_header/2` of course.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80063047
  
--- Diff: src/couch_file.erl ---
@@ -531,27 +537,96 @@ find_header(Fd, Block) ->
 {ok, Bin} ->
 {ok, Bin};
 _Error ->
-find_header(Fd, Block -1)
+find_header_pread2(Fd, Block -1)
 end.
 
 load_header(Fd, Block) ->
 {ok, <<1, HeaderLen:32/integer, RestBlock/binary>>} =
 file:pread(Fd, Block * ?SIZE_BLOCK, ?SIZE_BLOCK),
-TotalBytes = calculate_total_read_len(5, HeaderLen),
-case TotalBytes > byte_size(RestBlock) of
+TotalSize = total_read_size(5, HeaderLen),
+case TotalSize > byte_size(RestBlock) of
 false ->
-<> = RestBlock;
+<> = RestBlock;
 true ->
 {ok, Missing} = file:pread(
 Fd, (Block * ?SIZE_BLOCK) + 5 + byte_size(RestBlock),
-TotalBytes - byte_size(RestBlock)),
+TotalSize - byte_size(RestBlock)),
 RawBin = <>
 end,
 <> =
 iolist_to_binary(remove_block_prefixes(5, RawBin)),
 Md5Sig = couch_crypto:hash(md5, HeaderBin),
 {ok, HeaderBin}.
 
+
+%% Read a configurable number of block locations at a time using
+%% file:pread/2.  At each block location, read ?PREFIX_SIZE (5) bytes;
+%% if the first byte is <<1>>, assume it's a header block, and the
+%% next 4 bytes hold the size of the header.
+-spec find_header_pread2(file:fd(), block_id()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(Fd, Block) ->
+find_header_pread2(Fd, Block, read_count()).
+
+-spec find_header_pread2(file:fd(), block_id(), non_neg_integer()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(_Fd, Block, _ReadCount) when Block < 0 ->
+no_valid_header;
+find_header_pread2(Fd, Block, ReadCount) ->
+Locations = block_locations(Block, ReadCount),
+{ok, DataL} = file:pread(Fd, [{L, ?PREFIX_SIZE} || L <- Locations]),
+case locate_header(Fd, header_locations(Locations, DataL)) of
--- End diff --

@rnewson points out that find_first_valid_header/2 is ambiguous since it 
depends on the order of the list (specifically, the "first" bit). Bouncing 
ideas around we came up with `find_newest_header/2` which matches the intent a 
lot better.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80062260
  
--- Diff: src/fabric_view.erl ---
@@ -308,6 +308,23 @@ get_shards(DbName, #mrargs{stale=Stale})
 get_shards(DbName, #mrargs{stale=false}) ->
 mem3:shards(DbName).
 
+maybe_update_others(DbName, DDoc, ShardsInvolved, ViewName,
+#mrargs{stale=update_after} = Args) ->
+ShardsNeedUpdated = mem3:shards(DbName) -- ShardsInvolved,
+lists:foreach(fun(#shard{node=Node, name=ShardName}) ->
+rpc:cast(Node, fabric_view, maybe_update, [ShardName, DDoc, 
ViewName, Args])
--- End diff --

Good idea.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80061848
  
--- Diff: src/fabric_view.erl ---
@@ -308,6 +308,23 @@ get_shards(DbName, #mrargs{stale=Stale})
 get_shards(DbName, #mrargs{stale=false}) ->
 mem3:shards(DbName).
 
+maybe_update_others(DbName, DDoc, ShardsInvolved, ViewName,
+#mrargs{stale=update_after} = Args) ->
+ShardsNeedUpdated = mem3:shards(DbName) -- ShardsInvolved,
+lists:foreach(fun(#shard{node=Node, name=ShardName}) ->
+rpc:cast(Node, fabric_view, maybe_update, [ShardName, DDoc, 
ViewName, Args])
+end, ShardsNeedUpdated).
+
+maybe_update(DbName, {DDocId, Rev}, ViewName, Args0) ->
+{ok, Db} = couch_db:open_int(DbName, []),
+DbUpdateSeq = couch_util:with_db(Db, fun(WDb) ->
--- End diff --

Also, the name of this function is a lie. You just want to rename it 
"update_mrview" or similar.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80061693
  
--- Diff: src/fabric_view.erl ---
@@ -308,6 +308,23 @@ get_shards(DbName, #mrargs{stale=Stale})
 get_shards(DbName, #mrargs{stale=false}) ->
 mem3:shards(DbName).
 
+maybe_update_others(DbName, DDoc, ShardsInvolved, ViewName,
+#mrargs{stale=update_after} = Args) ->
+ShardsNeedUpdated = mem3:shards(DbName) -- ShardsInvolved,
+lists:foreach(fun(#shard{node=Node, name=ShardName}) ->
+rpc:cast(Node, fabric_view, maybe_update, [ShardName, DDoc, 
ViewName, Args])
+end, ShardsNeedUpdated).
+
+maybe_update(DbName, {DDocId, Rev}, ViewName, Args0) ->
+{ok, Db} = couch_db:open_int(DbName, []),
+DbUpdateSeq = couch_util:with_db(Db, fun(WDb) ->
--- End diff --

This is a bug. with_db/2 takes a DbName. You want to do something like:

```erlang
{ok, DDoc} = ddoc_cache:open_doc(...)
Pid = couch_util:with_db(DbName, fun(Db) ->
UpdateSeq = couch_db:get_update_seq(Db),
{ok, Pid, _} = couch_mrview_util:get_view_index_pid(...),
Pid
end),
couch_index:get_state(Pid, DbUpdateSeq),
ok.
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80055158
  
--- Diff: src/couch_file.erl ---
@@ -16,13 +16,18 @@
 
 -include_lib("couch/include/couch_db.hrl").
 
-
--- End diff --

Remove whitespace only changes


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80058806
  
--- Diff: src/couch_file.erl ---
@@ -531,27 +537,96 @@ find_header(Fd, Block) ->
 {ok, Bin} ->
 {ok, Bin};
 _Error ->
-find_header(Fd, Block -1)
+find_header_pread2(Fd, Block -1)
 end.
 
 load_header(Fd, Block) ->
 {ok, <<1, HeaderLen:32/integer, RestBlock/binary>>} =
 file:pread(Fd, Block * ?SIZE_BLOCK, ?SIZE_BLOCK),
-TotalBytes = calculate_total_read_len(5, HeaderLen),
-case TotalBytes > byte_size(RestBlock) of
+TotalSize = total_read_size(5, HeaderLen),
+case TotalSize > byte_size(RestBlock) of
 false ->
-<> = RestBlock;
+<> = RestBlock;
 true ->
 {ok, Missing} = file:pread(
 Fd, (Block * ?SIZE_BLOCK) + 5 + byte_size(RestBlock),
-TotalBytes - byte_size(RestBlock)),
+TotalSize - byte_size(RestBlock)),
 RawBin = <>
 end,
 <> =
 iolist_to_binary(remove_block_prefixes(5, RawBin)),
 Md5Sig = couch_crypto:hash(md5, HeaderBin),
 {ok, HeaderBin}.
 
+
+%% Read a configurable number of block locations at a time using
+%% file:pread/2.  At each block location, read ?PREFIX_SIZE (5) bytes;
+%% if the first byte is <<1>>, assume it's a header block, and the
+%% next 4 bytes hold the size of the header.
+-spec find_header_pread2(file:fd(), block_id()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(Fd, Block) ->
+find_header_pread2(Fd, Block, read_count()).
+
+-spec find_header_pread2(file:fd(), block_id(), non_neg_integer()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(_Fd, Block, _ReadCount) when Block < 0 ->
+no_valid_header;
+find_header_pread2(Fd, Block, ReadCount) ->
+Locations = block_locations(Block, ReadCount),
+{ok, DataL} = file:pread(Fd, [{L, ?PREFIX_SIZE} || L <- Locations]),
+case locate_header(Fd, header_locations(Locations, DataL)) of
--- End diff --

There's a lot going on in this line. I'd inline header_locations since its 
also only used once and put a pretty big explanatory comment on how that works. 
Its super subtle that you're relying on the lists:foldl/3 down below to reverse 
your list of locations passed to locate_header/2.

Also, we should rename locate_header/2 to something like 
find_first_valid_header/2. Locate and load seem awfully close that my brain 
seems to lose the semantic difference as I review this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80057370
  
--- Diff: src/couch_file.erl ---
@@ -531,27 +537,96 @@ find_header(Fd, Block) ->
 {ok, Bin} ->
 {ok, Bin};
 _Error ->
-find_header(Fd, Block -1)
+find_header_pread2(Fd, Block -1)
 end.
 
 load_header(Fd, Block) ->
 {ok, <<1, HeaderLen:32/integer, RestBlock/binary>>} =
 file:pread(Fd, Block * ?SIZE_BLOCK, ?SIZE_BLOCK),
-TotalBytes = calculate_total_read_len(5, HeaderLen),
-case TotalBytes > byte_size(RestBlock) of
+TotalSize = total_read_size(5, HeaderLen),
+case TotalSize > byte_size(RestBlock) of
 false ->
-<> = RestBlock;
+<> = RestBlock;
 true ->
 {ok, Missing} = file:pread(
 Fd, (Block * ?SIZE_BLOCK) + 5 + byte_size(RestBlock),
-TotalBytes - byte_size(RestBlock)),
+TotalSize - byte_size(RestBlock)),
 RawBin = <>
 end,
 <> =
 iolist_to_binary(remove_block_prefixes(5, RawBin)),
 Md5Sig = couch_crypto:hash(md5, HeaderBin),
 {ok, HeaderBin}.
 
+
+%% Read a configurable number of block locations at a time using
+%% file:pread/2.  At each block location, read ?PREFIX_SIZE (5) bytes;
+%% if the first byte is <<1>>, assume it's a header block, and the
+%% next 4 bytes hold the size of the header.
+-spec find_header_pread2(file:fd(), block_id()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(Fd, Block) ->
+find_header_pread2(Fd, Block, read_count()).
+
+-spec find_header_pread2(file:fd(), block_id(), non_neg_integer()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(_Fd, Block, _ReadCount) when Block < 0 ->
+no_valid_header;
+find_header_pread2(Fd, Block, ReadCount) ->
+Locations = block_locations(Block, ReadCount),
+{ok, DataL} = file:pread(Fd, [{L, ?PREFIX_SIZE} || L <- Locations]),
+case locate_header(Fd, header_locations(Locations, DataL)) of
+{ok, _Location, HeaderBin} ->
+io:format("header at block ~p~n", [_Location div 
?SIZE_BLOCK]), % TEMP
--- End diff --

Remove debug logging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80057664
  
--- Diff: src/couch_file.erl ---
@@ -531,27 +537,96 @@ find_header(Fd, Block) ->
 {ok, Bin} ->
 {ok, Bin};
 _Error ->
-find_header(Fd, Block -1)
+find_header_pread2(Fd, Block -1)
 end.
 
 load_header(Fd, Block) ->
 {ok, <<1, HeaderLen:32/integer, RestBlock/binary>>} =
 file:pread(Fd, Block * ?SIZE_BLOCK, ?SIZE_BLOCK),
-TotalBytes = calculate_total_read_len(5, HeaderLen),
-case TotalBytes > byte_size(RestBlock) of
+TotalSize = total_read_size(5, HeaderLen),
+case TotalSize > byte_size(RestBlock) of
 false ->
-<> = RestBlock;
+<> = RestBlock;
 true ->
 {ok, Missing} = file:pread(
 Fd, (Block * ?SIZE_BLOCK) + 5 + byte_size(RestBlock),
-TotalBytes - byte_size(RestBlock)),
+TotalSize - byte_size(RestBlock)),
 RawBin = <>
 end,
 <> =
 iolist_to_binary(remove_block_prefixes(5, RawBin)),
 Md5Sig = couch_crypto:hash(md5, HeaderBin),
 {ok, HeaderBin}.
 
+
+%% Read a configurable number of block locations at a time using
+%% file:pread/2.  At each block location, read ?PREFIX_SIZE (5) bytes;
+%% if the first byte is <<1>>, assume it's a header block, and the
+%% next 4 bytes hold the size of the header.
+-spec find_header_pread2(file:fd(), block_id()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(Fd, Block) ->
+find_header_pread2(Fd, Block, read_count()).
+
+-spec find_header_pread2(file:fd(), block_id(), non_neg_integer()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(_Fd, Block, _ReadCount) when Block < 0 ->
+no_valid_header;
+find_header_pread2(Fd, Block, ReadCount) ->
+Locations = block_locations(Block, ReadCount),
--- End diff --

block_locations is a trivial funciton that's only used once. You should 
inline it here so that we don't have to reference back and forth as the 
ordering is important so having that here would be more useful.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80057274
  
--- Diff: src/couch_file.erl ---
@@ -531,27 +537,96 @@ find_header(Fd, Block) ->
 {ok, Bin} ->
 {ok, Bin};
 _Error ->
-find_header(Fd, Block -1)
+find_header_pread2(Fd, Block -1)
--- End diff --

Rename find_header_pread2 to find_header and then just call the 
find_header/3 version directly (and remove find_header_pread2/2). Alsos move 
that function to below this one so the ordering makes more sense.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80059337
  
--- Diff: src/couch_file.erl ---
@@ -531,27 +537,96 @@ find_header(Fd, Block) ->
 {ok, Bin} ->
 {ok, Bin};
 _Error ->
-find_header(Fd, Block -1)
+find_header_pread2(Fd, Block -1)
 end.
 
 load_header(Fd, Block) ->
 {ok, <<1, HeaderLen:32/integer, RestBlock/binary>>} =
 file:pread(Fd, Block * ?SIZE_BLOCK, ?SIZE_BLOCK),
-TotalBytes = calculate_total_read_len(5, HeaderLen),
-case TotalBytes > byte_size(RestBlock) of
+TotalSize = total_read_size(5, HeaderLen),
+case TotalSize > byte_size(RestBlock) of
 false ->
-<> = RestBlock;
+<> = RestBlock;
 true ->
 {ok, Missing} = file:pread(
 Fd, (Block * ?SIZE_BLOCK) + 5 + byte_size(RestBlock),
-TotalBytes - byte_size(RestBlock)),
+TotalSize - byte_size(RestBlock)),
 RawBin = <>
 end,
 <> =
 iolist_to_binary(remove_block_prefixes(5, RawBin)),
 Md5Sig = couch_crypto:hash(md5, HeaderBin),
 {ok, HeaderBin}.
 
+
+%% Read a configurable number of block locations at a time using
+%% file:pread/2.  At each block location, read ?PREFIX_SIZE (5) bytes;
+%% if the first byte is <<1>>, assume it's a header block, and the
+%% next 4 bytes hold the size of the header.
+-spec find_header_pread2(file:fd(), block_id()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(Fd, Block) ->
+find_header_pread2(Fd, Block, read_count()).
+
+-spec find_header_pread2(file:fd(), block_id(), non_neg_integer()) ->
+{ok, binary()} | no_valid_header.
+find_header_pread2(_Fd, Block, _ReadCount) when Block < 0 ->
+no_valid_header;
+find_header_pread2(Fd, Block, ReadCount) ->
+Locations = block_locations(Block, ReadCount),
+{ok, DataL} = file:pread(Fd, [{L, ?PREFIX_SIZE} || L <- Locations]),
+case locate_header(Fd, header_locations(Locations, DataL)) of
+{ok, _Location, HeaderBin} ->
+io:format("header at block ~p~n", [_Location div 
?SIZE_BLOCK]), % TEMP
+{ok, HeaderBin};
+_ ->
+ok = file:advise(
+Fd, hd(Locations), ReadCount * ?SIZE_BLOCK, dont_need),
+NextBlock = hd(Locations) div ?SIZE_BLOCK - 1,
+find_header_pread2(Fd, NextBlock, ReadCount)
+end.
+
+-spec read_count() -> non_neg_integer().
+read_count() ->
+config:get_integer("couchdb", "find_header_read_count", 
?DEFAULT_READ_COUNT).
+
+-spec block_locations(block_id(), non_neg_integer()) -> [location()].
+block_locations(Block, ReadCount) ->
+First = max(0, Block - ReadCount + 1),
+[?SIZE_BLOCK*B || B <- lists:seq(First, Block)].
+
+-spec header_locations([location()], [data()]) -> [{location(), 
header_size()}].
+header_locations(Locations, DataL) ->
+lists:foldl(fun
+({Loc, <<1, HeaderSize:32/integer>>}, Acc) ->
+[{Loc, HeaderSize} | Acc];
+(_, Acc) ->
+Acc
+end, [], lists:zip(Locations, DataL)).
+
+-spec locate_header(file:fd(), [{location(), header_size()}]) ->
+{ok, binary()} | not_found.
+locate_header(_Fd, []) ->
+not_found;
+locate_header(Fd, [{Location, Size}|LocationSizes]) ->
+case (catch load_header(Fd, Location, Size)) of
+{ok, HeaderBin} ->
+{ok, Location, HeaderBin};
+_Error ->
+locate_header(Fd, LocationSizes)
+end.
+
+-spec load_header(file:fd(), location(), header_size()) ->
+{ok, binary()} | no_return().
+load_header(Fd, Location, Size) ->
--- End diff --

You should move this function up under load_header/2 and then rearrange 
load_header/2 so that it calls this function. Scrolling back and forth between 
the two trying to figure out the difference was quite confusing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80056486
  
--- Diff: src/couch_file.erl ---
@@ -531,27 +537,96 @@ find_header(Fd, Block) ->
 {ok, Bin} ->
 {ok, Bin};
 _Error ->
-find_header(Fd, Block -1)
+find_header_pread2(Fd, Block -1)
 end.
 
 load_header(Fd, Block) ->
 {ok, <<1, HeaderLen:32/integer, RestBlock/binary>>} =
 file:pread(Fd, Block * ?SIZE_BLOCK, ?SIZE_BLOCK),
-TotalBytes = calculate_total_read_len(5, HeaderLen),
--- End diff --

Undo the part of this PR that renames calculate_total_read_len to 
total_read_size. Its not a behavior change and shouldn't be included with this 
change as it just makes things harder to comprehend when looking through the 
history. If you feel strongly about it we can open another PR with this change 
for a separate readability improvement.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80055417
  
--- Diff: src/couch_file.erl ---
@@ -16,13 +16,18 @@
 
 -include_lib("couch/include/couch_db.hrl").
 
-
 -define(INITIAL_WAIT, 6).
 -define(MONITOR_CHECK, 1).
 -define(SIZE_BLOCK, 16#1000). % 4 KiB
 -define(READ_AHEAD, 2 * ?SIZE_BLOCK).
 -define(IS_OLD_STATE(S), tuple_size(S) /= tuple_size(#file{})).
+-define(PREFIX_SIZE, 5).
+-define(DEFAULT_READ_COUNT, 1024).
 
+-type block_id() :: non_neg_integer().
+-type location() :: non_neg_integer().
+-type data() :: string() | binary() | eof.
+-type header_size() :: non_neg_integer().
--- End diff --

I'm personally not a fan of specs for module private functions but I won't 
go so far as to say to remove them.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80056738
  
--- Diff: src/couch_file.erl ---
@@ -531,27 +537,96 @@ find_header(Fd, Block) ->
 {ok, Bin} ->
 {ok, Bin};
 _Error ->
-find_header(Fd, Block -1)
+find_header_pread2(Fd, Block -1)
 end.
 
 load_header(Fd, Block) ->
 {ok, <<1, HeaderLen:32/integer, RestBlock/binary>>} =
 file:pread(Fd, Block * ?SIZE_BLOCK, ?SIZE_BLOCK),
-TotalBytes = calculate_total_read_len(5, HeaderLen),
-case TotalBytes > byte_size(RestBlock) of
+TotalSize = total_read_size(5, HeaderLen),
+case TotalSize > byte_size(RestBlock) of
 false ->
-<> = RestBlock;
+<> = RestBlock;
 true ->
 {ok, Missing} = file:pread(
 Fd, (Block * ?SIZE_BLOCK) + 5 + byte_size(RestBlock),
-TotalBytes - byte_size(RestBlock)),
+TotalSize - byte_size(RestBlock)),
 RawBin = <>
 end,
 <> =
 iolist_to_binary(remove_block_prefixes(5, RawBin)),
 Md5Sig = couch_crypto:hash(md5, HeaderBin),
 {ok, HeaderBin}.
 
+
+%% Read a configurable number of block locations at a time using
+%% file:pread/2.  At each block location, read ?PREFIX_SIZE (5) bytes;
+%% if the first byte is <<1>>, assume it's a header block, and the
+%% next 4 bytes hold the size of the header.
--- End diff --

There's no assumption here. A header is by definition at any 4K boundary 
where the first byte is a 1. If we try and load a header and fail there its 
because of some sort of file corruption.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch pull request #185: 3061 adaptive header search

2016-09-22 Thread davisp
Github user davisp commented on a diff in the pull request:

https://github.com/apache/couchdb-couch/pull/185#discussion_r80055495
  
--- Diff: src/couch_file.erl ---
@@ -40,6 +45,7 @@
 -export([append_term/2, append_term/3, append_term_md5/2, 
append_term_md5/3]).
 -export([write_header/2, read_header/1]).
 -export([delete/2, delete/3, nuke_dir/2, init_delete_dir/1]).
+-export([find_header/2]).
--- End diff --

Remove this since it was just for testing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric issue #70: Update all shards with stale=update_after

2016-09-22 Thread brkolla
Github user brkolla commented on the issue:

https://github.com/apache/couchdb-fabric/pull/70
  
Yes, this is my first code change in this area, so I was anticipating this 
discussion. Took me some time to understand all the internals.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread brkolla
Github user brkolla commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80054599
  
--- Diff: src/fabric_view.erl ---
@@ -308,6 +308,23 @@ get_shards(DbName, #mrargs{stale=Stale})
 get_shards(DbName, #mrargs{stale=false}) ->
 mem3:shards(DbName).
 
+maybe_update_others(DbName, DDoc, ShardsInvolved, ViewName,
+#mrargs{stale=update_after} = Args) ->
+ShardsNeedUpdated = mem3:shards(DbName) -- ShardsInvolved,
+lists:foreach(fun(#shard{node=Node, name=ShardName}) ->
+rpc:cast(Node, fabric_view, maybe_update, [ShardName, DDoc, 
ViewName, Args])
+end, ShardsNeedUpdated).
+
+maybe_update(DbName, {DDocId, Rev}, ViewName, Args0) ->
+{ok, Db} = couch_db:open_int(DbName, []),
+DbUpdateSeq = couch_util:with_db(Db, fun(WDb) ->
+couch_db:get_update_seq(WDb)
+end),
+{ok, DDoc} = ddoc_cache:open_doc(mem3:dbname(DbName), DDocId, Rev),
+{ok, Pid, _} = couch_mrview_util:get_view_index_pid(Db, DDoc, 
ViewName, Args0),
+spawn(fun() -> catch couch_index:get_state(Pid, DbUpdateSeq) end),
--- End diff --

Good point. Started with the idea of using call, but later changed to cast 
as we want to trigger an update and not really care about the result. Will take 
out the spawn and change that code to `couch_index:get_state(Pid, DbUpdateSeq)`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric issue #70: Update all shards with stale=update_after

2016-09-22 Thread rnewson
Github user rnewson commented on the issue:

https://github.com/apache/couchdb-fabric/pull/70
  
getting closer!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread rnewson
Github user rnewson commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80049231
  
--- Diff: src/fabric_view_map.erl ---
@@ -25,8 +25,10 @@ go(DbName, GroupId, View, Args, Callback, Acc, VInfo) 
when is_binary(GroupId) ->
 
 go(DbName, DDoc, View, Args, Callback, Acc, VInfo) ->
 Shards = fabric_view:get_shards(DbName, Args),
+DocIdAndRev = fabric_util:doc_id_and_rev(DDoc),
+fabric_view:maybe_update_others(DbName, DocIdAndRev, Shards, View, 
Args),
 Repls = fabric_view:get_shard_replacements(DbName, Shards),
-RPCArgs = [fabric_util:doc_id_and_rev(DDoc), View, Args],
+RPCArgs = [DocIdAndRev, View, Args],
--- End diff --

ah, no, I get you. fine.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread rnewson
Github user rnewson commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80049178
  
--- Diff: src/fabric_view_map.erl ---
@@ -25,8 +25,10 @@ go(DbName, GroupId, View, Args, Callback, Acc, VInfo) 
when is_binary(GroupId) ->
 
 go(DbName, DDoc, View, Args, Callback, Acc, VInfo) ->
 Shards = fabric_view:get_shards(DbName, Args),
+DocIdAndRev = fabric_util:doc_id_and_rev(DDoc),
+fabric_view:maybe_update_others(DbName, DocIdAndRev, Shards, View, 
Args),
 Repls = fabric_view:get_shard_replacements(DbName, Shards),
-RPCArgs = [fabric_util:doc_id_and_rev(DDoc), View, Args],
+RPCArgs = [DocIdAndRev, View, Args],
--- End diff --

this change seems unrelated to the problem.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread rnewson
Github user rnewson commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80048745
  
--- Diff: src/fabric_view.erl ---
@@ -308,6 +308,23 @@ get_shards(DbName, #mrargs{stale=Stale})
 get_shards(DbName, #mrargs{stale=false}) ->
 mem3:shards(DbName).
 
+maybe_update_others(DbName, DDoc, ShardsInvolved, ViewName,
+#mrargs{stale=update_after} = Args) ->
+ShardsNeedUpdated = mem3:shards(DbName) -- ShardsInvolved,
+lists:foreach(fun(#shard{node=Node, name=ShardName}) ->
+rpc:cast(Node, fabric_view, maybe_update, [ShardName, DDoc, 
ViewName, Args])
--- End diff --

@davisp what do you think to this? seems the kosher thing is to put 
maybe_update/4 into fabric_rpc.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread brkolla
Github user brkolla commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80047062
  
--- Diff: src/fabric_view.erl ---
@@ -308,6 +308,23 @@ get_shards(DbName, #mrargs{stale=Stale})
 get_shards(DbName, #mrargs{stale=false}) ->
 mem3:shards(DbName).
 
+maybe_update_others(DbName, DDoc, ShardsInvolved, ViewName, 
#mrargs{stale=Stale} = Args)
+  when Stale == update_after ->
--- End diff --

Done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric pull request #70: Update all shards with stale=update_after

2016-09-22 Thread rnewson
Github user rnewson commented on a diff in the pull request:

https://github.com/apache/couchdb-fabric/pull/70#discussion_r80038588
  
--- Diff: src/fabric_view.erl ---
@@ -308,6 +308,23 @@ get_shards(DbName, #mrargs{stale=Stale})
 get_shards(DbName, #mrargs{stale=false}) ->
 mem3:shards(DbName).
 
+maybe_update_others(DbName, DDoc, ShardsInvolved, ViewName, 
#mrargs{stale=Stale} = Args)
+  when Stale == update_after ->
--- End diff --

match this directly in the parameter list `#mrargs{stale=update_after} = 
Args`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #71: Minor grammar fix, git → Git

2016-09-22 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/couchdb-documentation/pull/71


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation issue #71: Minor grammar fix, git → Git

2016-09-22 Thread janl
Github user janl commented on the issue:

https://github.com/apache/couchdb-documentation/pull/71
  
+1



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #71: Minor grammar fix, git → Git

2016-09-22 Thread katsel
GitHub user katsel opened a pull request:

https://github.com/apache/couchdb-documentation/pull/71

Minor grammar fix, git → Git



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/katsel/couchdb-documentation typo-style-fixes

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-documentation/pull/71.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #71


commit 027315252a929cb118f0c812e9bdef74c613e657
Author: katsel 
Date:   2016-09-22T12:43:43Z

Minor grammar fix, git → Git




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation issue #69: Further improvements of "Installation on Un...

2016-09-22 Thread rnewson
Github user rnewson commented on the issue:

https://github.com/apache/couchdb-documentation/pull/69
  
thanks, +1. whoever is merging this, please squash to one commit beforehand.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation issue #69: Further improvements of "Installation on Un...

2016-09-22 Thread afiskon
Github user afiskon commented on the issue:

https://github.com/apache/couchdb-documentation/pull/69
  
@rnewson fixed. Although I removed hint regarding LXC/Docker/AMI, I hope 
you reconsider. I personally find this suggestion quite useful. This could be 
discussed in a separate PR though.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #70: Fix some typos and style in intro an...

2016-09-22 Thread katsel
GitHub user katsel opened a pull request:

https://github.com/apache/couchdb-documentation/pull/70

Fix some typos and style in intro and replication chapter

Hey,
while reading the docs I came up with some typo fixes and minor style 
improvements for the intro and replication chapter.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/katsel/couchdb-documentation typo-style-fixes

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-documentation/pull/70.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #70


commit 8f9d40a498f8dc3b6270c7b4fc9d070dba6fc0c0
Author: katsel 
Date:   2016-09-22T12:20:07Z

Fix some typos and style in intro and replication chapter




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation issue #70: Fix some typos and style in intro and repli...

2016-09-22 Thread janl
Github user janl commented on the issue:

https://github.com/apache/couchdb-documentation/pull/70
  
this should go live in a couple of minutes


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #70: Fix some typos and style in intro an...

2016-09-22 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/couchdb-documentation/pull/70


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation issue #70: Fix some typos and style in intro and repli...

2016-09-22 Thread janl
Github user janl commented on the issue:

https://github.com/apache/couchdb-documentation/pull/70
  
+1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread rnewson
Github user rnewson commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80018627
  
--- Diff: src/install/unix.rst ---
@@ -229,10 +233,66 @@ CouchDB no longer ships with any daemonization 
scripts.
 
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
-straightforward; if you have questions, reach out to the CouchDB
-user mailing list.
+straightforward; if you have questions, contact the CouchDB
+`user mailing list 
`_
+or `IRC-channel #couchdb `_
+in FreeNode network.
+
+Let's consider configuring runit on Ubuntu 16.04. The following
+steps should be considered only as an example. Details will vary
+by operating system and distribution. Check your system's package
+management tools for specifics.
+
+Install ruinit::
+
+sudo apt-get install runit
+   
+Create a directory where logs will be written::
+
+sudo mkdir /var/log/couchdb
+sudo chown couchdb:couchdb /var/log/couchdb
+   
+Create directories that will contain runit configuration for CouchDB::
+
+sudo mkdir /etc/sv/couchdb
+sudo mkdir /etc/sv/couchdb/log
+   
+Create /etc/sv/couchdb/log/run script::
+
+#!/bin/sh
+exec svlogd -tt /var/log/couchdb
+
+Basically it determines where and how exactly logs will be written.
+See ``man svlogd`` for more details.
+
+Create /etc/sv/couchdb/run::
+
+#!/bin/sh
+export HOME=/home/couchdb
+exec 2>&1
+exec chpst -u couchdb /home/couchdb/bin/couchdb
+
+This script determines how exactly CouchDB will be launched.
+Feel free to add any additional arguments and environment
+variables here if necessary.
+
+Make scripts executable::
+
+sudo chmod u+x /etc/sv/couchdb/log/run
+sudo chmod u+x /etc/sv/couchdb/run
+   
+Then run::
+
+sudo ln -s /etc/sv/couchdb/ /etc/service/couchdb
+   
+In a few seconds runit will discover a new symlink and start CouchDB. You 
can control CouchDB service like this::
+
+sudo sv status couchdb
+sudo sv stop couchdb
+sudo sv start couchdb
 
-Naturally, you can configure systemd, launchd or SysV-init daemons to
-launch CouchDB and keep it running using standard configuration files.
+Naturally now CouchDB will start autamatically shortly after system starts.
--- End diff --

typo 'autamatically' -> 'automatically'


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread rnewson
Github user rnewson commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80018509
  
--- Diff: src/install/unix.rst ---
@@ -229,10 +233,66 @@ CouchDB no longer ships with any daemonization 
scripts.
 
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
-straightforward; if you have questions, reach out to the CouchDB
-user mailing list.
+straightforward; if you have questions, contact the CouchDB
+`user mailing list 
`_
+or `IRC-channel #couchdb `_
+in FreeNode network.
+
+Let's consider configuring runit on Ubuntu 16.04. The following
+steps should be considered only as an example. Details will vary
+by operating system and distribution. Check your system's package
+management tools for specifics.
+
+Install ruinit::
--- End diff --

typo 'ruinit' -> 'runit'


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread rnewson
Github user rnewson commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80018414
  
--- Diff: src/install/unix.rst ---
@@ -23,6 +23,10 @@ release are the canonical sources of installation 
information. However, many
 systems have gotchas that you need to be aware of. In addition, 
dependencies
 frequently change as distributions update their archives.
 
+**Hint**: It is worth considering using packaging tools such as LXC, Docker
--- End diff --

-1 on this hint. This file is how to install on unix, so unless there will 
be detailed instructions on how to do that with LXC/Docker/et al this paragraph 
is not helping our users.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread rnewson
Github user rnewson commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80018495
  
--- Diff: src/install/unix.rst ---
@@ -229,10 +233,66 @@ CouchDB no longer ships with any daemonization 
scripts.
 
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
-straightforward; if you have questions, reach out to the CouchDB
-user mailing list.
+straightforward; if you have questions, contact the CouchDB
+`user mailing list 
`_
+or `IRC-channel #couchdb `_
+in FreeNode network.
+
+Let's consider configuring runit on Ubuntu 16.04. The following
--- End diff --

Too informal, the paragraph should be tightened to explain what runit is 
going to do that's valuable, and then how to configure it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation issue #69: Further improvements of "Installation on Un...

2016-09-22 Thread afiskon
Github user afiskon commented on the issue:

https://github.com/apache/couchdb-documentation/pull/69
  
@dch fixed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread dch
Github user dch commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80014264
  
--- Diff: src/install/unix.rst ---
@@ -230,9 +234,55 @@ CouchDB no longer ships with any daemonization scripts.
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
 straightforward; if you have questions, reach out to the CouchDB
--- End diff --

please make the mailing list reference a link, like you've already done for 
runit. It might be worth doing this for IRC  channel too?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread dch
Github user dch commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80013200
  
--- Diff: src/install/unix.rst ---
@@ -230,9 +234,55 @@ CouchDB no longer ships with any daemonization scripts.
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
 straightforward; if you have questions, reach out to the CouchDB
--- End diff --

Please let's start using contact, which is the correct word when there's 
nothing actually there to "pick up".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread dch
Github user dch commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80013525
  
--- Diff: src/install/unix.rst ---
@@ -230,9 +234,55 @@ CouchDB no longer ships with any daemonization scripts.
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
 straightforward; if you have questions, reach out to the CouchDB
-user mailing list.
+user mailing list or IRC-channel #couchdb in FreeNode network.
+
+Let's consider configuring of runit on Ubuntu 16.04. The following
+steps should be considered only as an example. Some details can vary
+on different systems and versions of Ubuntu Linux.
+
+Install ruinit::
+
+sudo apt-get install runit
+   
+Create a directory where logs will be written::
+
+sudo mkdir /var/log/couchdb
+sudo chown couchdb:couchdb /var/log/couchdb
+   
+Create directories that will contain runit counfiguration for CouchDB::
+
+sudo mkdir /etc/sv/couchdb
+sudo mkdir /etc/sv/couchdb/log
+   
+Create /etc/sv/couchdb/log/run script::
+
+#!/bin/sh
+exec svlogd -tt /var/log/couchdb
--- End diff --

it might be worth explaining briefly what these commands actually do, 
especially if you're not a runit user.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread dch
Github user dch commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80014081
  
--- Diff: src/install/unix.rst ---
@@ -230,9 +234,55 @@ CouchDB no longer ships with any daemonization scripts.
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
 straightforward; if you have questions, reach out to the CouchDB
-user mailing list.
+user mailing list or IRC-channel #couchdb in FreeNode network.
+
+Let's consider configuring of runit on Ubuntu 16.04. The following
+steps should be considered only as an example. Some details can vary
+on different systems and versions of Ubuntu Linux.
+
+Install ruinit::
+
+sudo apt-get install runit
+   
+Create a directory where logs will be written::
+
+sudo mkdir /var/log/couchdb
+sudo chown couchdb:couchdb /var/log/couchdb
+   
+Create directories that will contain runit counfiguration for CouchDB::
+
+sudo mkdir /etc/sv/couchdb
+sudo mkdir /etc/sv/couchdb/log
+   
+Create /etc/sv/couchdb/log/run script::
+
+#!/bin/sh
+exec svlogd -tt /var/log/couchdb
--- End diff --

Thanks for the updated docs as well as the very specific examples! I'm sure 
this will be very useful.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread dch
Github user dch commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80013245
  
--- Diff: src/install/unix.rst ---
@@ -230,9 +234,55 @@ CouchDB no longer ships with any daemonization scripts.
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
 straightforward; if you have questions, reach out to the CouchDB
-user mailing list.
+user mailing list or IRC-channel #couchdb in FreeNode network.
+
+Let's consider configuring of runit on Ubuntu 16.04. The following
--- End diff --

remove of.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread dch
Github user dch commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80013188
  
--- Diff: src/install/unix.rst ---
@@ -23,6 +23,10 @@ release are the canonical sources of installation 
information. However, many
 systems have gotchas that you need to be aware of. In addition, 
dependencies
 frequently change as distributions update their archives.
 
+**Hint**: It worth considering to use LXC-, Docker-conteiners, AMI images 
or
--- End diff --

It is worth considering using packaging tools such as LXC, Docker 
containers, AMI images, or similar solutions to configure CouchDB once, and to 
use this configuration consistently across all nodes in a cluster.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread dch
Github user dch commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80013386
  
--- Diff: src/install/unix.rst ---
@@ -230,9 +234,55 @@ CouchDB no longer ships with any daemonization scripts.
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
 straightforward; if you have questions, reach out to the CouchDB
-user mailing list.
+user mailing list or IRC-channel #couchdb in FreeNode network.
+
+Let's consider configuring of runit on Ubuntu 16.04. The following
+steps should be considered only as an example. Some details can vary
+on different systems and versions of Ubuntu Linux.
+
+Install ruinit::
+
+sudo apt-get install runit
+   
+Create a directory where logs will be written::
+
+sudo mkdir /var/log/couchdb
+sudo chown couchdb:couchdb /var/log/couchdb
+   
+Create directories that will contain runit counfiguration for CouchDB::
--- End diff --

configuration.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread dch
Github user dch commented on a diff in the pull request:

https://github.com/apache/couchdb-documentation/pull/69#discussion_r80013293
  
--- Diff: src/install/unix.rst ---
@@ -230,9 +234,55 @@ CouchDB no longer ships with any daemonization scripts.
 The couchdb team recommends `runit `_ to
 run CouchDB persistently and reliably. Configuration of runit is
 straightforward; if you have questions, reach out to the CouchDB
-user mailing list.
+user mailing list or IRC-channel #couchdb in FreeNode network.
+
+Let's consider configuring of runit on Ubuntu 16.04. The following
+steps should be considered only as an example. Some details can vary
--- End diff --

Details will vary by operating system and distribution. Check your system's 
package management tools for specifics.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-documentation pull request #69: Further improvements of "Installatio...

2016-09-22 Thread afiskon
GitHub user afiskon opened a pull request:

https://github.com/apache/couchdb-documentation/pull/69

Further improvements of "Installation on Unix-like systems" article

1. Suggest to use containers or AMI's
2. Add an example of configuring runit
3. Some minor changes

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/afiskon/couchdb-documentation master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-documentation/pull/69.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #69


commit 1c209ac45e8f13399672b3c480010b1d2704d37a
Author: Aleksander Alekseev 
Date:   2016-09-22T09:24:09Z

Suggestion to use containers or AMI's added to "Installation on Unix-like 
systems" article

commit a958f1f0e1489dbfff89cb62a47b6d9b9d6e363f
Author: Aleksander Alekseev 
Date:   2016-09-22T09:45:48Z

Add an example of configuring runit to "Installation on Unix-like systems" 
article




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---