Details
Description
I read ZOOKEEPER-2355 and tried to reproduce it, but I found that this bug is not fixed in the fixed version. Ephemeral nodes are never deleted if the cluster has a network partition while the zookeeper client is closed.
The steps to reproduce are as follows:
- Start a three-node zookeeper cluster and elect a leader.
- Create client zk1 to connect to the zookeeper cluster.
- Use zk1 to create a temporary node "/e1".
- Implement a network partition between the leader and any follower.
- Use close() to delete the zk1 client.
- Remove the previously imposed network partition.
- Create client zk2 to connect to any zookeeper server.
- Call zk2.exists(nodePath, false), and find that nodePath has not been deleted.
- Create a temporary node of the path "/e1" on zk2, and an exception is thrown: KeeperErrorCode = NodeExists for /e1
I don't understand how this problem was fixed before. I tried two fixed versions 3.5.4 and 3.6.0, and the above reproduction path can still be triggered stably. The bug no longer appeared after I commented out the network partition related content.