Index start/activate commands: fix Elastic support

Before this fix, the IndexStartCommand and IndexActivateCommand worked
only for the Lucene index-type case. Replace the latter hard-coded case
with support for it but also the Elastic case as well. Meaning, use
AbstractVersionManager rather than its LuceneVersionManager sub-type, so
that ElasticVersionManager can also be (seamlessly) supported for those
commands. Hence bind AbstractVersionManager to the configured sub-type
class, in order for it to be used that way.

This change can be fully tested through using the --force option of the
gerrit index start command [1]. The gerrit index activate command [2]
does not have such an option.

[1] https://gerrit-review.googlesource.com/Documentation/cmd-index-start.html
[2] https://gerrit-review.googlesource.com/Documentation/cmd-index-activate.html

Bug: Issue 8584, Issue 8585
Change-Id: Ibd8d22dca3a94e8b6a81db2935d1c34b1e80401d
This commit is contained in:
Marco Miller
2018-04-05 16:45:43 -04:00
parent 16e5d88039
commit e5dc28f707
4 changed files with 10 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.lucene;
import com.google.common.collect.ImmutableMap;
import com.google.gerrit.lifecycle.LifecycleModule;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.index.AbstractVersionManager;
import com.google.gerrit.server.index.IndexConfig;
import com.google.gerrit.server.index.IndexModule;
import com.google.gerrit.server.index.SingleVersionModule;
@@ -77,6 +78,7 @@ public class LuceneIndexModule extends LifecycleModule {
} else {
install(new SingleVersionModule(singleVersions));
}
bind(AbstractVersionManager.class).to(LuceneVersionManager.class);
}
@Provides