tbarbugli / cassandra_snapshotter

A tool to backup cassandra nodes using snapshots and incremental backups on S3
Other
222 stars 122 forks source link

Get --keyspaces working with multiple keyspaces #69

Closed CunningBaldrick closed 8 years ago

CunningBaldrick commented 8 years ago

Add support for passing multiple (comma separated) keyspaces with --keyspaces. In the agent that means splitting on commas not on spaces. While spaces could be used to separate keyspaces this requires quoting the argument passed to the agent. Using commas is simpler. While there, don't try to remove files with name the empty string '' (you get this if the manifest is completely empty in incremental mode). The snapshotting logic was conflicted as to whether it was expecting a comma separated or whitespace separated list. Now it gets a real list (this is set up in main.my) or None if no keyspaces passed. The list is then joined with spaces when calling nodetool and with commas when calling the agent. Most of the work was in node_start_backup, which had multiple problems: (1) In incremental mode, if a table was specified, an invalid flush command would be generated (needs a keyspace); (2) In incremental mode, if there are multiple keyspaces then flush has to be called multiple times (because nodetool flush doesn't support flushing multiple keyspaces in one call); (3) In snapshot mode, if a table is specified then at most one keyspace can be provided. While there, fix the schema output when using explicitly specified multiple keyspaces: before you got a file per keyspace, but every file had the same contents: the schema for all keyspaces. Now the schema file for a keyspace only has the schema for that keyspace.

CunningBaldrick commented 8 years ago

Now with tweaked indentation to satisfy the buildbots.