forked from apache/cassandra-java-driver
-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
Problem
LWT prepared statements can fail with "No node was available" when using PRESERVE_REPLICA_ORDER routing (the default for LWT).
The PreserveReplicaOrderIterator in TokenAwarePolicy returns only replicas in the query plan. When replica information is incomplete (e.g. prepared statements before parameter binding) or all replicas are down, the query plan can be empty or insufficient.
Root Cause
In TokenAwarePolicy.PreserveReplicaOrderIterator:
- Pass 1: Returns LOCAL UP replicas
- Pass 2: Returns REMOTE UP replicas
- Pass 3: Falls back to child policy only if no replicas were returned at all
If even one replica was returned, non-replica nodes are never included. With RF=3 and 10 nodes, only 3 nodes appear in the query plan. If those replicas go down after plan construction, there's no fallback.
Expected Behavior
The query plan should always include all available nodes, with replicas prioritized:
- Local DC replicas (order preserved)
- Remote DC replicas (order preserved)
- Local DC non-replicas
- Remote DC non-replicas
Related
Port of #831 (4.x fix)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels