Repository navigation
Watch only the directories a table glob can reach - #1757
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1756
The watcher's directory walk (
scan_dirs) now prunes by the table globs, as the scan does: it enters only directories a table glob can reach and those on the way to them, andreaches_dir(which gates watching a directory that appears later) applies the same glob check. A matcher with no tables still enters everything. Gitignore handling is unchanged.Symlinks (ruling: option (a)): the watch walk follows a symlinked directory a glob reaches and lists it once, at its canonical target, when that target lies under the root (one inotify watch per inode; events arrive at the target and are restated at the link path by the existing
Linkmapping). EachWatchScoperemembers the links its walks entered, so a directory created later under such a target is walked through the link (WatchScope::walk_starts) and watched too. A target outside the root is not watched.Red:
Unit testsjob 134949367111 (run 44346259769) failed onscan_dirs_lists_only_the_directories_a_table_glob_can_reach(leftheldsrc/0...src/49/deep,.dirsql,docs/.cache;right= root,docs,docs/guide).Integration testsjob 135014396395 (run 44359974745, commit 703b47b) failed onan_edit_at_a_target_no_glob_reaches_updates_the_rows_reached_through_the_linkanda_directory_made_later_under_a_target_no_glob_reaches_is_watched_through_the_link(got: []).Manual exercise:
dirsql server -c .dirsql.tomlwith one tabledocs/**/*.mdover a tree of 1004 directories (500src/N/deep): inotify watches 3 (was 1007 on the previous build). Adocs/<new>/b.mdwritten after startup still showed up inSELECT count(*).real/x.txt,link -> real,other/a,other/b, one tablelink/**/*.txt: 2 inotify watches (root,real). After startup,mkdir real/sub, writereal/sub/y.txt, rewritereal/x.txt: the query returned both new bodies (three,two).E2E Verification
cargo test)packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python)packages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)uv run maturin develop --release, thentesting-conventions e2e attest 'uv run python -m pytest tests/e2e/watch_fault_test.py tests/e2e/watch_speed_test.py tests/e2e/fanout_test.py tests/e2e/fresh_declared_repros_test.py tests/e2e/many_dirs_speed_test.py tests/e2e/query_contract_test.py tests/e2e/glob_speed_symlink_test.py -q -rf';pnpm run build, thentesting-conventions e2e attest 'pnpm exec vitest run --dir tests/e2e fresh-declared-repros fanout'watch_speed_testis noisy on this host (sub-millisecond native median): interleaved A/B, the branch passed 6/8 andmain4/8.Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package (or:skip-changelogtrailer on a commit with reason)<root>/<pkg>/migrations.d/for each changed package (every subsection but Summary_None._when nothing breaks)