nickva commented on a change in pull request #667: 649 fix mrview changes since
test
URL: https://github.com/apache/couchdb/pull/667#discussion_r127077694
##########
File path: src/couch_index/src/couch_index.erl
##########
@@ -230,24 +230,37 @@ handle_cast({new_state, NewIdxState}, State) ->
mod=Mod,
idx_state=OldIdxState
} = State,
- assert_signature_match(Mod, OldIdxState, NewIdxState),
- CurrSeq = Mod:get(update_seq, NewIdxState),
- Args = [
- Mod:get(db_name, NewIdxState),
- Mod:get(idx_name, NewIdxState),
- CurrSeq
- ],
- couch_log:debug("Updated index for db: ~s idx: ~s seq: ~B", Args),
- Rest = send_replies(State#st.waiters, CurrSeq, NewIdxState),
- case State#st.committed of
- true -> erlang:send_after(commit_delay(), self(), commit);
- false -> ok
- end,
- {noreply, State#st{
- idx_state=NewIdxState,
- waiters=Rest,
- committed=false
- }};
+ OldFd = Mod:get(fd, OldIdxState),
+ NewFd = Mod:get(fd, NewIdxState),
+ case NewFd == OldFd of
+ true ->
+ assert_signature_match(Mod, OldIdxState, NewIdxState),
+ CurrSeq = Mod:get(update_seq, NewIdxState),
+ Args = [
+ Mod:get(db_name, NewIdxState),
+ Mod:get(idx_name, NewIdxState),
+ CurrSeq
+ ],
+ couch_log:debug("Updated index for db: ~s idx: ~s seq: ~B", Args),
+ Rest = send_replies(State#st.waiters, CurrSeq, NewIdxState),
+ case State#st.committed of
+ true -> erlang:send_after(commit_delay(), self(), commit);
+ false -> ok
+ end,
+ {noreply, State#st{
+ idx_state=NewIdxState,
+ waiters=Rest,
+ committed=false
+ }};
+ false ->
+ Fmt = "Ignoring update from old indexer for db: ~s idx: ~s",
+ Args = [
+ Mod:get(db_name, NewIdxState),
+ Mod:get(idx_name, NewIdxState)
+ ],
+ couch_log:error(Fmt, Args),
Review comment:
Agree with @davisp. It would be a rare enough event and since this area of
code is a bit tricky as is would want to see in case there are other issues
that might happens here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services