Comments (2)
No, you're right. The hashCode thing is a trade off. It's exceedingly unlikely Address
hash codes will collide since IPs are limited to a specific, comparatively small range of possibilities, and the number of servers in a cluster is also small. Even just using the string hash code makes it unlikely they'll ever collide within a single cluster.
The reason for using hash codes is to provide a space compact way to send Address in requests like AppendRequest. It's effectively a member ID. AppendRequest.leader() is a 4-byte ID rather than a 22 byte host and port. This is just a user friendly alternative to requiring the user to specify a server ID at startup.
But I think with the changes in the client transport PR (which will be merged soon) this can probably be replaced. That PR adds an extra request type for sending configurations before sending an AppendRequest. So, the leader can arbitrarily assign server IDs in its own configuration and send those IDs to followers when replicating that configuration. This wasn't possible in the past since AppendRequest was the only way the leader replicated its configuration. This would mean essentially the leader() ID sent in an AppendRequest relates to the current cluster configuration, which should be fine. Some parts of the protocol like pre-vote and vote requests would still have to serialize Address since they happen before any leader exists, but those are infrequent requests so that should be fine too.
On Dec 1, 2015, at 2:34 AM, Bastian Glöckle [email protected] wrote:
ClusterState seems to track members of the cluster by their "ID" and the ID seems to be (LeaderState#join(...)) the Object#hashCode() of the address of that node.
This seems to be insecure, as two nodes with different addresses could have the same hashCode and therefore the same ID. Or am I missing something?
—
Reply to this email directly or view it on GitHub.
from copycat.
Sounds great :)
from copycat.
Related Issues (20)
- Support concurrent access of logs
- Remove indexing in logs
- Relax threading model in transports
- Remove serialization
- Create state machine test framework
- Support relaxed client consistency models
- Use unique node identifiers HOT 2
- Catch up joining nodes in the PASSIVE state before promotion to ACTIVE HOT 1
- question for performance HOT 4
- Join request from leader is proxied back to itself
- Leader election sends LEADER state change event twice
- New leader triggers onLeave event
- Use trace log level for requests/responses
- Don't submit unnecessary keep-alives
- Nodes can't communicate over the internet HOT 1
- copycat 1.2.4 server fails build test HOT 2
- question about pessimistic case HOT 1
- Allow KeepAliveRequest to manage multiple sessions HOT 2
- Under certain disconnection circumstances, the copycat-client-io thread takes 100% CPU HOT 3
- ServerCommit GC Warning
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from copycat.