Add an optional flag to force an online reindex
As discussed on Gerrit ML[1] and in referenced issue, there are situations where you may want to run an online reindex besides the upgrade gerrit use case. This change allows users to force an online reindex. [1] https://groups.google.com/d/msg/repo-discuss/pUn8fHVh58w/icsSFef2CAAJ feature: issue 3987 Change-Id: Ie88b7effda08996f7c0f325543be703bcf09c794
This commit is contained in:
@@ -23,11 +23,15 @@ import com.google.gerrit.sshd.SshCommand;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
|
||||
@CommandMetaData(name = "start", description = "Start the online reindexer")
|
||||
public class IndexStartCommand extends SshCommand {
|
||||
|
||||
@Option(name = "--force", usage = "force a re-index")
|
||||
private boolean force;
|
||||
|
||||
@Argument(index = 0, required = true, metaVar = "INDEX",
|
||||
usage = "index name to start")
|
||||
private String name;
|
||||
@@ -38,7 +42,7 @@ public class IndexStartCommand extends SshCommand {
|
||||
@Override
|
||||
protected void run() throws UnloggedFailure {
|
||||
try {
|
||||
if (luceneVersionManager.startReindexer(name)) {
|
||||
if (luceneVersionManager.startReindexer(name, force)) {
|
||||
stdout.println("Reindexer started");
|
||||
} else {
|
||||
stdout.println("Nothing to reindex, index is already the latest version");
|
||||
|
||||
Reference in New Issue
Block a user