get_range_slice returns removed data
------------------------------------
Key: CASSANDRA-752
URL: https://issues.apache.org/jira/browse/CASSANDRA-752
Project: Cassandra
Issue Type: Bug
Components: Core
Affects Versions: 0.5
Environment: Windows XP; Linux 2.6.30, JDK 1.6.0-17
Reporter: Omer van der Horst Jansen
m running into an issue with Cassandra 0.5 (the current release version) that
sounds exactly like the description of issue CASSANDRA-647. I'm creating a new
ticket given that 647 has been closed and this issue may have a different cause.
I'm using the Thrift Java API to store a couple of columns in a single row. A
few seconds after that my application deletes the entire row. A plain
Cassandra.Client.get() will then throw a NotFoundException for that particular
key, as expected. However, the key will still show up when executing a
Cassandra.Client.get_range_slice query.
Here is some quick and dirty Java code that demonstrates the problem:
import java.util.List;
import org.apache.cassandra.service.*;
import org.apache.thrift.protocol.*;
import org.apache.thrift.transport.*;
public class CassandraTestApp
{
/**
* Demonstrates CASSANDRA-647 symptom presence in Cassandra 0.5 release.
* Requires an unmodified Cassandra configuration except that an
* OrderPreservingPartitioner should be used.
*/
public static void main(String[] args) throws Exception
{
String keyspace = "Keyspace1";
String cf = "Standard1";
String key = "testrow1";
byte[] columnName = "colname".getBytes();
byte[] data = "testdata".getBytes();
TTransport transport = new TSocket("localhost", 9160);
TProtocol protocol = new TBinaryProtocol(transport);
Cassandra.Client client = new Cassandra.Client(protocol);
transport.open();
ColumnPath path = new ColumnPath(cf, null, columnName);
client.insert(keyspace, key, path, data, System.currentTimeMillis(),
ConsistencyLevel.ONE);
Thread.sleep(1000);
ColumnPath rowpath = new ColumnPath(cf, null, null);
client.remove(keyspace, key, rowpath, System.currentTimeMillis(),
ConsistencyLevel.ONE);
Thread.sleep(1000);
try
{
ColumnOrSuperColumn cosc = client.get(keyspace, key, path,
ConsistencyLevel.ONE);
System.out.println("Whoops! NotFoundException not thrown!");
}
catch (NotFoundException e)
{
System.out.println("OK, as expected we got a NotFoundException");
}
ColumnParent parent = new ColumnParent(cf, null);
SlicePredicate predicate = new SlicePredicate();
SliceRange range = new SliceRange();
range.start = new byte[0];
range.finish = new byte[0];
predicate.slice_range = range;
List<KeySlice> sliceList = client.get_range_slice(keyspace, parent,
predicate, "", "", 1000,
ConsistencyLevel.ONE);
for (KeySlice k : sliceList)
{
System.out.println("Found key " + k.key);
if (key.equals(k.key))
{
System.out.println("but key " + k.key
+ "should have been removed");
}
}
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.