Guillaume Nodet created CAMEL-24595:
---------------------------------------
Summary: CassandraKeyValueRepository: implement atomic replace()
and delete(key, expected) using lightweight transactions
Key: CAMEL-24595
URL: https://issues.apache.org/jira/browse/CAMEL-24595
Project: Camel
Issue Type: Improvement
Components: camel-cassandraql
Reporter: Guillaume Nodet
CassandraKeyValueRepository.putIfAbsent() already uses Cassandra's lightweight
transactions (INSERT ... IF NOT EXISTS) for atomic CAS semantics, but
replace(key, expected, newValue, ttl) and delete(key, expected) fall back to
the non-atomic default implementation from the KeyValueRepository SPI
(read-then-write).
Cassandra natively supports conditional mutations that would make these truly
atomic:
- UPDATE ... SET value = ? WHERE key = ? IF value = ? for replace()
- DELETE FROM ... WHERE key = ? IF value = ? for delete(key, expected)
This would bring the Cassandra backend in line with putIfAbsent() which already
uses LWT for true server-side CAS.
Flagged during review of [PR #25993|https://github.com/apache/camel/pull/25993]
by [~davsclaus]: [review
comment|https://github.com/apache/camel/pull/25993#discussion_r3913781654]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)