In short, the purpose of `controllerNodeExistsHandler` is to mimic 
`checkedEphemeralCreate `, which previously is used to create `/controller` 
ephemeral node. In `CheckedEphemeral`, we need to double check the owner of the 
node if we saw `Code.NODEEXISTS`.

I think the purpose of the check and the additional logic is to handle 
transient network connection loss while creating the ephemeral.  Let's say our 
client sent a `create` request to zookeeper to create ephemeral znode and 
zookeeper receives this request and successfully creates the znode but fail to 
send back the response to our client because of transient network issue. In 
`retryUntilConnected`, our client tries to resend the request and gets the 
`Code.NODEEXISTS`. In this case, our client actually successfully creates and 
owns the znode.

[ Full content available at: https://github.com/apache/kafka/pull/5101 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to