Update mergeability flag during reindex

Before commit f8be8fdca the mergeability flag on changes was only
updated on request and for most of the changes the persisted
mergeability flag was outdated. Commit f8be8fdca makes sure to keep the
mergeability flag updated whenever the destination branch is updated,
but for old changes the mergeability flag may still be outdated. Since
some Gerrit functionality is relying on the mergeability flag
being up to date there must be a way to update the mergeability flag
for all old changes. One possibility would be to do this as a schema
migration but there may be situations where it's needed to update the
mergeability flag on demand (e.g. if during a Gerrit downtime branches
are updated due to some administration tasks). This is why it's
better to update the mergeability flag in the reindexer when the
changes are reindexed. Also the schema migration is done during the
init phase where a lot of classes that are needed by the
MergeabilityChecker are not bound. The reindexer on the other hand
already has a lot of the needed Guice bindings in place.

An outdated mergeability flag is especially bad since this information
is shown in the change tables and user dashboards (see commit
56f39eb0a0). Users will be very confused by seeing wrong (outdated)
information here which is why it is important to get this fixed before
the next release.

Bug: issue 2322
Change-Id: If85839cedcfed25e872b264149d13e98b10ba835
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
5 files changed