Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression in incremental Watchman queries on Windows #1231

Closed
wants to merge 1 commit into from

Conversation

robhogan
Copy link
Contributor

@robhogan robhogan commented Mar 6, 2024

Summary:
D52513808 introduced a startup regression in Watchman crawling on Windows where a clock key was incorrectly calculated due to more strict behaviour around path separators.

This meant the clock was not matched with cached state, and the crawler would fall back to a "glob" query, rather than the (typically much cheaper) incremental "since" query.

The bug isn't in the new RootPathUtils itself, which already states its assumptions (including "All input path separators must be system-native."), but rather in the failure to properly normalise a particular response from Watchman (which returns posix separators, even on Windows) to Metro's system-native paths, before using pathUtils.absoluteToNormal. Note that we already normalise other responses from Watchman to system separators.

Before D52513808 we would've deemed the path too complex to handle and fallen back to path.relative, which is much slower but more forgiving.

Changelog

* **[Fix]**: Fix startup time regression when using Watchman on Windows with a warm cache.

Differential Revision: D54592646

Summary:
D52513808 introduced a startup regression in Watchman crawling on Windows where a clock key was incorrectly calculated due to more strict behaviour around path separators.

This meant the clock was not matched with cached state, and the crawler would fall back to a "glob" query, rather than the (typically much cheaper) incremental "since" query.

The bug isn't in the new `RootPathUtils` itself, which already states its assumptions (including `"All input path separators must be system-native."`), but rather in the failure to properly normalise a particular response from Watchman (which returns posix separators, even on Windows) to Metro's system-native paths, before using `pathUtils.absoluteToNormal`. Note that we already normalise other responses from Watchman to system separators.

Before D52513808 we would've deemed the path too complex to handle and fallen back to `path.relative`, which is much slower but more forgiving.

Changelog
```
* **[Fix]**: Fix startup time regression when using Watchman on Windows with a warm cache.
```

Differential Revision: D54592646
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 6, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D54592646

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in d661377.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants