Init: Add ability to skip reindex after init
This option can come in handy when folks want to complete some
intermediate upgrade related activities after init and before
reindex.
Release-Notes: reindex can be skipped after init with --reindex-threads=-1
Change-Id: I8e31e0310b2f5bc668992aeec0ab03563e38a955
diff --git a/Documentation/pgm-init.txt b/Documentation/pgm-init.txt
index b28a617..4a758c3 100644
--- a/Documentation/pgm-init.txt
+++ b/Documentation/pgm-init.txt
@@ -104,7 +104,9 @@
Show cache statistics at the end of program.
--reindex-threads::
- Number of threads to use for reindex after init. Defaults to 1.
+ Number of threads to use for reindex after init. Defaults to 1. Can be
+ set to -1 to skip reindex after init. Skipping reindex will also not
+ automatically start the daemon.
== CONTEXT
This command can only be run on a server which has direct local access to the
diff --git a/java/com/google/gerrit/pgm/Init.java b/java/com/google/gerrit/pgm/Init.java
index 2a746b8..c05bff5 100644
--- a/java/com/google/gerrit/pgm/Init.java
+++ b/java/com/google/gerrit/pgm/Init.java
@@ -163,7 +163,7 @@
});
modules.add(new GerritServerConfigModule());
Guice.createInjector(modules).injectMembers(this);
- if (!ReplicaUtil.isReplica(run.flags.cfg)) {
+ if (reindexThreads != -1 && !ReplicaUtil.isReplica(run.flags.cfg)) {
List<String> indicesToReindex = new ArrayList<>();
for (SchemaDefinitions<?> schemaDef : schemaDefs) {
if (!indexStatus.exists(schemaDef.getName())) {
@@ -226,7 +226,7 @@
}
void start(SiteRun run) throws Exception {
- if (run.flags.autoStart) {
+ if (reindexThreads != -1 && run.flags.autoStart) {
if (HostPlatform.isWin32()) {
System.err.println("Automatic startup not supported on Win32.");
} else {