summaryrefslogtreecommitdiff
path: root/src/couch_mrview
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2019-04-12 16:20:21 +0100
committerRobert Newson <rnewson@apache.org>2019-04-12 16:22:03 +0100
commit5010b2f002c5d66b4cc82aa54625486d4cc15a26 (patch)
tree18b8e1aa840474018e9d7da2d103113027f0ef49 /src/couch_mrview
parente9fc291e81a93a92d3519df4d460e495cddb4e11 (diff)
downloadcouchdb-5010b2f002c5d66b4cc82aa54625486d4cc15a26.tar.gz
Don't reset_index if read_header failsdont-reset-index
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.
Diffstat (limited to 'src/couch_mrview')
-rw-r--r--src/couch_mrview/src/couch_mrview_index.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/couch_mrview/src/couch_mrview_index.erl b/src/couch_mrview/src/couch_mrview_index.erl
index ac433335c..03701693f 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,7 +135,7 @@ open(Db, State0) ->
NewSt = couch_mrview_util:init_state(Db, Fd, State, Header),
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),
{ok, NewSt}