This is an automated email from the ASF dual-hosted git repository. jiangphcn pushed a commit to branch 3.x-reset-corrupt-view-index-2 in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 9d8ea3188c79a29929d38fa5dcf93b01029e5531 Author: Robert Newson <robert.new...@uk.ibm.com> AuthorDate: Sun Feb 16 12:05:29 2020 +0000 Reset if we don't get a view header I found a .view file with a db_header in production (cause unknown but I'm hoping it's manual intervention). This patch means we'll reset the index if we find something other than a view header when looking for one. --- src/couch_mrview/src/couch_mrview_index.erl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/couch_mrview/src/couch_mrview_index.erl b/src/couch_mrview/src/couch_mrview_index.erl index 018060f..68f1d23 100644 --- a/src/couch_mrview/src/couch_mrview_index.erl +++ b/src/couch_mrview/src/couch_mrview_index.erl @@ -133,6 +133,12 @@ open(Db, State0) -> NewSt = couch_mrview_util:reset_index(Db, Fd, State), ensure_local_purge_doc(Db, NewSt), {ok, NewSt}; + {ok, Else} -> + couch_log:error("~s has a bad header: got ~p", + [IndexFName, Else]), + NewSt = couch_mrview_util:reset_index(Db, Fd, State), + ensure_local_purge_doc(Db, NewSt), + {ok, NewSt}; no_valid_header -> NewSt = couch_mrview_util:reset_index(Db, Fd, State), ensure_local_purge_doc(Db, NewSt),