YK S
YK S

Reputation: 3440

Where is Memtable located in cassandra?

It is mentioned in DataStax that there is one memtable per column-family in Cassandra.

Lets' assume I have a 2 Node Cassandra cluster with RF=2. Now if one of the node fails then the other node is there from which we can retrieve the data. But it is possible that say in my cluster node1 fails then node2 handles the requests for data and after some time node1 is up and node2 fails then it is node1 which handles the request.

So where is memtable located in the cluster? If it is in the node then the statement that there is only one memtable per column-family is incorrect.

Upvotes: 0

Views: 913

Answers (2)

apesa
apesa

Reputation: 12443

You should look into the Cassandra write path for more details. A memtable is a memory structure based off a single CF. When data is written to Cassandra it is first written to the commitLog, then to the memtable then flushed to disk (sstable)

Read more HERE

Upvotes: 1

Chris Lohfink
Chris Lohfink

Reputation: 16400

The memtable is an in memory data structure which can be kept on or offheap for each table on each node.

The memtables periodically flush to new sstables which are merged with the memtable for reads. The commitlog provides durability for the memtable until its flushed.

On a read its the coordinators job to merge the data from the different replicas depending on consistency level requested. If your CL covers both node1 and node2 the coordinator will resolve the missing data. When node1 or node2 go down or a mutation to them are dropped the coordinator will store the mutation in a hint to be delivered when it comes back up. If all that fails the anti entropy repairs will fix any inconsistencies when run.

Upvotes: 3

Related Questions