Commit graph

15 commits

Author SHA1 Message Date
Joey Hess
0b146f9ecc reorg threads 2012-06-25 16:10:24 -04:00
Joey Hess
28e28bc043 stub syncer thread and commit channel 2012-06-22 14:10:25 -04:00
Joey Hess
33b914bcf1 pending adds now retried for kqueue
Rethought how to keep track of pending adds that need to be retried later.
The commit thread already run up every second when there are changes,
so let's keep pending adds queued as changes until they're safe to add.

Also, the committer is now smarter about avoiding empty commits when
all the adds are currently unsafe, or in the rare case that an add event
for a symlink is not received in time. It may avoid them entirely.

This seems to work as before for inotify, and is untested for kqueue.

(Actually commit batching seems to be improved for inotify, although I'm
not sure why. I'm seeing only two commits made during large batch
operations, and the first of those is the non-batch mode commit.)
2012-06-20 19:29:53 -04:00
Joey Hess
57cf65eb6d fix kevent symlink creation 2012-06-19 02:40:21 -04:00
Joey Hess
7a09d74319 lifted out the kqueue and inotify to a generic DirWatcher interface
Kqueue code for dispatching events is not tested and probably doesn't
build.
2012-06-18 23:49:07 -04:00
Joey Hess
22b563408b refactor 2012-06-19 02:13:39 +00:00
Joey Hess
3d163f5ff9 fix build 2012-06-19 01:52:07 +00:00
Joey Hess
d680ff7ef0 kqueue code compiles on debian kfreebsd 2012-06-18 16:34:08 -04:00
Joey Hess
a39b73d118 recurse dirTree and open the directories for kqueue to watch 2012-06-18 13:01:58 -04:00
Joey Hess
3c8a9043b6 skeleton C library for calling kqueue 2012-06-18 12:25:20 -04:00
Joey Hess
91567ab8f6 make inotify a build flag etc 2012-06-17 17:15:56 -04:00
Joey Hess
1863185693 startup check fixes
Move lsof check, and display a message before daemon startup if on an
unsupported OS.
2012-06-17 14:21:29 -04:00
Joey Hess
c27c751b34 preliminary deferring of file adds to commit time
Defer adding files to the annex until commit time, when during a batch
operation, a bundle of files will be available. This will allow for
checking a them all with a single lsof call.

The tricky part is that adding the file causes a symlink change inotify.
So I made it wait for an appropriate number of symlink changes to be
received before continuing with the commit. This avoids any delay
in the commit process. It is possible that some unrelated symlink change is
made; if that happens it'll commit it and delay committing the newly added
symlink for 1 second. This seems ok. I do rely on the expected symlink
change event always being received, but only when the add succeeds.

Another way to do it might be to directly stage the symlink, and then
ignore the redundant symlink change event. That would involve some
redundant work, and perhaps an empty commit, but if this code turns
out to have some bug, that'd be the best way to avoid it.

FWIW, this change seems to, as a bonus, have produced better grouping
of batch changes into single commits. Before, a large batch change would
result in a series of commits, with the first containing only one file,
and each of the rest bundling a number of files. Now, the added wait for
the symlink changes to arrive gives time for additional add changes to
be processed, all within the same commit.
2012-06-15 19:00:06 -04:00
Joey Hess
ff2414427b implement daemon status serialization to a file
Also afterLastDaemonRun, with 10 minute slop to handle majority of clock
skew issues.
2012-06-13 13:35:15 -04:00
Joey Hess
ccc5005245 reorganize 2012-06-13 12:46:39 -04:00