What is mutation in cassandra?

2019-05-06 16:07发布

问题:

What is mutation in cassandra? What is it doing? i didnt find any full information about it... Can you answer or share the link with manual or description Thanks

回答1:

From http://wiki.apache.org/cassandra/API:

Mutation

A Mutation encapsulates either a column to insert, or a deletion to execute for a key. Like ColumnOrSuperColumn, the two properties are mutually exclusive - you may only set one on a Mutation.



回答2:

Mutation is a thrift-generated class defined in the cassandra.thrift file. You can find this file in the interface folder under your cassandra folder:

/**
    A Mutation is either an insert (represented by filling column_or_supercolumn)
    or a deletion (represented by filling the deletion attribute).
    @param column_or_supercolumn. An insert to a column or supercolumn
        (possibly counter column or supercolumn)
    @param deletion. A deletion of a column or supercolumn
*/
struct Mutation {
    1: optional ColumnOrSuperColumn column_or_supercolumn,
    2: optional Deletion deletion,
}

where ColumnOrSuperColumn and Deletion are also thrift objects, defined in the same file.