You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2020/08/20 19:58:26 UTC

[couchdb] branch do_not_use_catch_in_view_load_doc updated (ecc4f42 -> 0fe3f81)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch do_not_use_catch_in_view_load_doc
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 discard ecc4f42  Do not use (catch ...) in couch_views_reader:load_docs/4
     new 0fe3f81  Do not use (catch ...) in couch_views_reader:load_docs/4

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ecc4f42)
            \
             N -- N -- N   refs/heads/do_not_use_catch_in_view_load_doc (0fe3f81)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[couchdb] 01/01: Do not use (catch ...) in couch_views_reader:load_docs/4

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch do_not_use_catch_in_view_load_doc
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 0fe3f81654a83d5ee39cb195dbdf9d31ecc18a94
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Thu Aug 20 15:36:38 2020 -0400

    Do not use (catch ...) in couch_views_reader:load_docs/4
    
    Any error there would just be generating a case clause.
    
    Remove the `_Else` catch-all clause too, as `open_doc_revs/4` should return a
    list of just one item that is either `{ok, Doc}` or `{{not_found,
    missing},Rev}`. That's because it is called with just a single `[Rev1]` parameter
    and views `#mrargs` can't have the `latest` doc_options option.
    
    References:
     * [fabric2_db:open_doc_revs/4](https://github.com/apache/couchdb/blob/prototype/fdb-layer/src/fabric/src/fabric2_db.erl#L684-L691)
     * [couch_mrview_http](https://github.com/apache/couchdb/blob/prototype/fdb-layer/src/couch_mrview/src/couch_mrview_http.erl#L491)
---
 src/couch_views/src/couch_views_reader.erl | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/couch_views/src/couch_views_reader.erl b/src/couch_views/src/couch_views_reader.erl
index ce7f163..141cf94 100644
--- a/src/couch_views/src/couch_views_reader.erl
+++ b/src/couch_views/src/couch_views_reader.erl
@@ -210,8 +210,7 @@ load_doc(TxDb, Id, null, DocOpts) ->
 
 load_doc(TxDb, Id, Rev, DocOpts) ->
     Rev1 = couch_doc:parse_rev(Rev),
-    case (catch fabric2_db:open_doc_revs(TxDb, Id, [Rev1], DocOpts)) of
+    case fabric2_db:open_doc_revs(TxDb, Id, [Rev1], DocOpts) of
         {ok, [{ok, Doc}]} -> couch_doc:to_json_obj(Doc, DocOpts);
-        {ok, [{{not_found, missing}, Rev}]} -> null;
-        {ok, [_Else]} -> null
+        {ok, [{{not_found, missing}, Rev}]} -> null
     end.