Upstream issue: https://bugs.chromium.org/p/gerrit/issues/detail?id=11742
The bot for Development-Metrics uses gerrit query over ssh which loads the Gerrit master too much (T234328). The idea was too move those queries to gerrit-replica unfortunately the command is not registered for execution on slaves:
ssh -p 29418 gerrit-replica.wikimedia.org gerrit query fatal: gerrit: query: not found
But other commands are available such as show-cache.
The reason is that ssh commands default to only be runnable on the master instance. If I look under gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands. The class constructor for show-caches command is passed runsAt = MASTER_OR_SLAVE:
package com.google.gerrit.sshd.commands; import static com.google.gerrit.sshd.CommandMetaData.Mode.MASTER_OR_SLAVE; /** Show the current cache states. */ @RequiresAnyCapability({VIEW_CACHES, MAINTAIN_SERVER}) @CommandMetaData( name = "show-caches", description = "Display current cache statistics", runsAt = MASTER_OR_SLAVE) final class ShowCaches extends SshCommand { ...
But for the Query class, it uses the default:
@CommandMetaData(name = "query", description = "Query the change database") public class Query extends SshCommand {
And:
public @interface CommandMetaData {
Mode runsAt() default Mode.MASTER;
...