Hi,
I am facing some issues with delete operation in Cassandra-0.7.0 using C++ Thrift API. Please
find details here:
C++ Thrift Machine: Linux 64-bit
1. I am using remove thrift API to delete either column or column family. Problem in this
is when I call remove then it hangs forever (never returns back). Please find my code details
here:
cassClient->set_keyspace(keySpace);
ColumnPath clnPath;
clnPath.column_family = columnFamily;
if(columnOrSuperColumnName.size() > 0){
if(isSuperColumn) {
clnPath.__isset.super_column = true;
clnPath.super_column = columnOrSuperColumnName;
} else {
clnPath.__isset.column = true;
clnPath.column = columnOrSuperColumnName;
}
}
//DIAGC("mssRME", 1, "About to run remove...");
cassClient->remove(key, clnPath, delTimeStamp, consisLevel);
//DIAGC("mssRME", 1, "Success! remove...");
1. I have tried with batch_mutate thrift API. With this operations goes smoothly but I end
up getting deleted column/columnfamily/key back when I perform get operation after delete.
Looks like delete operation did not work. Please find sample code here:
map<string, vector<Column> >::iterator iter = SCNameAndCols.begin(); //SuperColumn
name as key - Vector containing columns in each super column
std::vector<Mutation> mv;
while(iter != SCNameAndCols.end()) { //Iterate through each SuperColumn one after
another
SuperColumn sc;
ColumnOrSuperColumn cs;
Mutation mu;
` mu.__isset.deletion = true;
mu.deletion.timestamp = delTimeStamp; //This is latest timestamp in miliseconds
mu.deletion.__isset.predicate = true;
mu.deletion.super_column = (*iter).first;
mu.deletion.predicate.__isset.column_names = true;
for(int i = 0; i < (*iter).second.size(); i++) {
mu.deletion.predicate.column_names.push_back((*iter).second[i].name);
}
mv.push_back(mu);
iter++;
}//End of While loop
std::map<std::string, std::vector<Mutation> > innMap;
innMap[CFName] = mv;
std::map<std::string, std::map<std::string, std::vector<Mutation> >
> outMap;
outMap[Key] = innMap;
//DIAGC("mssRME", 1, "About to run batch_mutate...");
cassClient->batch_mutate(outMap, consisLevel);
//DIAGC("mssRME", 1, "Success! batch_mutate...");
Any help would be appreciated.
Thank you,
Jaydeep
|