evolution-gaming/cassandra-sync

Mixing LTX and normal operations is discouraged by Cassandra docs

migesok opened this issue · 0 comments

Current statements used on the locks table:

INSERT INTO keyspace.locks (id, expiry_ms, timestamp, metadata) VALUES (?, ?, ?, ?)
  IF NOT EXISTS USING TTL ?;

DELETE FROM keyspace.locks WHERE id = ?;

First INSERT uses lightweight transactions and the second DELETE doesn't use them.
Cassandra docs explicitly prohibit such usage:
https://docs.datastax.com/en/ddac/doc/datastax_enterprise/dbInternals/dbIntLtwtTransactions.html

Lightweight transactions will block other lightweight transactions from occurring, but will not stop normal read and write operations from occurring. Lightweight transactions use a timestamping mechanism different from normal operations, so mixing lightweight transactions and normal operations can result in errors. If lightweight transactions are used to write to a row within a partition, only lightweight transactions for both read and write operations should be used. This caution applies to all operations, whether individual or batched.