Repository navigation
CASSSIDECAR-495: Report each instance's own Sidecar instance id in th… - #380
Open
bianca-stanciu29 wants to merge 4 commits into
Open
bianca-stanciu29 wants to merge 4 commits into
bianca-stanciu29 wants to merge 4 commits into
Conversation
…e ring / token-range-replicas response Enrich RingEntry and ReplicaMetadata with the id of the local Sidecar instance managing each node/replica, resolved via InstanceMetadataFetcher#sidecarInstanceId(host) in KeyspaceRingHandler and TokenRangeReplicaMapHandler. Entries not managed by this Sidecar retain a null id. This lets clients discover which instanceId to pass for a given node/replica in a follow-up request, which matters most when the client sits behind a load balancer and cannot otherwise guarantee it reaches the Sidecar managing that node.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Analytics needs the Sidecar instance ID associated with a target Cassandra node when constructing per-instance requests. A client-side hostname lookup cannot reliably supply this information when addresses differ or instances are accessed through a shared endpoint.
Solution
Add an optional
sidecarInstanceIdto ring entries and token-range replica metadata. The server resolves it from its local instance configuration using the node's address.nullfor nodes that the responding Sidecar does not manage.RingEntryandReplicaMetadataconstructors. They leave the IDnull, so existingclient-commoncallers keep working.Clients can pass the reported ID as the
instanceIdquery parameter to a Sidecar configured to manage that node.Related client work: apache/cassandra-analytics#222 (CASSANALYTICS-177).
Scope and topology limitations
These IDs belong to the responding Sidecar's local configuration; they are not cluster-global routing identifiers.
When a Sidecar manages all relevant instances, it can report IDs for all of them. With one Sidecar per node, a response only reports the locally managed node's ID; other entries remain
null.This change does not select a load-balancer backend or rewrite destination addresses. A subsequent request must reach a Sidecar configured to recognize the supplied ID. Initial discovery through a load balancer may still require explicit contact-point routing configuration.
Testing
RingEntryandReplicaMetadata: JSON round-trip, deserializing responses without the new field, and the previous constructors.InstanceMetadataFetcher: lookup of managed and unmanaged addresses.null, and the rest of the response is unchanged.Run locally on the branch merged with current trunk:
client-common,clientandadapters-base.DTEST_JAR=dtest-5.0.7.jar): integration-test compilation,RingHandlerTestandInstanceMetadataFetcherTest.Tests ran with
-x checkEnvironmentbecause the macOS multi-node loopback aliases are missing locally. The full server test suite, the integration tests, and an end-to-end load-balancer test have not been run.JIRA: https://issues.apache.org/jira/browse/CASSSIDECAR-495