Skip to content

Remove consistency level downgrade retry in CassandraClient - #272

Merged
heesung-sohn merged 3 commits into
feat/kafka-supportfrom
feat/kafka-support-heesung
Sep 19, 2026
Merged

heesung-sohn merged 3 commits into
feat/kafka-supportfrom
feat/kafka-support-heesung

Conversation

@heesung-sohn

Copy link
Copy Markdown

The current query retry logic applies "CL downgrade" in case of errors.

CompletionStage<Tuple2<AsyncResultSet, ConsistencyLevel>> executeWithDowngradeConsistencyRetry(
CqlSession cqlSession,
BoundStatement boundStatement,
List<ConsistencyLevel> consistencyLevels) {
final ConsistencyLevel cl = consistencyLevels.remove(0);
final BoundStatement statement = boundStatement.setConsistencyLevel(cl);
log.debug("Trying with CL={} statement={}", cl, statement.getPreparedStatement().getQuery());
final CompletionStage<Tuple2<AsyncResultSet, ConsistencyLevel>> completionStage =
cqlSession.executeAsync(statement).thenApply(rx -> new Tuple2<>(rx, cl));
return completionStage
.handle((r, ex) -> {
if (ex == null || !(ex instanceof UnavailableException) || consistencyLevels.isEmpty()) {
log.debug("Executed CL={} statement={}", cl, statement.getPreparedStatement().getQuery());
return completionStage;
}
return completionStage
.handleAsync((r1, ex1) ->
executeWithDowngradeConsistencyRetry(cqlSession, statement, consistencyLevels))
.thenCompose(Function.identity());
})
.thenCompose(Function.identity());
}

the Source sends the query to the Node that sent the "event".
It tries to read at CL.QUORUM, then falls back to CL.ONE

it is really dangerous because it may miss some updates and get an inconsistent view over the row

we should consider to remove this CL downgrade.

@eolivelli eolivelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@heesung-sohn
heesung-sohn merged commit e232fc5 into feat/kafka-support Sep 19, 2026
26 checks passed
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

Successfully merging this pull request may close these issues.

2 participants