My problem is that I am not getting immediate delete on single node Cassandra.
The problem occurs only on Windows, when I run Cassandra in Docker container. There is no problem on Linux. I am using datastax driver to connect to Cassandra from Java application.
Flow in test looks like:
- Insert single row to my_lock_table
- Modify schema (same keyspace, creating additional tables, it takes about 300ms)
- Delete row from my_lock_table by partition key
- Select row from my_lock_table by partition key – on Linux there is no result as I expected. But on Windows row that is supposed to be removed is returned by SELECT.
I tried several ways to find out the reason and:
- When I added IF EXISTS clause to the delete query, then it works properly row is gone instantly.
- I tried to delete row again, and it didn’t help. It is strange because it doesn’t matter how many times I call DELETE query – it will not work until 10 seconds have passed. And after 10 seconds since INSERT, if I call DELETE query again, then it works and the row is gone.
- I checked logs of cassandra, and timestamps of queries are in proper order.
Adam Wołek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
So I suspect that this is due to the differences in how the Windows kernel works with certain operations. We had a discussion on this internally (at DataStax), and one thought is that there is likely a race condition with the LWT INSERT, resulting in the DELETE possibly happening before the INSERT takes effect. That’s something that would be more apparent on Windows.
Bottom line: We stopped supporting Cassandra on Windows because Windows does some things which get in the way of Cassandra operating normally (issues with deleting active file handles). To test Cassandra single-node-style, use either Linux or MacOS, WSL, or a containerization/virtualization platform instead.