Replace background mergeability checks with reindexing
Now that mergeability is checked lazily using a cache upon reindexing, we can ditch the specific mergeability-rechecking codepath and just depend on the cache to load properly. This reduces complexity of background merge checking in a number of pleasant ways: - We don't have to maintain two sets of background threadpools. - Since the cache loader looks at project configuration and runs submit rules, we don't need to guess in the ref update listener whether submit rules might have changed in a way that affects mergeability. If the cache key is the same, it's a hit; if not, it isn't. - No more --recheck-mergeable flag to reindex; checks only happen for those changes that are actually outdated. (We might need to trigger a full mergeability recheck at some point in the future, but we can do that by simply flushing the persistent cache.) - The check interface is pared down; we never actually used arbitrary lists of projects/branches/changes. - The ref updated listener can always use background priority, while callers indexing a single change naturally always use interactive priority. - No manual locking to avoid duplicate work; LoadingCache takes care of that for us. - Mergeable is not used by the reindexing path, so we don't need to explicitly turn off reindexing in that handler. The configuration values for mergeability check threadpool sizes are now used as fallbacks when the index threadpool sizes are not configured. Change-Id: I88ae7f4ad417fcba5495b2a5e4b94adf11e2a21b
This commit is contained in:
@@ -27,7 +27,6 @@ import com.google.gerrit.pgm.util.ThreadLimiter;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.change.MergeabilityChecker;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.index.ChangeBatchIndexer;
|
||||
import com.google.gerrit.server.index.ChangeIndex;
|
||||
@@ -61,9 +60,6 @@ public class Reindex extends SiteProgram {
|
||||
@Option(name = "--output", usage = "Prefix for output; path for local disk index, or prefix for remote index")
|
||||
private String outputBase;
|
||||
|
||||
@Option(name = "--recheck-mergeable", usage = "Recheck mergeable flag on all changes")
|
||||
private boolean recheckMergeable;
|
||||
|
||||
@Option(name = "--verbose", usage = "Output debug information for each change")
|
||||
private boolean verbose;
|
||||
|
||||
@@ -164,10 +160,6 @@ public class Reindex extends SiteProgram {
|
||||
|
||||
ChangeBatchIndexer batchIndexer =
|
||||
sysInjector.getInstance(ChangeBatchIndexer.class);
|
||||
if (recheckMergeable) {
|
||||
batchIndexer.setMergeabilityChecker(
|
||||
sysInjector.getInstance(MergeabilityChecker.class));
|
||||
}
|
||||
ChangeBatchIndexer.Result result = batchIndexer.setNumChanges(changeCount)
|
||||
.setProgressOut(System.err)
|
||||
.setVerboseOut(verbose ? System.out : NullOutputStream.INSTANCE)
|
||||
|
Reference in New Issue
Block a user