Netflix / dynomite-manager

A sidecar to manage Dynomite clusters
https://github.com/Netflix/dynomite
Apache License 2.0
91 stars 59 forks source link

Use Datastax Cassandra driver instead of Astyanax #112

Open kelnos opened 5 years ago

kelnos commented 5 years ago

While bringing up dynomite-manager in our environment, I had a lot of trouble getting it to talk to our Cassandra (3.x) cluster, including invalid-query issues, as well as NPEs deep in Astyanax. Updating to the latest version of Astyanax didn't help. So I decided to migrate from Astyanax to the non-deprecated Datastax driver.

I'm a bit new to Cassandra, but what I (believe I) learned while doing this is that how dynomite-manager uses Cassandra is no longer supported in the 3.x series, namely having an effectively schemaless locks table. At least, I was unable to create a table in Cassandra 3.x with no columns, and when d-m attempted to add columns named with the AWS instance ID to the locks table, Cassandra would send back an error.

So, this PR effectively constitutes a schema change for the locks table. The new table expects there to be a "key" column and "instanceid" column. "Key" is still the same "choosingkey" as before, and the instance ID is the AWS instance ID.

The schema for the tokens table is unchanged.

Since this is my first time working with Cassandra, it's certainly possible I've done things incorrectly in some places, and would appreciate any feedback so we can get this into main-line so I don't have to maintain a large fork :)

kelnos commented 5 years ago

(Hmm, looks like CI is failing due to an inability to install a JDK?)