JeremyGrosser / tablesnap

Uses inotify to monitor Cassandra SSTables and upload them to S3
BSD 2-Clause "Simplified" License
181 stars 86 forks source link

fixing an issue where a subdirectory of the origin arg might be the late... #50

Closed firepub-pfreeman closed 9 years ago

firepub-pfreeman commented 9 years ago

...st 'key' found which causes an exception when reading the json data using the origin key

firepub-pfreeman commented 9 years ago

I ran into a case where a snapshot sub directory for a keyspace (/cassandra/data// contained a '-listdir.json' file with a timestamp equal to or greater than all other such files. This caused an exception when trying to read the file list from the parsed json on line 129 (https://github.com/JeremyGrosser/tablesnap/pull/50/files#diff-7f6f5ab48117d84bc7f443a254f9739fL129).

As a fix for this I added a check of the path length of the key against the path length of the origin argument. That weeds out any such keys. Once that was done, the subdirectory then threw an error at line 198 because the key did not exist for it, even though it was in the '-listdir.json' file.