scenario: We use 'COPY TO' to export queried data from one cassandra node (named node1), and then use 'COPY FROM' to import these csv data to another cassandra node (named node2).
After data migrate, we query data on node2. Query failed and get ERROR info in system.log.
Our query command (query in VScode) is:
select * from pattern.task where session_name='xxx'
Get the Query Error:
ResponseError: Server failure during read query at consistency LOCAL_ONE (1 responses were required but only 0 replicas responded, 1 failed).
The ERROR info in system.log is:
ERROR [ReadStage-2] 2024-01-11 18:16:43,502 StorageProxy.java:2025 - Scanned over 100001 tombstones during query 'SELECT * FROM pattern.task WHERE session_name = XXX LIMIT 5000' (last scanned row token was - xxx and partion key was ((xxx), xxx)); query aborted
However, if we run query in ./bin/cqlsh, we can query success. Also, the same query command in node1 can success.
How can I fix this problem? And this problem is related to tombstone or 'COPY FROM' command?
The 'COPY FROM' command finished successfully, so I am not sure whether this problem is caused by this command. But we can use the same command in node1.
There are many unknown things in this question.
patterns.tasktable look like? RunDESCRIBE TABLE patterns.task;via the CQLSH to fetch that.Having said that, it appears to me that this cluster is suffering from multiple problems like,
LIMIT 5000doesn't seem to be useful here and is further aggrevating the tombstone read problemAs a first step(s) to bandaid this problem, try using the full primary key as part of the read query and reduce the limit size such that you can help alleviate the tombstone problem. Next, attempt doing the
nodetool garbagecollecton the cluster nodes to remove the tombstones. Since I do not know the version of C*, I'm not sure if this command is supported in the version that you're running, so validate that. Next, perform a thorough end-to-end data modeling exercise to understand the use case and build an efficient table schema that can scale seamlessly.