Thin client partition awareness and affinity routing
This page is a public product-spec reconstruction from Apache Ignite 2 test sources at revision 486a6367610c4c891b729e89373695ef83165345.
Partition-awareness tests describe how the thin client uses topology and affinity metadata to route supported operations toward the best known server connection.
User-facing guarantees
- A partition-aware thin client routes supported single-key cache operations using server topology and affinity metadata.
- The client refreshes or releases affinity mappings when topology, cache mappings, or client lifecycle changes.
- Metrics expose affinity hits/misses for cache-key and query routing scenarios.
Traceable requirements
Only negative or ambiguous test status is annotated after a test name, for example status=failed, status=flaky, status=ignored, or status=mixed.
THIN-PA-STABLE-01 — single-key cache operations route by affinity on stable topology
Requirement: For stable topologies, partition-aware routing must handle primitive keys, complex keys, affinity-key annotations/configuration, replicated caches, backup counts, node filters, and custom affinity mapper cases.
Why: Applications get lower-latency routing without manually selecting server endpoints.
Boundary: Mostly evidence: routing/protocol behavior is asserted more directly than operation result semantics.
Evidence tests:
org.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCustomAffinityCacheWithMapperorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCachePrimitiveKeyorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCacheComplexKeyorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCacheAnnotatedAffinityKeyorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCacheNotAnnotatedAffinityKeyorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCache0Backupsorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCache1Backupsorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCache3Backupsorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedWithNodeFilterorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testReplicatedCacheorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCustomAffinityCacheorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedCacheUnknownNodeorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testPartitionedWithNodeFilter1
THIN-PA-GROUPING-01 — affinity mappings are reused only when compatible
Requirement: The client must group caches with equivalent affinity mappings and request separate mappings when effective affinity differs.
Why: This limits metadata traffic without routing requests through an incompatible mapping.
Boundary: Evidence from protocol/request-count assertions; does not prove all custom affinity combinations.
Evidence tests:
org.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testCacheGroupWithNodeFilterorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testGroupingOfVariousAffinitiesorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testGroupingOfEqualAffinitiesorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testMultipleCacheGroupAffinityMappingRequest
THIN-PA-AUX-OPS-01 — scan query, set and atomic-long operations participate where supported
Requirement: Partition-bound scan queries, IgniteSet operations, collocated sets, and AtomicLong reads must use affinity-aware routing in tested cases.
Why: Non-cache-key APIs should benefit from affinity metadata when their data placement is known.
Boundary: Evidence; proves routing participation, not full semantic correctness of every operation.
Evidence tests:
org.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testScanQueryorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testIgniteSetorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testIgniteSetCollocatedorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessStableTopologyTest.testAtomicLong
THIN-PA-TOPOLOGY-01 — routing refreshes after topology/session changes
Requirement: The client must refresh or recreate routing state after connection loss, node join/leave, cluster restart with lower/same topology version, session close-before-handshake, and create-session-after-close.
Why: Long-running clients should continue routing correctly after operational topology changes.
Boundary: Weaker where tests exercise timing/session races and fallback paths; exact fallback target is not always established.
Evidence tests:
org.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessUnstableTopologyTest.testConnectionLossorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessUnstableTopologyTest.testPartitionAwarenessOnNodeJoinorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessUnstableTopologyTest.testPartitionAwarenessOnNodeLeftorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessUnstableTopologyTest.testPartitionAwarenessOnClusterRestartWithLowerTopologyVersionorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessUnstableTopologyTest.testPartitionAwarenessOnClusterRestartWithSameTopologyVersionorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessUnstableTopologyTest.testSessionCloseBeforeHandshakeorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessUnstableTopologyTest.testCreateSessionAfterCloseorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessDiscoveryTest.testClientDiscoveryNodesJoinorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessDiscoveryTest.testClientDiscoveryNodesLeaveorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessDiscoveryTest.testClientDiscoveryFilterNodeJoin
THIN-PA-MULTIDC-01 — data-center aware routing chooses configured local endpoints
Requirement: With multi-DC settings, partition-aware and non-partition-aware requests must prefer allowed/local endpoint sets and handle no-node-in-DC cases as tested.
Why: Operators can bias thin-client traffic toward the intended data center.
Boundary: Weaker evidence for configured examples only; not an outage-handling or fairness guarantee.
Evidence tests:
org.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessMultiDcTest.testPartitionAwarenessRequestsorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessMultiDcTest.testPartitionAwarenessRequestsNoNodesInDcorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessMultiDcTest.testNonPartitionAwarenessRequestsorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessMultiDcTest.testNonPartitionAwarenessRequestsNoNodesInDc
THIN-PA-RES-METRICS-01 — resources and metrics reflect partition-awareness lifecycle
Requirement: Partition-awareness resources must be released after client close/cache destroy, metrics must count affinity hits/misses, and balancing should distribute connections in the tested setup.
Why: Users need observable routing quality and no retained routing state after lifecycle cleanup.
Boundary: Evidence; balancing is scenario-bound and not a general fairness proof.
Evidence tests:
org.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessResourceReleaseTest.testResourcesReleasedAfterClientClosedorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessResourceReleaseTest.testResourcesReleasedAfterCacheDestroyedorg.apache.ignite.internal.client.thin.AffinityMetricsTest.testCacheKeyAffinityMetricsPartitionedorg.apache.ignite.internal.client.thin.AffinityMetricsTest.testCacheKeyAffinityMetricsReplicatedorg.apache.ignite.internal.client.thin.AffinityMetricsTest.testCacheKeyAffinityMetricsTxorg.apache.ignite.internal.client.thin.AffinityMetricsTest.testQueryAffinityMetricsPartitionedorg.apache.ignite.internal.client.thin.AffinityMetricsTest.testQueryAffinityMetricsReplicatedorg.apache.ignite.internal.client.thin.ThinClientPartitionAwarenessBalancingTest.testConnectionDistribution
Important boundaries
- These tests mainly prove routing/protocol behavior, not returned data correctness for every operation.
- Fallback routing is intentionally weak in several tests: when the expected channel is unknown, completion is stronger evidence than exact fallback target.
- Multi-DC evidence covers configured examples, not outage handling or fairness.