JeremyGrosser / tablesnap

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

Allow tablesnap to include listening to IN_CREATE #84

Closed juiceblender closed 6 years ago

juiceblender commented 6 years ago

Hi Jeremy,

This is a simple PR to allow tablesnap to also be able to watch for IN_CREATE events, which can be useful for commitlog_archiving. With commitlog_archiving, the typical command is to create a hard link once the CLog is full; however with the current inotify events it does not see it:

archive_command: /bin/ln %path /backup/%name

Having tablesnap watch the /backup directory, everytime there is a new link...nothing happens. If the command was /bin/cp, it works (but that will incur a performance impact)

From my own debugging, it seems like the event is IN_CREATE:

<Event dir=False mask=0x100 maskname=IN_CREATE name=sigh.txt path=/cassandra/commitlog_archive pathname=/cassandra/commitlog_archive/sigh.txt wd=1 >

This will make tablesnap useful for backing up CLogs as well, WDYT? I tested it on my test cluster.

Thanks!