Skip to content

Commit f8fceec

Browse files
nikagraCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1292aad commit f8fceec

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

driver-core/src/main/java/com/datastax/driver/core/policies/TokenAwarePolicy.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
* HostDistance#LOCAL LOCAL} replicas for the query <em>if possible</em> (i.e. if the query's
5555
* {@linkplain Statement#getRoutingKey(ProtocolVersion, CodecRegistry) routing key} is not
5656
* {@code null} and if the {@linkplain Metadata#getReplicasList(String, String, Token.Factory,
57-
* ByteBuffer)} (String, ByteBuffer) set of replicas} for that partition key is not empty). If
57+
* ByteBuffer) set of replicas} for that partition key is not empty). If
5858
* no local replica can be either found or successfully contacted, the rest of the query plan
5959
* will fall back to the child policy's one.
6060
* </ul>
@@ -81,9 +81,10 @@
8181
* primary replica ordering from the token ring).
8282
* <li>Remote replicas second: remaining replicas (typically in remote datacenters) are appended,
8383
* but only if they are up and not ignored by the child policy.
84-
* <li>No non-replica hosts: unlike regular queries, LWT plans do not fall back to non-replica
85-
* hosts, ensuring all attempts target actual replicas to maintain LWT correctness and reduce
86-
* coordinator forwarding overhead.
84+
* <li>Replica-only routing when possible: under normal conditions, LWT query plans target only
85+
* replicas for the partition in order to reduce coordinator forwarding overhead and improve
86+
* performance. When replica information is unavailable, the driver falls back to the child
87+
* policy as described in the fallback behavior below, which may include non-replica hosts.
8788
* </ul>
8889
*
8990
* <p><strong>Rack awareness</strong> is intentionally <em>not</em> applied to LWT replica ordering.

driver-core/src/test/java/com/datastax/driver/core/policies/TokenAwarePolicyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ public void should_properly_generate_and_use_routing_key_for_composite_partition
755755
assertThat(rs.getExecutionInfo().getQueriedHost()).isEqualTo(host1);
756756
assertThat(rs.isExhausted()).isFalse();
757757
Row r = rs.one();
758-
assertThat(rs.getExecutionInfo().getQueriedHost()).isEqualTo(host1);
758+
759759
assertThat(rs.isExhausted()).isTrue();
760760

761761
assertThat(r.getInt("i")).isEqualTo(3);

0 commit comments

Comments
 (0)