apache / hertzbeat

Apache HertzBeat(incubating) is a real-time monitoring system with agentless, performance cluster, prometheus-compatible, custom monitoring and status page building capabilities.
https://hertzbeat.apache.org/
Apache License 2.0
5.24k stars 910 forks source link

[Improve] Fix possible potential thread unsafe issues #2042

Closed gjjjj0101 closed 1 month ago

gjjjj0101 commented 1 month ago

What's changed?

In a multi-threaded environment, addNode() and removeNode() will have thread unsafe issues, divides the existing addNode and removeNode functions into smaller, synchronized operations: addVirtualNode() and removeVirtualNode(). In this way, addNode() and removeNode() also can be called in parallel. And add the ConsistentHash class Unit testing

Checklist

Add or update API