diff options
author | Kaushik Lingarkar <kaushik.lingarkar@linaro.org> | 2022-11-18 08:58:31 -0800 |
---|---|---|
committer | Kaushik Lingarkar <kaushik.lingarkar@linaro.org> | 2022-11-21 21:26:23 +0000 |
commit | 65b09a66ae14eb2c2b43f01be8c1a45231657c80 (patch) | |
tree | 875af6682c7c8b6d5a57728dce69dfa2242d028d | |
parent | ab74a114ecb82d65a6049cab3ba31af856aa9114 (diff) |
Disable printing cache stats by default on Init/Reindex
Printing cache statistics can be slow, particularly when the
caches are large. For example, when the caches are ~400G,
printing cache stats takes over 30 mins.
Release-Notes: Printing cache stats is disabled by default for Init and Reindex
Change-Id: I848d6dfef0be9dee9ebac8a597dd7e617cbe30e4
-rw-r--r-- | Documentation/pgm-init.txt | 3 | ||||
-rw-r--r-- | Documentation/pgm-reindex.txt | 5 | ||||
-rw-r--r-- | java/com/google/gerrit/pgm/Init.java | 11 | ||||
-rw-r--r-- | java/com/google/gerrit/pgm/Reindex.java | 10 |
4 files changed, 16 insertions, 13 deletions
diff --git a/Documentation/pgm-init.txt b/Documentation/pgm-init.txt index f6c3c85d3e..9f5924864e 100644 --- a/Documentation/pgm-init.txt +++ b/Documentation/pgm-init.txt @@ -99,6 +99,9 @@ objects these SQL statements must be executed manually. The administrator must manually install the required library in the `lib/` folder. +--show-cache-stats:: + Show cache statistics at the end of program. + == CONTEXT This command can only be run on a server which has direct local access to the managed Git repositories. diff --git a/Documentation/pgm-reindex.txt b/Documentation/pgm-reindex.txt index 0653d8d87f..b74829dbde 100644 --- a/Documentation/pgm-reindex.txt +++ b/Documentation/pgm-reindex.txt @@ -36,9 +36,8 @@ Rebuilds the secondary index. Reindex only index with given name. This option can be supplied more than once to reindex multiple indices. ---disable-cache-stats:: - Disables printing cache statistics at the end of program to reduce - noise. Defaulted when reindex is run from init on a new site. +--show-cache-stats:: + Show cache statistics at the end of program. == CONTEXT The secondary index must be enabled. See diff --git a/java/com/google/gerrit/pgm/Init.java b/java/com/google/gerrit/pgm/Init.java index 19d19d4b98..0deb1958a5 100644 --- a/java/com/google/gerrit/pgm/Init.java +++ b/java/com/google/gerrit/pgm/Init.java @@ -92,6 +92,9 @@ public class Init extends BaseInit { @Option(name = "--skip-download", usage = "Don't download given library") private List<String> skippedDownloads; + @Option(name = "--show-cache-stats", usage = "Show cache statistics at the end") + private boolean showCacheStats; + @Inject Browser browser; private GerritIndexStatus indexStatus; @@ -164,7 +167,7 @@ public class Init extends BaseInit { indicesToReindex.add(schemaDef.getName()); } } - reindex(indicesToReindex, run.flags.isNew); + reindex(indicesToReindex); } start(run); } @@ -277,7 +280,7 @@ public class Init extends BaseInit { } } - private void reindex(List<String> indices, boolean isNewSite) throws Exception { + private void reindex(List<String> indices) throws Exception { if (indices.isEmpty()) { return; } @@ -288,8 +291,8 @@ public class Init extends BaseInit { reindexArgs.add("--index"); reindexArgs.add(index); } - if (isNewSite) { - reindexArgs.add("--disable-cache-stats"); + if (showCacheStats) { + reindexArgs.add("--show-cache-stats"); } getConsoleUI() diff --git a/java/com/google/gerrit/pgm/Reindex.java b/java/com/google/gerrit/pgm/Reindex.java index 0eb1b67074..993e00f8d9 100644 --- a/java/com/google/gerrit/pgm/Reindex.java +++ b/java/com/google/gerrit/pgm/Reindex.java @@ -84,11 +84,9 @@ public class Reindex extends SiteProgram { private List<String> indices = new ArrayList<>(); @Option( - name = "--disable-cache-stats", - usage = - "Disables printing the cache statistics." - + "Defaults to true when reindex is run from init on a new site, false otherwise") - private boolean disableCacheStats; + name = "--show-cache-stats", + usage = "Show cache statistics at the end.") + private boolean showCacheStats; private Injector dbInjector; private Injector sysInjector; @@ -120,7 +118,7 @@ public class Reindex extends SiteProgram { try { boolean ok = list ? list() : reindex(); - if (!disableCacheStats) { + if (showCacheStats) { printCacheStats(); } return ok ? 0 : 1; |