iilyak commented on PR #5649:
URL: https://github.com/apache/couchdb/pull/5649#issuecomment-3282395371

   This PR wouldn't handle the case when the old Pid is remaining in `BY_SIG` 
table. The `index_open` first try to get the Pid from ets table which will 
succeed if we didn't receive the EXIT yet. Here is [the 
implementation](https://github.com/apache/couchdb/blob/7ac5387bfee10b0769adb1bec106e8205ae7404c/src/dreyfus/src/dreyfus_index_manager.erl#L56)
 of index_open
   
   ```erlang
   handle_call({get_index, DbName, #index{sig = Sig} = Index}, From, State) ->
       case ets:lookup(?BY_SIG, {DbName, Sig}) of
           [] ->
               Pid = spawn_link(fun() -> new_index(DbName, Index) end),
               ets:insert(?BY_PID, {Pid, opening, {DbName, Sig}}),
               ets:insert(?BY_SIG, {{DbName, Sig}, [From]}),
               {noreply, State};
           [{_, WaitList}] when is_list(WaitList) ->
               ets:insert(?BY_SIG, {{DbName, Sig}, [From | WaitList]}),
               {noreply, State};
           [{_, ExistingPid}] ->
               {reply, {ok, ExistingPid}, State}
       end;
   ```
   
   A better approach is implemented in 
https://github.com/apache/couchdb/pull/5651


-- 
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: notifications-unsubscr...@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to