Global ref-database interface for use with a multi-site setup of Gerrit Code Review

Clone this repo:
  1. 16249c2 Rename RefPair to RefUpdateSnapshot and clean it up by Matthias Sohn · 10 weeks ago master
  2. fd7dc04 Retry on lock failure during change update by Thomas Dräbing · 3 months ago
  3. 21259e7 Remove SharedLockException in favor of GlobalRefDbLockException by Thomas Dräbing · 3 months ago
  4. 9898363 Consolidate GlobalRefDbLockException and SharedLockException by Thomas Dräbing · 3 months ago
  5. ced68bf Minor documentation fixes by Wendy Wang · 3 months ago

Gerrit interface to a global-refdb

Global ref-database interface for use with Gerrit Code Review.

Enables the de-coupling between Gerrit, its libModules and the different implementations of a globally shared ref-database.


The design for a global ref-db interface can be found as part of the multi-site design documentation, where it first originated and was approved by the community.


In order to consume this library, some Guice bindings need to be registered appropriately. More information in the relevant documentation.


Global ref-database expose metrics to measure the global ref-database operation latency. List of the available metrics can be found here.

How to build

This libModule is built like a Gerrit in-tree plugin, using Bazelisk.

Build in Gerrit tree

Create a symbolic link of the repository source to the Gerrit source tree /plugins/global-refdb directory.


git clone
git clone
cd gerrit/plugins
ln -s ../../global-refdb .

From the Gerrit source tree issue the command bazelisk build plugins/global-refdb


bazelisk build plugins/global-refdb

The libModule jar file is created under bazel-bin/plugins/global-refdb/global-refdb.jar

To execute the tests run bazelisk test plugins/global-refdb/... from the Gerrit source tree.


bazelisk test plugins/global-refdb/...

How to import into Eclipse as a project

Add global-refdb in the CUSTOM_PLUGINS section of the tools/bzl/plugins.bzl.



Run tools/eclipse/ for generating or updating the Eclipse project.