You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2016/02/10 23:30:38 UTC

[1/2] fabric commit: updated refs/heads/2938-use-ddoc-cache-in-filtered-changes to 8bb97fc [Forced Update!]

Repository: couchdb-fabric
Updated Branches:
  refs/heads/2938-use-ddoc-cache-in-filtered-changes 8f42a7db6 -> 8bb97fcf5 (forced update)


Return forbidden error if encountered on any shard

This commit fixes an issue which caused HTTP 500 errors to be
returned when an authorized user attempted to access a database
that they did not have permission to access, when cassim is
disabled.

Instead of returning an internal server error once all shards
have failed to open we add a receive clause so that we throw
a forbidden error if one is encountered on any shard. This is the
same approach we already take for unauthorized errors.

Closes COUCHDB-2948

This closes #38


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/31be5324
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/31be5324
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/31be5324

Branch: refs/heads/2938-use-ddoc-cache-in-filtered-changes
Commit: 31be5324023771fa80bfe8a28a31f6592cb28af0
Parents: d67049c
Author: Mike Wallace <mi...@apache.org>
Authored: Tue Feb 9 14:31:55 2016 +0000
Committer: Mike Wallace <mi...@apache.org>
Committed: Wed Feb 10 11:59:23 2016 +0000

----------------------------------------------------------------------
 src/fabric_util.erl | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/31be5324/src/fabric_util.erl
----------------------------------------------------------------------
diff --git a/src/fabric_util.erl b/src/fabric_util.erl
index ef40484..522a1d2 100644
--- a/src/fabric_util.erl
+++ b/src/fabric_util.erl
@@ -187,6 +187,8 @@ get_shard([#shard{node = Node, name = Name} | Rest], Opts, Timeout, Factor) ->
             {ok, Db};
         {Ref, {'rexi_EXIT', {{unauthorized, _} = Error, _}}} ->
             throw(Error);
+        {Ref, {'rexi_EXIT', {{forbidden, _} = Error, _}}} ->
+            throw(Error);
         {Ref, _Else} ->
             get_shard(Rest, Opts, Timeout, Factor)
         after Timeout ->


[2/2] fabric commit: updated refs/heads/2938-use-ddoc-cache-in-filtered-changes to 8bb97fc

Posted by ch...@apache.org.
Support fetch ddoc logic for filtered changes feeds


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/8bb97fcf
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/8bb97fcf
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/8bb97fcf

Branch: refs/heads/2938-use-ddoc-cache-in-filtered-changes
Commit: 8bb97fcf59d44374e4e0516a33293d22a9c2308c
Parents: 31be532
Author: Russell Branca <ch...@apache.org>
Authored: Thu Jan 21 22:55:13 2016 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Wed Feb 10 22:21:06 2016 +0000

----------------------------------------------------------------------
 src/fabric_rpc.erl | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/8bb97fcf/src/fabric_rpc.erl
----------------------------------------------------------------------
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index 2554f91..9b88c7f 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -47,7 +47,18 @@ changes(DbName, #changes_args{} = Args, StartSeq, DbOptions) ->
     changes(DbName, [Args], StartSeq, DbOptions);
 changes(DbName, Options, StartVector, DbOptions) ->
     set_io_priority(DbName, DbOptions),
-    #changes_args{dir=Dir} = Args = lists:keyfind(changes_args, 1, Options),
+    Args0 = lists:keyfind(changes_args, 1, Options),
+    #changes_args{dir=Dir, filter_fun=Filter} = Args0,
+    Args = case Filter of
+        {fetch, Style, Req, {DDocId, Rev}, FName} ->
+            {ok, DDoc} = ddoc_cache:open_doc(mem3:dbname(DbName), DDocId, Rev),
+            Args0#changes_args{
+                filter_fun={custom, Style, Req, DDoc, FName}
+            };
+        _ ->
+            Args0
+    end,
+
     DbOpenOptions = Args#changes_args.db_open_options ++ DbOptions,
     case get_or_create_db(DbName, DbOpenOptions) of
     {ok, Db} ->