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/25 23:22:58 UTC

couch commit: updated refs/heads/2938-fix-5986-filtered-changes to 81ee4ef [Forced Update!]

Repository: couchdb-couch
Updated Branches:
  refs/heads/2938-fix-5986-filtered-changes 9171d5a8f -> 81ee4efcc (forced update)


Only use fetch/ddoc_cache logic in the clusted case


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/81ee4efc
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/81ee4efc
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/81ee4efc

Branch: refs/heads/2938-fix-5986-filtered-changes
Commit: 81ee4efcc9c533005b760a48a6192839173928c7
Parents: 9383c5c
Author: Russell Branca <ch...@apache.org>
Authored: Thu Feb 25 19:47:13 2016 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Thu Feb 25 22:22:04 2016 +0000

----------------------------------------------------------------------
 src/couch_changes.erl | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/81ee4efc/src/couch_changes.erl
----------------------------------------------------------------------
diff --git a/src/couch_changes.erl b/src/couch_changes.erl
index 73a3cce..7d5cf6e 100644
--- a/src/couch_changes.erl
+++ b/src/couch_changes.erl
@@ -231,11 +231,15 @@ configure_filter(FilterName, Style, Req, Db) ->
     FilterNameParts = string:tokens(FilterName, "/"),
     case [?l2b(couch_httpd:unquote(Part)) || Part <- FilterNameParts] of
         [DName, FName] ->
-            DesignId = <<"_design/", DName/binary>>,
-            {ok, DDoc} = ddoc_cache:open_doc(fabric:dbname(Db), DesignId),
+            {ok, DDoc} = open_ddoc(Db, <<"_design/", DName/binary>>),
             check_member_exists(DDoc, [<<"filters">>, FName]),
-            DIR = fabric_util:doc_id_and_rev(DDoc),
-            {fetch, Style, Req, DIR, FName};
+            case Db#db.id_tree of
+                undefined ->
+                    DIR = fabric_util:doc_id_and_rev(DDoc),
+                    {fetch, Style, Req, DIR, FName};
+                _ ->
+                    {custom, Style, Req, DDoc, FName}
+            end;
 
         [] ->
             {default, Style};
@@ -339,15 +343,7 @@ check_docids(_) ->
 
 
 open_ddoc(#db{name=DbName, id_tree=undefined}, DDocId) ->
-    {_, Ref} = spawn_monitor(fun() ->
-        exit(fabric:open_doc(mem3:dbname(DbName), DDocId, [ejson_body]))
-    end),
-    receive
-        {'DOWN', Ref, _, _, {ok, _}=Response} ->
-            Response;
-        {'DOWN', Ref, _, _, Response} ->
-            throw(Response)
-    end;
+    {ok, _DDoc} = ddoc_cache:open_doc(mem3:dbname(DbName), DDocId);
 open_ddoc(Db, DDocId) ->
     case couch_db:open_doc(Db, DDocId, [ejson_body]) of
         {ok, _} = Resp -> Resp;