jaydoane commented on code in PR #4811:
URL: https://github.com/apache/couchdb/pull/4811#discussion_r1362871438
##########
src/couch_index/src/couch_index_server.erl:
##########
@@ -167,19 +167,29 @@ handle_call({get_index, {_Mod, _IdxState, DbName, Sig} =
Args}, From, State) ->
[{_, Pid}] when is_pid(Pid) ->
{reply, {ok, Pid}, State}
end;
-handle_call({async_open, {DbName, DDocId, Sig}, {ok, Pid}}, {OpenerPid, _},
State) ->
- [{_, Waiters}] = ets:lookup(State#st.by_sig, {DbName, Sig}),
- [gen_server:reply(From, {ok, Pid}) || From <- Waiters],
+handle_call({async_open, {DbName, DDocId, Sig}, {ok, Pid}}, {OpenerPid, _} =
FromOpener, State) ->
link(Pid),
+ % Once linked with the indexer, dismiss and ignore the opener.
+ unlink(OpenerPid),
ets:delete(State#st.openers, OpenerPid),
- add_to_ets(DbName, Sig, DDocId, Pid, State),
- {reply, ok, State};
-handle_call({async_error, {DbName, _DDocId, Sig}, Error}, {OpenerPid, _},
State) ->
+ gen_server:reply(FromOpener, ok),
[{_, Waiters}] = ets:lookup(State#st.by_sig, {DbName, Sig}),
- [gen_server:reply(From, Error) || From <- Waiters],
+ add_to_ets(DbName, Sig, DDocId, Pid, State),
+ [gen_server:reply(From, {ok, Pid}) || From <- Waiters],
+ % Flush opener exit messages in case it died before we unlinked it
+ ok = flush_exit_messages_from(OpenerPid),
+ {noreply, State};
Review Comment:
I noticed that both here and in below you changed from `{reply, ok, State}`
to `{noreply, State}`. Can you explain why?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]