diff options
author | Robert Newson <rnewson@apache.org> | 2020-01-10 15:58:52 +0000 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-01-10 14:07:46 -0600 |
commit | 8d92f2137ff4b4c3873778864cfa695e27c6332a (patch) | |
tree | 118eeb1f4ad116d1e76da8261cfe2e9dccd67ac4 | |
parent | dd1b2817bbf7a0efce858414310a0c822ce89468 (diff) | |
download | couchdb-8d92f2137ff4b4c3873778864cfa695e27c6332a.tar.gz |
Reset a view shard if the signature is wrong
We encountered a case_clause error when reading the header for a .view
file as the response was {ok, {Sig, nil}} where Sig is neither the
expected sig or the pre-upgrade sig (though surely the pre-1.2 goop is
not firing anymore).
We now log this specific issue and then proceed as if we found no
valid header.
-rw-r--r-- | src/couch_mrview/src/couch_mrview_index.erl | 6 |
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 8542cc63f..c96d87173 100644 --- a/src/couch_mrview/src/couch_mrview_index.erl +++ b/src/couch_mrview/src/couch_mrview_index.erl @@ -127,6 +127,12 @@ open(Db, State0) -> NewSt = couch_mrview_util:init_state(Db, Fd, State, Header), ensure_local_purge_doc(Db, NewSt), {ok, NewSt}; + {ok, {WrongSig, _}} -> + couch_log:error("~s has the wrong signature: expected: ~p but got ~p", + [IndexFName, Sig, WrongSig]), + 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), |