InitIndex should not always set the latest version ready

I1c424df6 intended to set latest index ready without having to run
reindex for existing empty site but the effective change was always
setting the latest index version ready. When upgrading to a Gerrit
version that include a index schema update, Gerrit does not start
online reindexer because latest version is ready and no changes are in
in the latest index.

Setting the latest index to ready without running reindex should only
happen for new site or existing empty site.

Change-Id: Id9a3188830ed9a85a0b2a748846c30c544ffcaaa
This commit is contained in:
Hugo Arès
2016-08-11 13:09:04 -04:00
parent 877d430ee5
commit c62eee3b8c

View File

@@ -60,12 +60,12 @@ class InitIndex implements InitStep {
ui.header("Index");
type = index.select("Type", "type", type);
}
for (SchemaDefinitions<?> def : IndexModule.ALL_SCHEMA_DEFS) {
AbstractLuceneIndex.setReady(
site, def.getName(), def.getLatest().getVersion(), true);
}
if ((site.isNew || isEmptySite()) && type == IndexType.LUCENE) {
// Do nothing
for (SchemaDefinitions<?> def : IndexModule.ALL_SCHEMA_DEFS) {
AbstractLuceneIndex.setReady(
site, def.getName(), def.getLatest().getVersion(), true);
}
} else {
if (IndexType.values().length <= 1) {
ui.header("Index");