Skip to content

TokenAwarePolicy does not route SERIAL/LOCAL_SERIAL statements as LWT requests #886

@mykaul

Description

@mykaul

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions