Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
SshCommandsIT: Include `logging ls` and `logging set` commands
Add tests to make sure ssh commands can be executed
Align ElasticIndexModule with LuceneIndexModule
Revert "Remove unneeded nested MultiVersionModule class"
Remove unneeded nested MultiVersionModule class
Only bind index {start/activate} if needed
InitIndex: Allow to configure index.maxLimit for Elasticsearch
Change-Id: Icf925e3724ca6974831676e505692807a771e70b
This commit is contained in:
@@ -2749,9 +2749,10 @@ result lists). Set to 0 for no limit.
|
|||||||
+
|
+
|
||||||
When `index.type` is set to `ELASTICSEARCH`, this value should not exceed
|
When `index.type` is set to `ELASTICSEARCH`, this value should not exceed
|
||||||
the `index.max_result_window` value configured on the Elasticsearch
|
the `index.max_result_window` value configured on the Elasticsearch
|
||||||
server.
|
server. If a value is not configured during site initialization, defaults to
|
||||||
|
10000, which is the default value of `index.max_result_window` in Elasticsearch.
|
||||||
+
|
+
|
||||||
Defaults to no limit.
|
When `index.type` is set to `LUCENE`, defaults to no limit.
|
||||||
|
|
||||||
[[index.maxPages]]index.maxPages::
|
[[index.maxPages]]index.maxPages::
|
||||||
+
|
+
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ public class SshCommandsIT extends AbstractDaemonTest {
|
|||||||
"test-submit",
|
"test-submit",
|
||||||
"version"),
|
"version"),
|
||||||
"index",
|
"index",
|
||||||
ImmutableList.of("activate", "changes", "project", "start"),
|
ImmutableList.of("changes", "project"), // "activate" and "start" are not included
|
||||||
|
"logging",
|
||||||
|
ImmutableList.of("ls", "set"),
|
||||||
"plugin",
|
"plugin",
|
||||||
ImmutableList.of("add", "enable", "install", "ls", "reload", "remove", "rm"),
|
ImmutableList.of("add", "enable", "install", "ls", "reload", "remove", "rm"),
|
||||||
"test-submit",
|
"test-submit",
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ public class ElasticIndexModule extends AbstractModule {
|
|||||||
} else {
|
} else {
|
||||||
install(new SingleVersionModule(singleVersions));
|
install(new SingleVersionModule(singleVersions));
|
||||||
}
|
}
|
||||||
bind(VersionManager.class).to(ElasticVersionManager.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -94,6 +93,7 @@ public class ElasticIndexModule extends AbstractModule {
|
|||||||
private class MultiVersionModule extends LifecycleModule {
|
private class MultiVersionModule extends LifecycleModule {
|
||||||
@Override
|
@Override
|
||||||
public void configure() {
|
public void configure() {
|
||||||
|
bind(VersionManager.class).to(ElasticVersionManager.class);
|
||||||
listener().to(ElasticVersionManager.class);
|
listener().to(ElasticVersionManager.class);
|
||||||
if (onlineUpgrade) {
|
if (onlineUpgrade) {
|
||||||
listener().to(OnlineUpgrader.class);
|
listener().to(OnlineUpgrader.class);
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ public class LuceneIndexModule extends AbstractModule {
|
|||||||
} else {
|
} else {
|
||||||
install(new SingleVersionModule(singleVersions));
|
install(new SingleVersionModule(singleVersions));
|
||||||
}
|
}
|
||||||
bind(VersionManager.class).to(LuceneVersionManager.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -106,6 +105,7 @@ public class LuceneIndexModule extends AbstractModule {
|
|||||||
private class MultiVersionModule extends LifecycleModule {
|
private class MultiVersionModule extends LifecycleModule {
|
||||||
@Override
|
@Override
|
||||||
public void configure() {
|
public void configure() {
|
||||||
|
bind(VersionManager.class).to(LuceneVersionManager.class);
|
||||||
listener().to(LuceneVersionManager.class);
|
listener().to(LuceneVersionManager.class);
|
||||||
if (onlineUpgrade) {
|
if (onlineUpgrade) {
|
||||||
listener().to(OnlineUpgrader.class);
|
listener().to(OnlineUpgrader.class);
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ public class Daemon extends SiteProgram {
|
|||||||
sysInjector.getInstance(DownloadConfig.class),
|
sysInjector.getInstance(DownloadConfig.class),
|
||||||
sysInjector.getInstance(LfsPluginAuthCommand.Module.class)));
|
sysInjector.getInstance(LfsPluginAuthCommand.Module.class)));
|
||||||
if (!slave) {
|
if (!slave) {
|
||||||
modules.add(new IndexCommandsModule());
|
modules.add(new IndexCommandsModule(sysInjector));
|
||||||
}
|
}
|
||||||
return sysInjector.createChildInjector(modules);
|
return sysInjector.createChildInjector(modules);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class InitIndex implements InitStep {
|
|||||||
"Transport protocol", "protocol", "http", Sets.newHashSet("http", "https"));
|
"Transport protocol", "protocol", "http", Sets.newHashSet("http", "https"));
|
||||||
defaultServer.string("Hostname", "hostname", "localhost");
|
defaultServer.string("Hostname", "hostname", "localhost");
|
||||||
defaultServer.string("Port", "port", "9200");
|
defaultServer.string("Port", "port", "9200");
|
||||||
|
index.string("Result window size", "maxLimit", "10000");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((site.isNew || isEmptySite()) && type == IndexType.LUCENE) {
|
if ((site.isNew || isEmptySite()) && type == IndexType.LUCENE) {
|
||||||
|
|||||||
@@ -14,20 +14,31 @@
|
|||||||
|
|
||||||
package com.google.gerrit.sshd.commands;
|
package com.google.gerrit.sshd.commands;
|
||||||
|
|
||||||
|
import com.google.gerrit.server.index.VersionManager;
|
||||||
import com.google.gerrit.sshd.CommandModule;
|
import com.google.gerrit.sshd.CommandModule;
|
||||||
import com.google.gerrit.sshd.CommandName;
|
import com.google.gerrit.sshd.CommandName;
|
||||||
import com.google.gerrit.sshd.Commands;
|
import com.google.gerrit.sshd.Commands;
|
||||||
import com.google.gerrit.sshd.DispatchCommandProvider;
|
import com.google.gerrit.sshd.DispatchCommandProvider;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
import com.google.inject.Key;
|
||||||
|
|
||||||
public class IndexCommandsModule extends CommandModule {
|
public class IndexCommandsModule extends CommandModule {
|
||||||
|
|
||||||
|
private final Injector injector;
|
||||||
|
|
||||||
|
public IndexCommandsModule(Injector injector) {
|
||||||
|
this.injector = injector;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
CommandName gerrit = Commands.named("gerrit");
|
CommandName gerrit = Commands.named("gerrit");
|
||||||
CommandName index = Commands.named(gerrit, "index");
|
CommandName index = Commands.named(gerrit, "index");
|
||||||
command(index).toProvider(new DispatchCommandProvider(index));
|
command(index).toProvider(new DispatchCommandProvider(index));
|
||||||
command(index, IndexActivateCommand.class);
|
if (injector.getExistingBinding(Key.get(VersionManager.class)) != null) {
|
||||||
command(index, IndexStartCommand.class);
|
command(index, IndexActivateCommand.class);
|
||||||
|
command(index, IndexStartCommand.class);
|
||||||
|
}
|
||||||
command(index, IndexChangesCommand.class);
|
command(index, IndexChangesCommand.class);
|
||||||
command(index, IndexProjectCommand.class);
|
command(index, IndexProjectCommand.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
|
|||||||
false,
|
false,
|
||||||
sysInjector.getInstance(DownloadConfig.class),
|
sysInjector.getInstance(DownloadConfig.class),
|
||||||
sysInjector.getInstance(LfsPluginAuthCommand.Module.class)));
|
sysInjector.getInstance(LfsPluginAuthCommand.Module.class)));
|
||||||
modules.add(new IndexCommandsModule());
|
modules.add(new IndexCommandsModule(sysInjector));
|
||||||
return sysInjector.createChildInjector(modules);
|
return sysInjector.createChildInjector(modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user