Disable commitWithin when running Reindex
Disable the 'commitWithin' from within Reindex by overriding the configuration with '-1'. Treat negative values as the original behavior, auto-flushing but not auto-committing, which is the least safe but the most efficient for reindexing the entire site. Change-Id: Ifdba797bee871d2a3d8928810a6304bacb850c8c
This commit is contained in:

committed by
David Pursehouse

parent
3daa739e13
commit
af058e6dd3
@@ -95,6 +95,7 @@ public class Reindex extends SiteProgram {
|
||||
throw die("index.type must be configured (or not SQL)");
|
||||
}
|
||||
limitThreads();
|
||||
disableLuceneAutomaticCommit();
|
||||
if (version == null) {
|
||||
version = ChangeSchemas.getLatest().getVersion();
|
||||
}
|
||||
@@ -162,6 +163,15 @@ public class Reindex extends SiteProgram {
|
||||
return dbInjector.createChildInjector(modules);
|
||||
}
|
||||
|
||||
private void disableLuceneAutomaticCommit() {
|
||||
Config cfg =
|
||||
dbInjector.getInstance(Key.get(Config.class, GerritServerConfig.class));
|
||||
if (IndexModule.getIndexType(dbInjector) == IndexType.LUCENE) {
|
||||
cfg.setLong("index", "changes_open", "commitWithin", -1);
|
||||
cfg.setLong("index", "changes_closed", "commitWithin", -1);
|
||||
}
|
||||
}
|
||||
|
||||
private class ReviewDbModule extends LifecycleModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
|
Reference in New Issue
Block a user