Problem
A statement executed with LOCAL_SERIAL or SERIAL consistency level is serialized through the Paxos/serial path on the server side, but the Python driver's TokenAwarePolicy only checks is_lwt() (based on server prepare metadata) when deciding whether to skip replica shuffling.
This means a query like:
statement = SimpleStatement("SELECT * FROM table WHERE pk=?", consistency_level=ConsistencyLevel.LOCAL_SERIAL)
will still have its replicas shuffled in TokenAwarePolicy, instead of preserving replica order like true LWT statements.
Why this matters
LOCAL_SERIAL reads can contend with LWT writes on the same partition. If such reads are routed with shuffled replicas instead of the deterministic LWT routing order, they may miss the intended LWT routing behavior (consistent first-replica coordination for Paxos performance).
Expected behavior
TokenAwarePolicy should treat statements whose consistency level is SERIAL or LOCAL_SERIAL as LWT-routing candidates, preserving replica order (no shuffle), even when is_lwt() returns False.
Related
This is the Python driver equivalent of scylladb/java-driver#885
Problem
A statement executed with
LOCAL_SERIALorSERIALconsistency level is serialized through the Paxos/serial path on the server side, but the Python driver'sTokenAwarePolicyonly checksis_lwt()(based on server prepare metadata) when deciding whether to skip replica shuffling.This means a query like:
will still have its replicas shuffled in
TokenAwarePolicy, instead of preserving replica order like true LWT statements.Why this matters
LOCAL_SERIALreads can contend with LWT writes on the same partition. If such reads are routed with shuffled replicas instead of the deterministic LWT routing order, they may miss the intended LWT routing behavior (consistent first-replica coordination for Paxos performance).Expected behavior
TokenAwarePolicyshould treat statements whose consistency level isSERIALorLOCAL_SERIALas LWT-routing candidates, preserving replica order (no shuffle), even whenis_lwt()returnsFalse.Related
This is the Python driver equivalent of scylladb/java-driver#885