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/05/28 18:53:55 UTC

[couchdb] branch dont-skip-over-transient-mango-docs created (now b1d7a34)

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

vatamane pushed a change to branch dont-skip-over-transient-mango-docs
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at b1d7a34  Don't skip over docs in mango indices on erlfdb errors

This branch includes the following new commits:

     new b1d7a34  Don't skip over docs in mango indices on erlfdb errors

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.



[couchdb] 01/01: Don't skip over docs in mango indices on erlfdb errors

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

vatamane pushed a commit to branch dont-skip-over-transient-mango-docs
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit b1d7a346427c3694cc6bc7205a66548b719b07dc
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Thu May 28 14:52:34 2020 -0400

    Don't skip over docs in mango indices on erlfdb errors
---
 src/couch_views/src/couch_views_updater.erl       |  5 +++++
 src/couch_views/test/couch_views_updater_test.erl | 13 ++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/couch_views/src/couch_views_updater.erl b/src/couch_views/src/couch_views_updater.erl
index 30dfac3..a87fab1 100644
--- a/src/couch_views/src/couch_views_updater.erl
+++ b/src/couch_views/src/couch_views_updater.erl
@@ -31,6 +31,11 @@ index(Db, #doc{id = Id, revs = Revs} = Doc, _NewWinner, _OldWinner, NewRevId,
             index_int(Db, Doc, Seq)
         end
     catch
+        error:{erlfdb, ErrCode} when is_integer(ErrCode) ->
+            DbName = fabric2_db:name(Db),
+            couch_log:error("Mango index erlfdb error Db ~s Doc ~p ~p",
+                [DbName, Id, ErrCode]),
+            erlang:raise(error, {erlfdb, ErrCode}, erlang:get_stacktrace());
         Error:Reason ->
             DbName = fabric2_db:name(Db),
             couch_log:error("Mango index error for Db ~s Doc ~p ~p ~p",
diff --git a/src/couch_views/test/couch_views_updater_test.erl b/src/couch_views/test/couch_views_updater_test.erl
index e456225..3c80537 100644
--- a/src/couch_views/test/couch_views_updater_test.erl
+++ b/src/couch_views/test/couch_views_updater_test.erl
@@ -35,7 +35,8 @@ indexer_test_() ->
                     ?TDEF_FE(index_docs),
                     ?TDEF_FE(update_doc),
                     ?TDEF_FE(delete_doc),
-                    ?TDEF_FE(includes_design_docs)
+                    ?TDEF_FE(includes_design_docs),
+                    ?TDEF_FE(handle_erlfdb_errors)
                 ]
             }
         }
@@ -68,10 +69,12 @@ foreach_setup() ->
 
     Docs = make_docs(3),
     fabric2_db:update_docs(Db, Docs),
+    meck:new(couch_views_indexer, [passthrough]),
     {Db, DDoc}.
 
 
 foreach_teardown({Db, _}) ->
+    meck:unload(),
     ok = fabric2_db:delete(fabric2_db:name(Db), []).
 
 
@@ -131,6 +134,14 @@ includes_design_docs({Db, _}) ->
     ], Docs).
 
 
+handle_erlfdb_errors({Db, _}) ->
+    meck:expect(couch_views_fdb, write_doc, fun(_, _, _, _) ->
+        error({erlfdb, 1009})
+    end),
+    ?assertError({erlfdb, 1009}, fabric2_db:update_docs(Db, [doc(4)])).
+
+
+
 run_query(Db, DDoc) ->
     Args = #mrargs{
         view_type = map,