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 2021/03/02 20:42:29 UTC
[couchdb] branch main updated: Fix badmatch in couch_views_indexer
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/main by this push:
new fac13a3 Fix badmatch in couch_views_indexer
fac13a3 is described below
commit fac13a3ff0cfe6502dc424a9a129d7dd265290e4
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Tue Mar 2 15:20:57 2021 -0500
Fix badmatch in couch_views_indexer
Previously, when an erlfdb error occured and a recursive call to `update/3` was
made, the result of that call was always matched against `{Mrst, State}`.
However, in the case when the call had finalized and returned
`couch_eval:release_map_context/1` response, the result would be `ok` which
would blow with a badmatch error against `{Mrst, State}`.
---
src/couch_views/src/couch_views_indexer.erl | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/couch_views/src/couch_views_indexer.erl b/src/couch_views/src/couch_views_indexer.erl
index e3b2ad5..8019d9f 100644
--- a/src/couch_views/src/couch_views_indexer.erl
+++ b/src/couch_views/src/couch_views_indexer.erl
@@ -182,17 +182,19 @@ add_error(Error, Reason, Data) ->
update(#{} = Db, Mrst0, State0) ->
Limit = couch_views_batch:start(Mrst0),
- {Mrst1, State1} = try
+ Result = try
do_update(Db, Mrst0, State0#{limit => Limit})
catch
error:{erlfdb_error, Error} when ?IS_RECOVERABLE_ERROR(Error) ->
couch_views_batch:failure(Mrst0),
update(Db, Mrst0, State0)
end,
- case State1 of
- finished ->
+ case Result of
+ ok ->
+ ok; % Already finished and released map context
+ {Mrst1, finished} ->
couch_eval:release_map_context(Mrst1#mrst.qserver);
- _ ->
+ {Mrst1, State1} ->
#{
update_stats := UpdateStats
} = State1,