You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2019/04/11 12:54:09 UTC
[couchdb] branch dont-reset-index created (now 66dc0eb)
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a change to branch dont-reset-index
in repository https://gitbox.apache.org/repos/asf/couchdb.git.
at 66dc0eb Don't reset_index if read_header fails
This branch includes the following new commits:
new 66dc0eb Don't reset_index if read_header fails
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 reset_index if read_header fails
Posted by rn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a commit to branch dont-reset-index
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 66dc0ebf363e0f8e1d69ab48cc9890d88b8e7130
Author: Robert Newson <rn...@apache.org>
AuthorDate: Thu Apr 11 13:41:41 2019 +0100
Don't reset_index if read_header fails
This decision is an old one, I think, and took the view that an error
from read_header meant something fatally wrong with this index
file. These days, it's far more likely to be something else, a process
crash at the wrong moment, and therefore wiping the index out is an
overreaction.
---
src/couch_mrview/src/couch_mrview_index.erl | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/couch_mrview/src/couch_mrview_index.erl b/src/couch_mrview/src/couch_mrview_index.erl
index ac43333..46c8345 100644
--- a/src/couch_mrview/src/couch_mrview_index.erl
+++ b/src/couch_mrview/src/couch_mrview_index.erl
@@ -122,7 +122,7 @@ open(Db, State0) ->
case couch_mrview_util:open_file(IndexFName) of
{ok, Fd} ->
- case (catch couch_file:read_header(Fd)) of
+ case couch_file:read_header(Fd) of
% upgrade code for <= 1.2.x
{ok, {OldSig, Header}} ->
% Matching view signatures.
@@ -135,10 +135,8 @@ open(Db, State0) ->
NewSt = couch_mrview_util:init_state(Db, Fd, State, Header),
ensure_local_purge_doc(Db, NewSt),
{ok, NewSt};
- _ ->
- NewSt = couch_mrview_util:reset_index(Db, Fd, State),
- ensure_local_purge_doc(Db, NewSt),
- {ok, NewSt}
+ {error, Reason} ->
+ {error, Reason}
end;
{error, Reason} = Error ->
couch_log:error("Failed to open view file '~s': ~s",