You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/07/12 21:28:35 UTC

[GitHub] davisp commented on a change in pull request #667: 649 fix mrview changes since test

davisp commented on a change in pull request #667: 649 fix mrview changes since test
URL: https://github.com/apache/couchdb/pull/667#discussion_r127076952
 
 

 ##########
 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:
   I debated with myself a bit on that. Went with error since it seemed like something we'd want to know about if it happens often while info might not be logged in production.
 
----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services