-
Notifications
You must be signed in to change notification settings - Fork 612
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
ISPN-14863 Implement RESP "cluster nodes" command #11025
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.
LGTM, just some minor comments. I also am not familiar with the actual REDIS output, but I assume you double checked the validity.
} | ||
|
||
private static void serializeSegments(StringBuilder response, IntSet ranges) { | ||
BitSet bitSet = BitSet.valueOf(ranges.toBitSet()); |
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.
This should be able to just use the ranges.iterator instead. But this change is not required as it is a pretty small optimization I suspect.
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.
Another option is adding nextSetBit method to IntSet which sounds like a good idea to me. It should be pretty trivial to add the method to the various implementations.
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.
Added the nextSetBit
method, and updated here and the SHARDS command.
StringBuilder sb = new StringBuilder(); | ||
sb.append(name).append(' '); | ||
sb.append(addressString).append(':').append(port).append('@').append(port); | ||
sb.append(",,shard-id=").append(name).append(' '); |
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.
Is the space at the end always needed?
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.
Yeah, in this format, they use space as a separator.
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.
Okay, I was thinking it was a bit of a waste if it was always there, even for the last node. But if that is how they want it :)
Updated with suggestions. |
I need to find another way to check this beyond using the Lettuce client to validate the response. |
Doing a comparison by running with
Running with ISPN:
The ISPN output includes the |
Doing a test with three servers (server-1, server-2, server-3):
I think that should be it, going to squash the commits. I guess a point of attention is the way I did to retrieve the resp server. |
Maybe introduce a Vert.x Redis client test ? |
I think adding the Vert.x might be worth it, especially since we're missing more throughout coverage in cluster mode, checking the CRC16 implementation. Although, the client seems to use the The |
Pushed a small change. I was not retrieving the segments owned (that's why all nodes had 0-255). Now we have:
|
cdb78bf
to
7c33b78
Compare
@tristantarrant @wburns something else ? |
hash = currentCH; | ||
} | ||
EmbeddedCacheManager ecm = SecurityActions.getEmbeddedCacheManager(respCache); | ||
cs = requestPerOwner.computeIfAbsent(ecm.getAddress(), ignore -> requestClusterInformation(handler, ctx, ecm, topology)); |
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.
Isn't ecm.getAddress()
always the same thing irrespective of the consistent hash? Not sure I understand the requestPerOwner map usage.
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.
Not always, it depends on the server handling the request. The result is slightly different and includes a myself
in the returned nodes list. We have a test covering this, too. With two servers, each client connects to one server.
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.
Sorry, totally missed the point. Updated now.
Integrated into main, thanks @jabolina ! |
https://issues.redhat.com/browse/ISPN-14963