-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland "Maintain 3 separate HPD caches for the HPRT experiment"
This is a reland of commit ee2a607 The difference between this reland and the original upload is in Patchsets 3-4, which set a default value for the PendingCheck field mechanism_experiment_cache_selection because there is a second constructor that does not pass through a value for it. The change includes refactoring some common code out of V4GetHashProtocolManagerTest so that V4LocalDatabaseManagerTest can reuse it. Original change's description: > Maintain 3 separate HPD caches for the HPRT experiment > > Hash-prefix real-time checks and URL real-time checks can both fall back > to the hash-prefix database check (HPD). As such, we don't want the > different mechanisms to share the same HPD cache, to avoid one mechanism > benefitting from cached results of another mechanism's lookup. > > The two backgrounded mechanisms (hash real-time and hash database > lookups) each have their own HPD cache within V4GetHashProtocolManager. > URL real-time lookups use the primary cache as normal, since the > experiment is performed by intercepting URL real-time lookups. > > Within the context of the experiment, reads and writes are performed on > the specific mechanism's HPD cache. > Outside the context of the experiment, reads are performed only on the > primary cache. Writes are performed on all 3 of the caches. This is > because many cache updates are outside the scope of the experiment (e.g. > non-mainframe URLs, checks to non-browsing threat types), but the > backgrounded mechanisms should be allowed to reuse these results if they > happen to match, since that's how it would work if that mechanism were > the default mechanism being used. > > We only want to maintain the separate caches if the experiment might run > for the user (they are an ESB user and the feature flag is enabled). As > an approximation to keep the code simple, we start maintaining separate > caches any time there is a lookup performed where these criteria are > matched. The edge cases this misses (e.g. a user enables ESB) are rare > enough that the approximation will have a negligible impact on the > results. > > Implementation details: > - V4GetHashProtocolManager has most of the changes. It holds the 3 > caches and owns the read/write logic for them. It also has the property > is_lookup_mechanism_experiment_enabled_ that determines whether it > should maintain 3 caches instead of just one. > - A MechanismExperimentHashDatabaseCache enum value is threaded through > from consumers to V4GetHashProtocolManager to specify which caches > should be used for reads/writes. Within the experiment, this says to > read/write to the specific mechanism's cache. Outside the experiment, > this specifies to read only from the primary cache and write to all 3 > caches. > - If the experiment should be enabled, at the start of a lookup, > SafeBrowsingUrlCheckerImpl kicks off a chain of > SetLookupMechanismExperimentIsEnabled calls that eventually set > is_lookup_mechanism_experiment_enabled_ to true in > V4GetHashProtocolManager. > > Bug: 1392144 > > Change-Id: Ic7aaa65d990003e6aff2420a03f125496b0d4217 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4203687 > Commit-Queue: thefrog <thefrog@chromium.org> > Reviewed-by: Xinghui Lu <xinghuilu@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1100477} Bug: 1392144 Change-Id: I911b854c157092630c6c809b4f4fdf3719e6b686 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4220115 Commit-Queue: thefrog <thefrog@chromium.org> Reviewed-by: Xinghui Lu <xinghuilu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1101166}
- Loading branch information
thefrog
authored and
Chromium LUCI CQ
committed
Feb 3, 2023
1 parent
ce627ae
commit 7c7c040
Showing
35 changed files
with
765 additions
and
214 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
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
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
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
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
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
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
Oops, something went wrong.