emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
5.04k stars 328 forks source link

not detecting changes to SQLite in WAL mode #150

Open malhal opened 7 years ago

malhal commented 7 years ago

On OS X 10.11.6 with fswatch 1.9.2

$fswatch Untitled.sqlite-wal

Make a change to the database (e.g. add a row) and no file changes are reported despite the file having actually changed, timestamp updated. Reporting this issue because the Readme said there are no known issues with FSEvents method. On the other hand, the poll_monitor method does report the changes correctly.

$fswatch -m poll_monitor Untitled.sqlite-wal
path_to/Untitled.sqlite-wal

Recreate this using Base first creating the new Untitled.sqlite then in options under journal_mode select 'wal'. Click the + add a table name Event and click plus and enter Name title and Type TEXT. Then on the Table, Data tab use the plus to add the rows to the database to make the changes.

The wal file might be being written to in a way that doesn't trigger an FS event. Finder doesn't detect the change either.

emcrisostomo commented 7 years ago

Hi @malhal,

I've just tried to replicate it and I confirm that the FSEvents API does not return an event in the situation you describe. If I'm mistaken about something, I don't know what it is. The fact that Finder doesn't detect the change either is a strong indicator that FSEvents is incapable of detecting it.

This issue is worth some research time.

holyspidoo commented 6 years ago

Exact same problem I ran into :)

Any hope for this issue? Or is there a better way altogether to monitor sqlite files for changes (instead of monitoring files changes)?

nicad commented 5 years ago

Also ran into this while looking at sqlite files from iCloud

hepcat72 commented 3 years ago

Yup. +1. I wrote a script to process reminders changes and thought using fswatch might be an efficient means of deciding when it should run...

I guess it shouldn't be too bad to use -m poll_monitor for my use case with a single file.