Perform change update on multiple threads

When multiple changes need to be created or updated for a single push
operation they are now inserted into the database by parallel threads,
up to the maximum allowed thread count. The current thread is used
when the thread pool is already fully in use, falling back to the
prior behavior where each concurrent push operation can do its own
concurrent database update. The thread pool exists to reduce latency
so long as there are sufficient threads available.

This helps push times on databases that are high latency, such as
database servers that are running on a different machine from the
Gerrit server itself, e.g. gerrit.googlesource.com.

The new thread pool is disabled by default, limiting the overhead to
servers that have good latency with their database, such as using
in-process H2 database, or a MySQL or PostgreSQL on the same host.

Change-Id: I7d7368cee99a47e3f2ad1e753cc3f7e1c82d37b0
5 files changed