forked from facebook/watchman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
watchman: restructure scm/Mercurial mergebase cache
Summary: I want to use LRUCache in more places in the Mercurial class as it can help to avoid thundering herd issues when multiple subscriptions need the same data. This commit is a first pass that switches from the simple mergeBase cache to a version that uses LRUCache, which simplifies some of the logic in here. One thing worth noting about this change is in how we deal with the possible race condition of someone mutating the repo while a query is being run. The behavior change is this: Previously, if we detected a race, we'd return the potentially bogus result to the caller but not update the value in the cache, so a subsequent call would compute a new value. With the new code we have to return either a value or an error to the cache, so what we do now is include the mtime from the dirstate file in the cache key. If the dirstate changes after we've started our query, other callers will use the updated timestamp as a component in their cache key and won't reuse our result. In both the old and new implementations we'll continue to return the potentially fishy result we computed in the racey scenario. Reviewed By: chadaustin Differential Revision: D22582274 fbshipit-source-id: 5a8587403378f5f8a7672fef09c57e1ddd424a10
- Loading branch information
1 parent
a944041
commit e2e877c
Showing
2 changed files
with
45 additions
and
107 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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