-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Node Id on Server #1059
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be one test to create a server and check the creation of the node id ?
@@ -275,12 +271,15 @@ public static void main(String[] args) { | |||
// Create a common Server Context for all servers to access. | |||
serverContext = new ServerContext(opts, router); | |||
|
|||
// Generate a node ID if necessary. | |||
generateNodeId(serverContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be generated here?
Or can we move it down in the ServerContext creation.
This way we will have a similar behaviour between our tests and real servers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok - moved it to server context. Going to wait for #1061 to make meaningful tests.
* @param context The server context to use. | ||
*/ | ||
private static void generateNodeId(@Nonnull ServerContext context) { | ||
String currentId = context.getDataStore().get(String.class, "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move the setter and getter of this NODE_ID to the server context.
Every component will try to consume it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not needed now that there is a helper function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Results automatically generated by CorfuDB Benchmark Framework to assess the performance of this pull request for commit 4ae0bbe. *** 0.0% transaction FAILURE rate for NonConflictingTx+Scan workload, 1 threads, Disk mode An interactive dashboard with Pull Request Performance Metrics for ALL cluster types and numbers of threads in run, is available at: |
Codecov Report
@@ Coverage Diff @@
## master #1059 +/- ##
=========================================
Coverage ? 65.94%
=========================================
Files ? 213
Lines ? 9890
Branches ? 987
=========================================
Hits ? 6522
Misses ? 2996
Partials ? 372
Continue to review full report at Codecov.
|
* Implement Node Id as base64 * Add nodeId to version request * Move node id generation to servercontext
* Implement Node Id as base64 * Add nodeId to version request * Move node id generation to servercontext
Overview
Description: This PR introduces a node Id field, which is generated on first start and stored in the data store. The node Id is a 128-bit UUID which is represented as a Base64 URL-safe string. The planned use of a base64 string is to append it to a server url, in the form
<host>:<port>:<node-id>
, which will enable the node id to be checked at connection time during a handshake to be implemented in the future. Currently, the Node Id can be retrieved in using a versionRequest call to a server, and the server can retrieve the node Id from a serverContext.Why should this be merged: This PR makes it possible to disambiguate servers which have failed, but restarted at the same IP address, eliminating configuration errors from allowing clients to connect to incorrect servers.
Related issue(s) (if applicable): Fixes #1050
Checklist (Definition of Done):