Giter Club home page Giter Club logo

Comments (2)

kuujo avatar kuujo commented on May 24, 2024

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.

bgloeckle avatar bgloeckle commented on May 24, 2024

Sounds great :)

from copycat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.