summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <robert.newson@uk.ibm.com>2020-02-16 12:05:29 +0000
committerRobert Newson <rnewson@apache.org>2020-02-17 10:44:44 +0000
commit09ac7208e6078bbbf56c569a62cddabc973932db (patch)
tree1a0e6f3f1514c5739ecc24676995b88c32d25852
parentca178f0e7fe9683da51d0c3bc322fb2b99826311 (diff)
downloadcouchdb-09ac7208e6078bbbf56c569a62cddabc973932db.tar.gz
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.
-rw-r--r--src/couch_mrview/src/couch_mrview_index.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/couch_mrview/src/couch_mrview_index.erl b/src/couch_mrview/src/couch_mrview_index.erl
index c96d87173..cc013c5bd 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),