Page MenuHomePhabricator

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

Description


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:

ShowCaches.java
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:

Query.java
@CommandMetaData(name = "query", description = "Query the change database")
public class Query extends SshCommand {

And:

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 Development-Metrics 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.