Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.x|4.x: LWT Statements routing decision is ignoring lb policy #371

Open
dkropachev opened this issue Nov 19, 2024 · 0 comments
Open

3.x|4.x: LWT Statements routing decision is ignoring lb policy #371

dkropachev opened this issue Nov 19, 2024 · 0 comments

Comments

@dkropachev
Copy link
Collaborator

dkropachev commented Nov 19, 2024

Both 3.x and 4.x ignore LoadBalancingPolicy and return all the replicas in the same order they get it from vnodes or tablets for LWT statements and it seems wrong to me:

  • Java 3.x
    if (statement.getHost() != null) {
    this.queryPlan = new QueryPlan(Iterators.singletonIterator(statement.getHost()));
    } else if (statement.isLWT()) {
    this.queryPlan =
    new QueryPlan(
    getReplicas(
    manager.poolsState.keyspace,
    statement,
    manager
    .loadBalancingPolicy()
    .newQueryPlan(manager.poolsState.keyspace, statement)));
    } else {
    this.queryPlan =
    new QueryPlan(
    manager.loadBalancingPolicy().newQueryPlan(manager.poolsState.keyspace, statement));
    }
  • Java 4.x
    if (this.initialStatement.getNode() != null) {
    queryPlan = new SimpleQueryPlan(this.initialStatement.getNode());
    } else if (this.initialStatement.isLWT()) {
    queryPlan =
    getReplicas(
    session.getKeyspace().orElse(null),
    this.initialStatement,
    context
    .getLoadBalancingPolicyWrapper()
    .newQueryPlan(initialStatement, executionProfile.getName(), session));
    } else {
    queryPlan =
    context
    .getLoadBalancingPolicyWrapper()
    .newQueryPlan(initialStatement, executionProfile.getName(), session);
    }
    sendRequest(initialStatement, null, queryPlan, 0, 0, true);
    }

As result there is no way to make them target rack or dc, even more than that, when user feeds RackAwareRoundRobinPolicy to cluster config LWT queries are getting routed, unexpectedly, to all racks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant