Fix bottleneck in GitRefUpdatedListener

The supermanifest plugin listens on Git ref updates using a class marked as
@Singleton. This means any and all updates to the Git storage will go
through this class. The actual method that handles these updates was
marked synchronized to prevent shared access to a non-thread safe
config.

This turns out to be a central bottleneck in Gerrit: All git updates
have to go through this method. If the supermanifest plugin is configured
to do work (i.e. update manifest entries for other repos), that work is
actually quite slow (5s and sometimes above). This makes it so that updates
on the Gerrit server get to a grinding halt and get all queued up on this
synchronized block.

In this commit, we rework the mutable config to be immutable, remove
the synchronized block and swap it for an AtomicReference. With that,
the machinery is still thread safe, but doesn't lock up anymore.

While at it, we swap a call to ProjectIndex#evictAndReindex for
ProjectIndex#evict. We just want to read a fresh project config
from disk. Eviction is sufficient for that.

Change-Id: I89ffce984d7f4c32dda72dff9e55a5c4c108ee7d
2 files changed
tree: 75895f0c52309aa71c5c9f530fd575bc5810ed33
  1. java/
  2. javatests/
  3. BUILD
  4. external_plugin_deps.bzl
  5. LICENSE
  6. README.md
README.md

The plugin will update a superproject to contain the submodules defined in the manifest XML file whenever the manifest repo is changed.

For more information see the documentation or the build instructions