chenBright commented on PR #1814:
URL: https://github.com/apache/incubator-brpc/pull/1814#issuecomment-1189778264

   > 
有一个问题:这个PR为什么会修改selective_channel?在socket_map.cpp中增删前设置in_socket_map是不是就足够了?
   > 
   > selective_channel里sub_channel中的Naming 
service会在对端离开的时候通过SocketMapRemove将对端删除,从而间接影响selective_channel了。
   
   SocketMapRemove 删除的是sub_channel中的Naming 
service的socket吧,而这里的socket是selective_channel里为每个sub_channel创建对应的fake 
socket,用于lb选路。ChannelBalancer::AddChannel中创建fake 
socket的时候设置了health_check_interval_s,预期是fake socket被SetFailed了,启动健康检查机制,对fake 
socket的SocketUser(在selective_channel中设置为sub_channel)进行健康检查(https://github.com/apache/incubator-brpc/blob/master/src/brpc/details/health_check.cpp#L202)。
   
   如果不修改selective_channel,fake socket的_is_in_socket_map为false,那么fake 
socket的健康检查机制实际上不会执行了。虽然目前只看到ChannelBalancer::AddChannel中AddServer失败的时候才会将该socket
 SetFailed,随后该socket就会被回收了,健康检查执行与否都没影响,但是还是破坏了这里的设计,感觉不合理。


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to