[GitHub] couchdb-couch pull request: Prevent reading beyond end of file and...
GitHub user eiri opened a pull request: https://github.com/apache/couchdb-couch/pull/173 Prevent reading beyond end of file and add config parameter to limit maxium pread size When a database file goes corrupt it is possible that pread will receive bogus length and place a large part of the file in memory before couch_file process will crash. Depending on a size of the file this could bring the whole node down. This change prevents pread from reading beyond end of a file and adding configuration parameter `max_pread_size` to give a method to address a situation when corrupted read does not go beyond eof, but still makes starting node crash on a large read. Two stats counters been added to report both exceptions. You can merge this pull request into a Git repository by running: $ git pull https://github.com/cloudant/couchdb-couch 65287-add-max-pread-size-limit Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-couch/pull/173.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 #173 commit 89990e1800934823b83341152d2a103cd4bcad8b Author: Eric AvdeyDate: 2016-05-16T13:15:38Z Raise exception on attempt of reading beyound end of file commit 8ea500ef413d09f862609d34bdd8ac6737cd26a3 Author: Eric Avdey Date: 2016-05-16T16:55:52Z Implement config parameter max_pread_size commit 824af52d2aa543204aeb0bd5a1b90264f02e55a9 Author: Eric Avdey Date: 2016-05-16T19:47:36Z Add stats counters for exceed_eof and exceed_limit --- 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 pull request: Update to the latest mrview
GitHub user eiri opened a pull request: https://github.com/apache/couchdb/pull/416 Update to the latest mrview This includes all the changes made to couch_mrview since the last deps update You can merge this pull request into a Git repository by running: $ git pull https://github.com/cloudant/couchdb update-mrview Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb/pull/416.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 #416 commit 99ba7660282f92a505df5547b3ebd0d2c450b169 Author: Eric AvdeyDate: 2016-05-16T19:06:49Z Render update_seq if number or binary commit f3126d6c834d22b6cb5d4e67c7b0119b3019a6c8 Author: Eric Avdey Date: 2016-05-16T19:08:29Z Use ioq to separately prioritise view updates commit 9dec296b8f3d2389a0e40c46bd2f46a463fe5c76 Author: Eric Avdey Date: 2016-05-16T19:10:00Z Make view updater couch_work_queue configurable commit 920489d493ece862cee7b963ffbaacb2eb20cbe5 Author: Eric Avdey Date: 2016-05-16T19:11:43Z Use couch_file:delete/3 in views cleanup --- 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-mem3 pull request: Make sure mem3_rep autocreates target s...
Github user rnewson commented on a diff in the pull request: https://github.com/apache/couchdb-mem3/pull/21#discussion_r63403783 --- Diff: src/mem3_rpc.erl --- @@ -275,6 +275,16 @@ rexi_call(Node, MFA) -> end. +get_or_create_db(DbName, Options) -> --- End diff -- since this is a cut-and-paste of a live function in fabric, can we put some thought to keeping this DRY? --- 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: Fix fabric_doc_open_revs
Github user rnewson commented on the pull request: https://github.com/apache/couchdb-fabric/pull/47#issuecomment-219493529 the dependent PR's are merged. --- 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: Fix couch_key_tree:get_key_leafs/2
Github user asfgit closed the pull request at: https://github.com/apache/couchdb-couch/pull/167 --- 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-2863) function_clause on requesting multiple open_revs with lastest=true
[ https://issues.apache.org/jira/browse/COUCHDB-2863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15284914#comment-15284914 ] ASF subversion and git services commented on COUCHDB-2863: -- Commit 6360857f30d2917827a5088015b16beaba8df4b2 in couchdb-couch's branch refs/heads/master from [~paul.joseph.davis] [ https://git-wip-us.apache.org/repos/asf?p=couchdb-couch.git;h=6360857 ] Fix couch_key_tree:get_key_leafs/2 This is a fix for a long standing bug when retrieving all leaf keys for a given set of keys. Before this patch we would incorrectly return some keys as missing if they happened to be deeper on a branch for a key that was found if they weren't themselves a leaf key. COUCHDB-2863 > function_clause on requesting multiple open_revs with lastest=true > -- > > Key: COUCHDB-2863 > URL: https://issues.apache.org/jira/browse/COUCHDB-2863 > Project: CouchDB > Issue Type: Bug >Reporter: Alexander Shorin >Assignee: Alexander Shorin >Priority: Blocker > Labels: has-pr > > During work on the COUCHDB-2857 found another issue for us: > {code} > $ echo '{}' | http put http://localhost:15984/db/doc > { > "id": "doc", > "ok": true, > "rev": "1-967a00dff5e02add41819138abb3284d" > } > $ echo '{"_rev": "1-967a00dff5e02add41819138abb3284d"}' | http put > http://localhost:15984/db/doc > { > "id": "doc", > "ok": true, > "rev": "2-7051cbe5c8faecd085a3fa619e6e6337" > } > $ http > 'http://localhost:15984/db/doc?open_revs=["1-967a00dff5e02add41819138abb3284d;, > "2-7051cbe5c8faecd085a3fa619e6e6337"]=true' > {"error":"unknown_error","reason":"function_clause","ref":162084788} > $ cat dev/logs/node1.log > 2015-10-28 02:38:26.707 [error] node1@127.0.0.1 <0.1222.0> req_err(162084788) > unknown_error : function_clause > [<<"lists:zipwith/3 L450">>,<<"lists:zipwith/3 > L450">>,<<"fabric_doc_open_revs:handle_message/3 > L104">>,<<"rexi_utils:process_mailbox/6 L55">>,<<"rexi_utils:recv/6 > L49">>,<<"fabric_doc_open_revs:go/4 L47">>,<<"chttpd_db:db_doc_req/3 > L660">>,<<"chttpd:handle_request_int/1 L238">>] > 2015-10-28 02:38:26.707 [error] node1@127.0.0.1 <0.1222.0> httpd 500 error > response: > {"error":"unknown_error","reason":"function_clause","ref":162084788} > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] couchdb-fauxton pull request: Fauxton tweaks
GitHub user benkeen opened a pull request: https://github.com/apache/couchdb-fauxton/pull/710 Fauxton tweaks Two things: - standardized button/link order in modals - adds filter icon You can merge this pull request into a Git repository by running: $ git pull https://github.com/benkeen/couchdb-fauxton fauxton-tweaks Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-fauxton/pull/710.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 #710 commit e3443a25a2fbf757c78d7ce4287e648657cd4944 Author: Ben KeenDate: 2016-05-16T16:28:34Z Standardizing modal btn order This standardizes the modal button order: cancel link first, action button second. commit 5b718dd71ce8f31baf94f5697d2164e2274c76c0 Author: Ben Keen Date: 2016-05-16T16:55:27Z Added filter fonticon --- 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: Fix couch_key_tree:get_key_leafs/2
Github user rnewson commented on the pull request: https://github.com/apache/couchdb-couch/pull/167#issuecomment-219471490 +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-chttpd pull request: fix in logic that denies login with c...
Github user asfgit closed the pull request at: https://github.com/apache/couchdb-chttpd/pull/122 --- 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: restore 1.x _users and _replicator be...
Github user asfgit closed the pull request at: https://github.com/apache/couchdb-chttpd/pull/121 --- 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: fix in logic that denies login with c...
Github user kxepal commented on the pull request: https://github.com/apache/couchdb-chttpd/pull/122#issuecomment-219423781 +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-chttpd pull request: fix in logic that denies login with c...
GitHub user janl opened a pull request: https://github.com/apache/couchdb-chttpd/pull/122 fix in logic that denies login with conflicted user docs You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/couchdb-chttpd fix-conflicted-user-docs Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-chttpd/pull/122.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 #122 commit dc0fa0a1383173bd87bc922332af1036f7352f49 Author: Jan LehnardtDate: 2016-05-16T12:13:46Z fix in logic that denies login with conflicted user docs --- 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: use shard suffix when generating _cha...
Github user willholley commented on the pull request: https://github.com/apache/couchdb-chttpd/pull/120#issuecomment-219404101 I'd like to add tests for this but not quite sure where the appropriate place is. Also, this pattern is repeated at https://github.com/apache/couchdb-global-changes/blob/203fb088ed81149108e64d18ffd9c3f5df154f97/src/global_changes_httpd.erl#L55 and https://github.com/apache/couchdb-couch/blob/b4295bfe58680c6a3d332a73ac6b061bd78b4db3/src/couch_httpd_db.erl#L123. This makes me wonder whether changing the database info object to include the unique shard prefix would be a better solution. --- 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: restore 1.x _users and _replicator be...
Github user janl commented on the pull request: https://github.com/apache/couchdb-chttpd/pull/121#issuecomment-219402626 @kxepal Iâm currently looking at the JS tests that validate our auth behaviour, do you want to have a stab at making views admin-only here, too? Feel free to push on top of my branch --- 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: restore 1.x _users and _replicator be...
Github user janl commented on the pull request: https://github.com/apache/couchdb-chttpd/pull/121#issuecomment-219402490 Since only admins can create views here, and we donât install any views ourselves, we are good here, but good thinking that *if* we want to encourage people to use custom views, we should make those admin only as well. --- 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: restore 1.x _users and _replicator be...
Github user kxepal commented on the pull request: https://github.com/apache/couchdb-chttpd/pull/121#issuecomment-219402113 IIRC, views are also admin-only resources, right? --- 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: restore 1.x _users and _replicator be...
GitHub user janl opened a pull request: https://github.com/apache/couchdb-chttpd/pull/121 restore 1.x _users and _replicator behaviour You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/couchdb-chttpd 2991-restore-1x-users-behaviour Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-chttpd/pull/121.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 #121 commit df264ad1fba5caa05d62165b6dc7b2fdb22c676d Author: Jan LehnardtDate: 2016-05-16T11:01:04Z restore 1.x _users and _replicator behaviour --- 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-2863) function_clause on requesting multiple open_revs with lastest=true
[ https://issues.apache.org/jira/browse/COUCHDB-2863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15284298#comment-15284298 ] ASF subversion and git services commented on COUCHDB-2863: -- Commit 09a370ab98aa31f45b57f3931dfa8b6e2ad04dd8 in couchdb-couch's branch refs/heads/master from [~paul.joseph.davis] [ https://git-wip-us.apache.org/repos/asf?p=couchdb-couch.git;h=09a370a ] Export couch_key_tree:merge/2 This is needed by fabric_doc_open_revs to fix COUCHDB-2863. COUCHDB-2863 > function_clause on requesting multiple open_revs with lastest=true > -- > > Key: COUCHDB-2863 > URL: https://issues.apache.org/jira/browse/COUCHDB-2863 > Project: CouchDB > Issue Type: Bug >Reporter: Alexander Shorin >Assignee: Alexander Shorin >Priority: Blocker > Labels: has-pr > > During work on the COUCHDB-2857 found another issue for us: > {code} > $ echo '{}' | http put http://localhost:15984/db/doc > { > "id": "doc", > "ok": true, > "rev": "1-967a00dff5e02add41819138abb3284d" > } > $ echo '{"_rev": "1-967a00dff5e02add41819138abb3284d"}' | http put > http://localhost:15984/db/doc > { > "id": "doc", > "ok": true, > "rev": "2-7051cbe5c8faecd085a3fa619e6e6337" > } > $ http > 'http://localhost:15984/db/doc?open_revs=["1-967a00dff5e02add41819138abb3284d;, > "2-7051cbe5c8faecd085a3fa619e6e6337"]=true' > {"error":"unknown_error","reason":"function_clause","ref":162084788} > $ cat dev/logs/node1.log > 2015-10-28 02:38:26.707 [error] node1@127.0.0.1 <0.1222.0> req_err(162084788) > unknown_error : function_clause > [<<"lists:zipwith/3 L450">>,<<"lists:zipwith/3 > L450">>,<<"fabric_doc_open_revs:handle_message/3 > L104">>,<<"rexi_utils:process_mailbox/6 L55">>,<<"rexi_utils:recv/6 > L49">>,<<"fabric_doc_open_revs:go/4 L47">>,<<"chttpd_db:db_doc_req/3 > L660">>,<<"chttpd:handle_request_int/1 L238">>] > 2015-10-28 02:38:26.707 [error] node1@127.0.0.1 <0.1222.0> httpd 500 error > response: > {"error":"unknown_error","reason":"function_clause","ref":162084788} > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (COUCHDB-2863) function_clause on requesting multiple open_revs with lastest=true
[ https://issues.apache.org/jira/browse/COUCHDB-2863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15284299#comment-15284299 ] ASF subversion and git services commented on COUCHDB-2863: -- Commit 09a370ab98aa31f45b57f3931dfa8b6e2ad04dd8 in couchdb-couch's branch refs/heads/master from [~paul.joseph.davis] [ https://git-wip-us.apache.org/repos/asf?p=couchdb-couch.git;h=09a370a ] Export couch_key_tree:merge/2 This is needed by fabric_doc_open_revs to fix COUCHDB-2863. COUCHDB-2863 > function_clause on requesting multiple open_revs with lastest=true > -- > > Key: COUCHDB-2863 > URL: https://issues.apache.org/jira/browse/COUCHDB-2863 > Project: CouchDB > Issue Type: Bug >Reporter: Alexander Shorin >Assignee: Alexander Shorin >Priority: Blocker > Labels: has-pr > > During work on the COUCHDB-2857 found another issue for us: > {code} > $ echo '{}' | http put http://localhost:15984/db/doc > { > "id": "doc", > "ok": true, > "rev": "1-967a00dff5e02add41819138abb3284d" > } > $ echo '{"_rev": "1-967a00dff5e02add41819138abb3284d"}' | http put > http://localhost:15984/db/doc > { > "id": "doc", > "ok": true, > "rev": "2-7051cbe5c8faecd085a3fa619e6e6337" > } > $ http > 'http://localhost:15984/db/doc?open_revs=["1-967a00dff5e02add41819138abb3284d;, > "2-7051cbe5c8faecd085a3fa619e6e6337"]=true' > {"error":"unknown_error","reason":"function_clause","ref":162084788} > $ cat dev/logs/node1.log > 2015-10-28 02:38:26.707 [error] node1@127.0.0.1 <0.1222.0> req_err(162084788) > unknown_error : function_clause > [<<"lists:zipwith/3 L450">>,<<"lists:zipwith/3 > L450">>,<<"fabric_doc_open_revs:handle_message/3 > L104">>,<<"rexi_utils:process_mailbox/6 L55">>,<<"rexi_utils:recv/6 > L49">>,<<"fabric_doc_open_revs:go/4 L47">>,<<"chttpd_db:db_doc_req/3 > L660">>,<<"chttpd:handle_request_int/1 L238">>] > 2015-10-28 02:38:26.707 [error] node1@127.0.0.1 <0.1222.0> httpd 500 error > response: > {"error":"unknown_error","reason":"function_clause","ref":162084788} > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] couchdb-couch pull request: Export couch_key_tree:merge/2
Github user asfgit closed the pull request at: https://github.com/apache/couchdb-couch/pull/166 --- 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: Fix fabric_doc_open_revs
Github user rnewson commented on a diff in the pull request: https://github.com/apache/couchdb-fabric/pull/47#discussion_r63328918 --- Diff: src/fabric_doc_open_revs.erl --- @@ -56,266 +57,390 @@ go(DbName, Id, Revs, Options) -> rexi_monitor:stop(RexiMon) end. + handle_message({rexi_DOWN, _, {_,NodeRef},_}, _Worker, #state{workers=Workers}=State) -> -NewWorkers = lists:keydelete(NodeRef, #shard.node, Workers), -skip(State#state{workers=NewWorkers}); +NewState = State#state{ +workers = lists:keydelete(NodeRef, #shard.node, Workers) +}, +handle_message({ok, []}, nil, NewState); + handle_message({rexi_EXIT, _}, Worker, #state{workers=Workers}=State) -> -skip(State#state{workers=lists:delete(Worker,Workers)}); -handle_message({ok, RawReplies}, Worker, #state{revs = all} = State) -> +NewState = State#state{ +workers = lists:delete(Worker, Workers) +}, +handle_message({ok, []}, nil, NewState); + +handle_message({ok, RawReplies}, Worker, State) -> #state{ dbname = DbName, reply_count = ReplyCount, worker_count = WorkerCount, workers = Workers, -replies = All0, -r = R +replies = PrevReplies, +r = R, +revs = Revs, +latest = Latest, +repair = InRepair } = State, -All = lists:foldl(fun(Reply,D) -> fabric_util:update_counter(Reply,1,D) end, -All0, RawReplies), -Reduced = fabric_util:remove_ancestors(All, []), -Complete = (ReplyCount =:= (WorkerCount - 1)), -QuorumMet = lists:all(fun({_,{_, C}}) -> C >= R end, Reduced), -case Reduced of All when QuorumMet andalso ReplyCount =:= (R-1) -> -Repair = false; -_ -> -Repair = [D || {_,{{ok,D}, _}} <- Reduced] + +IsTree = Revs == all orelse Latest, + +{NewReplies, QuorumMet, Repair} = case IsTree of +true -> +{NewReplies0, AllInternal, Repair0} = +tree_replies(PrevReplies, tree_sort(RawReplies)), +NumLeafs = length(couch_key_tree:get_all_leafs(PrevReplies)), +SameNumRevs = length(RawReplies) == NumLeafs, +QMet = AllInternal andalso SameNumRevs andalso ReplyCount + 1 >= R, +{NewReplies0, QMet, Repair0}; +false -> +{NewReplies0, MinCount} = dict_replies(PrevReplies, RawReplies), +{NewReplies0, MinCount >= R, false} end, -case maybe_reply(DbName, Reduced, Complete, Repair, R) of -noreply -> -{ok, State#state{replies = All, reply_count = ReplyCount+1, -workers = lists:delete(Worker,Workers)}}; -{reply, FinalReply} -> -fabric_util:cleanup(lists:delete(Worker,Workers)), -{stop, FinalReply} -end; -handle_message({ok, RawReplies0}, Worker, State) -> -% we've got an explicit revision list, but if latest=true the workers may -% return a descendant of the requested revision. Take advantage of the -% fact that revisions are returned in order to keep track. -RawReplies = strip_not_found_missing(RawReplies0), -#state{ -dbname = DbName, -reply_count = ReplyCount, -worker_count = WorkerCount, -workers = Workers, -replies = All0, -r = R -} = State, -All = lists:zipwith(fun({Rev, D}, Reply) -> -if Reply =:= error -> {Rev, D}; true -> -{Rev, fabric_util:update_counter(Reply, 1, D)} -end -end, All0, RawReplies), -Reduced = [fabric_util:remove_ancestors(X, []) || {_, X} <- All], -FinalReplies = [choose_winner(X, R) || X <- Reduced, X =/= []], + Complete = (ReplyCount =:= (WorkerCount - 1)), -case is_repair_needed(All, FinalReplies) of -true -> -Repair = [D || {_,{{ok,D}, _}} <- lists:flatten(Reduced)]; -false -> -Repair = false -end, -case maybe_reply(DbName, FinalReplies, Complete, Repair, R) of -noreply -> -{ok, State#state{replies = All, reply_count = ReplyCount+1, -workers=lists:delete(Worker,Workers)}}; -{reply, FinalReply} -> -fabric_util:cleanup(lists:delete(Worker,Workers)), -{stop, FinalReply} + +case QuorumMet orelse Complete of +true -> +fabric_util:cleanup(lists:delete(Worker, Workers)), +maybe_read_repair( +DbName, +IsTree, +NewReplies, +ReplyCount + 1, +InRepair orelse
[GitHub] couchdb-fabric pull request: Fix fabric_doc_open_revs
Github user rnewson commented on a diff in the pull request: https://github.com/apache/couchdb-fabric/pull/47#discussion_r63328874 --- Diff: src/fabric_doc_open_revs.erl --- @@ -56,266 +57,390 @@ go(DbName, Id, Revs, Options) -> rexi_monitor:stop(RexiMon) end. + handle_message({rexi_DOWN, _, {_,NodeRef},_}, _Worker, #state{workers=Workers}=State) -> -NewWorkers = lists:keydelete(NodeRef, #shard.node, Workers), -skip(State#state{workers=NewWorkers}); +NewState = State#state{ +workers = lists:keydelete(NodeRef, #shard.node, Workers) +}, +handle_message({ok, []}, nil, NewState); + handle_message({rexi_EXIT, _}, Worker, #state{workers=Workers}=State) -> -skip(State#state{workers=lists:delete(Worker,Workers)}); -handle_message({ok, RawReplies}, Worker, #state{revs = all} = State) -> +NewState = State#state{ +workers = lists:delete(Worker, Workers) +}, +handle_message({ok, []}, nil, NewState); + +handle_message({ok, RawReplies}, Worker, State) -> #state{ dbname = DbName, reply_count = ReplyCount, worker_count = WorkerCount, workers = Workers, -replies = All0, -r = R +replies = PrevReplies, +r = R, +revs = Revs, +latest = Latest, +repair = InRepair } = State, -All = lists:foldl(fun(Reply,D) -> fabric_util:update_counter(Reply,1,D) end, -All0, RawReplies), -Reduced = fabric_util:remove_ancestors(All, []), -Complete = (ReplyCount =:= (WorkerCount - 1)), -QuorumMet = lists:all(fun({_,{_, C}}) -> C >= R end, Reduced), -case Reduced of All when QuorumMet andalso ReplyCount =:= (R-1) -> -Repair = false; -_ -> -Repair = [D || {_,{{ok,D}, _}} <- Reduced] + +IsTree = Revs == all orelse Latest, + +{NewReplies, QuorumMet, Repair} = case IsTree of +true -> +{NewReplies0, AllInternal, Repair0} = +tree_replies(PrevReplies, tree_sort(RawReplies)), +NumLeafs = length(couch_key_tree:get_all_leafs(PrevReplies)), --- End diff -- what's the verdict then, @davisp? --- 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. ---