Skip to content
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 NodeResolverImpl to Resolve Nodes by IP Address and UUID #718

Closed
VictorCavichioli opened this issue Sep 19, 2024 · 0 comments
Closed
Assignees
Labels
enhancement New feature or request PoC/Agent Tasks related to new generation of ecchronos as an agent

Comments

@VictorCavichioli
Copy link
Contributor

VictorCavichioli commented Sep 19, 2024

Story Description:
The NodeResolverImpl class is responsible for resolving Cassandra nodes by their IP addresses and UUIDs using a CqlSession. This class will manage two concurrent maps to efficiently store and retrieve nodes: one mapping IP addresses to DriverNode instances and another mapping UUIDs to DriverNode instances.

Key Responsibilities:

  1. IP Resolution (fromIp): Resolve a node from an IP address by checking the cache (addressToNodeMap) or querying the metadata from the Cassandra cluster. If an incorrect mapping is found, it should retry after clearing the cache for that entry.
  2. UUID Resolution (fromUUID): Resolve a node from a UUID using the idToNodeMap. If the UUID is not in the cache, it will query the metadata for the corresponding node.
  3. Caching: The class will cache the results in two concurrent maps to improve lookup performance, with one map keyed by InetAddress and another by UUID.
  4. Metadata Lookup: The class will use the CqlSession to query the cluster’s metadata to find the corresponding Node when resolving by IP or UUID.

Acceptance Criteria:

  1. Concurrency: The addressToNodeMap and idToNodeMap must handle concurrent access in a thread-safe manner.
  2. Correct IP-to-Node Mapping: The method fromIp must handle situations where the IP address changes, removing incorrect mappings and retrying the resolution process to ensure accuracy.
  3. UUID Resolution: The method fromUUID should always attempt to resolve nodes by UUID through both cache lookups and metadata queries, and return an empty result if no match is found.

Definition of Done:

  1. The NodeResolverImpl class is implemented with all methods defined, including caching and metadata lookups.
  2. Unit tests are written to cover both success and failure scenarios for node resolution by IP and UUID, including scenarios where incorrect IP-to-node mappings are corrected.
  3. Code passes static analysis tools (e.g., PMD, Checkstyle) and adheres to coding standards.
  4. Documentation is provided for all public methods explaining their behavior, parameters, and exceptions.
  5. Integration tests are written to validate correct interaction with real or mock CqlSession and Metadata.

Notes:

Related to #652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PoC/Agent Tasks related to new generation of ecchronos as an agent
Projects
None yet
Development

No branches or pull requests

1 participant