notify-rs / notify

🔭 Cross-platform filesystem notification library for Rust.
https://docs.rs/notify
2.77k stars 222 forks source link

SQLite database changes are not reported correctly under macOS #613

Open mqudsi opened 4 months ago

mqudsi commented 4 months ago

This is a known issue (albeit for unknown reasons) under macOS, but I wanted to log it here for posterity and as a reference for other macOS notify users.

System details

What you did (as detailed as you can)

What you expected

Notifications would be received when the writeahead log is written to or when the WAL is merged back into the db.

What happened

No notifications are received for the database or the WAL. (Manually poking the file with touch foo.db-wal works.)

Since SQLite doesn't really use special APIs to perform file I/O under macOS, the assumption is that there is actually an entire class of writes that don't get caught.

0xpr03 commented 4 months ago

Are you using kqueue or FSEvents to watch the file ?

mqudsi commented 4 months ago

The same thought occurred to me when I ran into this, but unfortunately this observed behavior is the same with both KqueueWatcher and FsEventWatcher.