RRM
RRM

Reputation: 2660

Cassandra table doesn't have tombstones for deleted rows

I've a simple emp table:

CREATE TABLE emp (
  empid int,
  deptid int,
  first_name text,
  last_name text,
  PRIMARY KEY (empid, deptid)
) WITH ...

I inserted 10 records. Then deleted 1 record and checked the json for table. It was like following:

...
{"key": "0000000a","columns": [["1003:","",1427796440909000], ["1003:first_name","fn10",1427796440909000], ["1003:last_name","ln10",1427796440909000]]},
{"key": "00000001","metadata": {"deletionInfo": {"markedForDeleteAt":1427797012545000,"localDeletionTime":1427797012}},"columns": []},
{"key": "00000008","columns": [["1001:","",1427796419431000], ["1001:first_name","fn8",1427796419431000], ["1001:last_name","ln8",1427796419431000]]},
...

So, 1 record is correctly marked for deletion. Next I deleted all records from the table and select * from emp doesn't return anything on cqlsh prompt.

However, when I check the json for table, I get the same output as after 1 record deletion. This is a dev environment and entire data was in 1 sstable.

Why are tombstones for other deleted records not reflected in json output for the table?

Upvotes: 0

Views: 204

Answers (1)

Chris Lohfink
Chris Lohfink

Reputation: 16400

Its in the memtable thats merged with the sstables. Do a nodetool flush before the sstable2json to see whats currently in memtable & commit logs.

Upvotes: 2

Related Questions