You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Sanal Vasudevan <ge...@gmail.com> on 2016/11/18 20:55:00 UTC

Cassandra Mutation object decoding

Hi there,

I am trying to read the Commit logs to decode the original CQL which used.
I get to the point an implemention of  CommitLogReadHandler is able to push
back Mutation objects from the Commit logs.

Questions:
1) CQL: delete from myks.mytable where key1  = 1;
For the above CQL, the Mutation object has zero objects of
org.apache.cassandra.db.rows.Row inside ParitionUpdate object.
Is this the only way to detect a DELETE operation? or we have any other
metadata to indicate a DELETE operation?
    mutation.getPartitionUpdates().forEach(rows -> { if(rows.isEmpty())
System.out.println("May be a DELETE operation") });
2) Likewise do we have metadata inside Mutation object to decode whether
the CQL was an INSERT or UPDATE operation?

Josh Mckenzie indicated that PartitionUpdate.deletionInfo
(MutableDeletionInfo) may have some information but deletionInfo is private.

Basically, I am looking for help to find a way to classify Mutation object
to INSERT/UPDATE/DELETE with related column and key information.

Many thanks.
-- 
Sanal

Re: Cassandra Mutation object decoding

Posted by Vladimir Yudovin <vl...@winguzone.com>.
Hi Sanal,



&gt;do we have metadata inside Mutation object to decode whether the CQL was an INSERT or UPDATE operation?

I'm not sure it's possible to distinguish them - both of them just add data to SSTable.





Best regards, Vladimir Yudovin, 

Winguzone - Hosted Cloud Cassandra
Launch your cluster in minutes.





---- On Fri, 18 Nov 2016 15:55:00 -0500Sanal Vasudevan &lt;get2sanal@gmail.com&gt; wrote ----




Hi there, 

 

I am trying to read the Commit logs to decode the original CQL which used. 

I get to the point an implemention of CommitLogReadHandler is able to push 

back Mutation objects from the Commit logs. 

 

Questions: 

1) CQL: delete from myks.mytable where key1 = 1; 

For the above CQL, the Mutation object has zero objects of 

org.apache.cassandra.db.rows.Row inside ParitionUpdate object. 

Is this the only way to detect a DELETE operation? or we have any other 

metadata to indicate a DELETE operation? 

 mutation.getPartitionUpdates().forEach(rows -&gt; { if(rows.isEmpty()) 

System.out.println("May be a DELETE operation") }); 

2) Likewise do we have metadata inside Mutation object to decode whether 

the CQL was an INSERT or UPDATE operation? 

 

Josh Mckenzie indicated that PartitionUpdate.deletionInfo 

(MutableDeletionInfo) may have some information but deletionInfo is private. 

 

Basically, I am looking for help to find a way to classify Mutation object 

to INSERT/UPDATE/DELETE with related column and key information. 

 

Many thanks. 

-- 

Sanal