Page MenuHomePhabricator

Gerrit replica does not support the 'query' command
Closed, DeclinedPublic


Upstream issue:

The bot for 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 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:

import static;       

/** Show the current cache states. */
@RequiresAnyCapability({VIEW_CACHES, MAINTAIN_SERVER})
    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 {


public @interface CommandMetaData {
  Mode runsAt() default Mode.MASTER;

Event Timeline

hashar triaged this task as Medium priority.Oct 14 2019, 7:07 PM

That was for bot which is crawling Gerrit. We since have upgraded the hardware and have way more memory allocated to the Gerrit JVM. So that is not really needed anymore.