I have a strange issue with Cassandra BATCH INSERT. I'm on local Cassandra, which just have replication factor as 1. The scenario is this:
If I just use INSERT without the BATCH, everything works fine.
Any idea what is the reason?
The reason is that you explicitly specify the timestamp for your batch, and the value that you provide (16783871583
) corresponds to Tue Jul 14 1970 06:11:11
. When you remove this record, Cassandra puts a tombstone record that has the timestamp corresponding to the 10th of March 2023rd. When you execute batch again (with the timestamp from 1970th), the record is inserted, but when you read, this record is shadowed by the tombstone record with higher timestamp and no data is returned as it's marked as deleted.
Really, explicitly specifying timestamps is kind of advanced functionality and you need to 100% understand how Cassandra works to use them.