I am having a lot of trouble trying to upgrade my existing library from Cassandra 0.6 to 0.7 beta1. I had originally thought it was a order of operations issue, so I decided to break it down to the basics.
Here is the basic setup that I will be suing
TTransport framedTransport = new TFramedTransport(new TSocket("localhost", 9160));
TTransport socketTransport = new TSocket("localhost", 9160);
TProtocol framedProtocol = new TBinaryProtocol(framedTransport);
TProtocol socketProtocol = new TBinaryProtocol(socketTransport);
Then I have tried to vary the setup of the client in the following ways switching the input and output protocols:
var client = new Cassandra.Client(framedProtocol, framedProtocol); // all framed
var client = new Cassandra.Client(socketProtocol, socketProtocol); // all socket
var client = new Cassandra.Client(framedProtocol, socketProtocol); // in: framed out: socket
var client = new Cassandra.Client(socketProtocol, framedProtocol); // in: socket out: framed
Then I execute the following program which uses the default Cassandra configuration that comes from the download and I am doing a simple request such as a count which I expect it to return zero since no data was inserted.
framedTransport.Open();
socketTransport.Open();
Console.WriteLine("Start");
client.set_keyspace("Keyspace1");
var key = System.Text.Encoding.ASCII.GetBytes("MyKey");
var columns = new List<byte[]>(new[] { System.Text.Encoding.ASCII.GetBytes("MyColumn") });
var column_parent = new ColumnParent {
Column_family = "Standard1"
};
var predicate = new SlicePredicate {
Column_names = columns
};
client.get_count(key, column_parent, predicate, ConsistencyLevel.ALL);
Console.WriteLine("Done");
Console.Read();
Each of the 4 different setups I provided above fail to execute. A couple of them just lock up and others throw an exception. So basically I am stuck trying to get a connection to work with the new Cassandra 0.7 with the .NET framework.
Here are the types of problems I found with each:
all framed
: locks up on set_keyspaceall socket
: throws Invalid method name: 'set_keyspace' on set_keyspacein: framed out: socket
: locks up on set_keyspacein: socket out: framed
: locks up on set_keyspace
I am 99% sure it has to do with something I am doing at the Thrift layer of Cassandra since I can't get this simple application to work. But if you want to browser my 0.7 branch you can find it here: