2
votes

I've a cassandra table definition as following

CREATE TABLE mytable
(
  colA text,
  colB text,
  timeCol timestamp,
  colC text,
  PRIMARY KEY ((colA, colB, timeCol), colC)
) WITH....

I want to know if number of tombstones would vary between following types of queries:

1. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111

Above query affect multiple records, (multiple values of colC)

2. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111 AND colC = '...'

However, 2nd query needs to be executed for each value of last column colC, while 1st query takes care of deletion in one execution

Will Cassandra create same number of tombstones in both the cases?

1
Is there a tool using which I could inspect the tombstones created in Cassandra? That could help answer my question very easily.RRM
You can use the following tool to inspect your sstables (you may also have to use nodetool flush): datastax.com/documentation/cassandra/2.0/cassandra/tools/…Stefan Podkowinski

1 Answers

2
votes

Cassandra will create a single tombstone for each delete statement. However, each statement will create a different type of tombstone.

1. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111

Will create a row level tombstone:

{ "key": "00032e2e2e0000032e2e2e000008000000000000006f00", "metadata": { "deletionInfo": { "markedForDeleteAt":1427461335167000,"localDeletionTime":1427461335 } }, "columns": [] }

Row level tombstones will make sure all columns will be covered with the delete.

2. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111 AND colC = '...'

Creates a column tombstone:

{ "key": "00032e2e2e0000032e2e2e000008000000000000006f00", "columns": [["...","...:!",1427461572135000,"t",1427461572]] }

This will only delete values that have been saved under this clustering key.