Convert ChangeBatchIndexer to more of a builder pattern

There was a single method with two required and many optional
arguments. Move the optional arguments into setters, except for the
project count, which we just cheat and extract from the input only if
the input is a Collection (which is 1 of the 2 callers).

This refactoring exposes and fixes a likely unintended behavior: we
should not recheck mergeability during online reindexing. The purpose
of online reindexing is to get a new index schema version up and
running in a timely fashion, without overloading a running server.
Checking mergeability by default was not helping here; I think it was
just an unintended quirk due to the way MergeabilityChecker was
injected into the ChangeBatchIndexer constructor.

Change-Id: Ifec986ef3c976ddeb00dd4218c5d029de9dc905e
This commit is contained in:
Dave Borowitz
2014-10-17 13:06:30 -07:00
parent 79bb12456d
commit 5d73b06e62
3 changed files with 44 additions and 22 deletions

View File

@@ -76,8 +76,8 @@ public class OnlineReindexer {
"not an active write schema version: %s", version);
log.info("Starting online reindex from schema version {} to {}",
version(indexes.getSearchIndex()), version(index));
ChangeBatchIndexer.Result result = batchIndexer.indexAll(
index, projectCache.all(), -1, -1, null, null);
ChangeBatchIndexer.Result result =
batchIndexer.indexAll(index, projectCache.all());
if (!result.success()) {
log.error("Online reindex of schema version {} failed", version(index));
return;