diff options
author | Kaushik Lingarkar <kaushik.lingarkar@linaro.org> | 2022-05-27 15:16:48 -0700 |
---|---|---|
committer | Kaushik Lingarkar <kaushik.lingarkar@linaro.org> | 2022-06-03 09:18:00 -0700 |
commit | 598b676a96d5c6b61ae6b85748311ec4677cac62 (patch) | |
tree | a65892ce01f3add8b27fb0503acab5cd418c64f8 | |
parent | 4641218e0090ff6433787933f18717f83a87ffe9 (diff) |
Cache ProjectControl instances in SSH queries
Use a PerThreadCache in SSH queries to cache ProjectControl
instances inside DefaultPermissionBackend#ForProject so that
its performance is comparable to REST where the aforementioned
cache is already used.
This cache helps improve performance of the change visibility
check, which is done as a post-filter on the results obtained
from an index query.
Release-Notes: SSH query performance is improved
Change-Id: Ia0b5d8c10db4f6631c59af5d2e6631d7ca4d1ea0
-rw-r--r-- | java/com/google/gerrit/server/query/change/OutputStreamQuery.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/java/com/google/gerrit/server/query/change/OutputStreamQuery.java b/java/com/google/gerrit/server/query/change/OutputStreamQuery.java index 7b71b76671..6907f15a41 100644 --- a/java/com/google/gerrit/server/query/change/OutputStreamQuery.java +++ b/java/com/google/gerrit/server/query/change/OutputStreamQuery.java @@ -29,6 +29,7 @@ import com.google.gerrit.extensions.common.PluginDefinedInfo; import com.google.gerrit.index.query.QueryParseException; import com.google.gerrit.index.query.QueryResult; import com.google.gerrit.server.DynamicOptions; +import com.google.gerrit.server.cache.PerThreadCache; import com.google.gerrit.server.config.TrackingFooters; import com.google.gerrit.server.data.ChangeAttribute; import com.google.gerrit.server.data.PatchSetAttribute; @@ -206,7 +207,7 @@ public class OutputStreamQuery { return; } - try { + try (PerThreadCache ignored = PerThreadCache.create()) { final QueryStatsAttribute stats = new QueryStatsAttribute(); stats.runTimeMilliseconds = TimeUtil.nowMs(); |