immobiliare/sfs

sfs-sync doesn't create push batch directories

merginator opened this issue · 3 comments

sfs-sync gives the following error message for each node every 10 seconds:

Warning: scandir(/mnt/batches/push/node2): failed to open dir: No such file or directory in /home/sfs/php-sync/sync.php on line 296
Warning: scandir(): (errno 2): No such file or directory in /home/sfs/php-sync/sync.php on line 296
sfs-sync(sched)[7222]: Cannot scan /mnt/batches/push/node2, will retry in 10 seconds

I'm not sure if this is expected behavior, but if it is, it makes things quite noisy.

EDIT: Ok we can check whether the directory exists before scanning, will commit a fix. You can workaround the problem by creating the directories beforehand for each node in /mnt/batches/push in the while.

Yeah, I ended up creating the directories by hand. Your patch is a bit confusing to me though. It's nice that the errors won't be thrown, but shouldn't the code be creating these push directories at some point just like it makes the pull directories? Maybe I'm missing something.

Those directories are created when moving batches to the per-node push directory here: https://github.com/immobiliare/sfs/blob/master/php-sync/sync.php#L445. So the directories will be created when you make the first change to the filesystem.

This commit affects only the scanning of the per-node push directory, so if there's no directory it's because the system hasn't made any change at all yet. No hurry to create directories in this case.