v3.10.0-rc2
Load replication configuration only once

Reuse the same instance across requests in ReplicationConfigImpl.
This avoids reloading the configuration from disk continuously.

Previously, the config was retrieved on-demand with the Provider<>.get()
paradigm. However, the Provider<>.get() would trigger the creation of a
new instance of the Config every time it is invoked, causing the full
scan and parsing of the replication configs.

On GerritHub.io, the processing of all replication configs (12k files)
would take around 5 minutes, causing a catastrophic overload of the CPU
and preventing the plugin that use ReplicationConfigImpl (replication
and pull-replication) to even start.

With regards to the configVersion, the description of the interface has
been amended to reflect the expected behaviour to report the
*latest actual* version on the storage, regardless of the in-memory copy.

The AutoReloadConfigDectorator relies on the configVersion to reflect
the storage version for triggering a configuration reload by forcibly
re-creating the config resources and therefore triggering the reload and
parsing of the replication configs from the underlying storage.

AutoReloadConfigDecorator should not reload the configuration again
in his constructor because the AutoReloadRunnable has already loaded
the initial state and therefore can reuse that one as valid starting
point.

Change-Id: I6f9c3a35d1ecbfa87f3daeeb464face0c6b6400e
6 files changed
tree: cc78f590ac65e6b777711da8dc96d4c41b95d048
  1. .settings/
  2. src/
  3. .gitignore
  4. .mailmap
  5. BUILD
  6. LICENSE