Don't scan gerrit_index.config for current version when no Lucene With the index engine is not Lucene don't scan `gerrit_index.config` for the newest version as index checking is not supported anyway. Apply the same logic for `onSuccess` so that handler is not performing empty updates. To be reviewed when issue 316743624 gets implemented. Change-Id: I1f7b050b7f58cdbe35013038f45ec4195a669a8a
diff --git a/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/ChangesIndexHealthCheck.java b/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/ChangesIndexHealthCheck.java index bd16b7b..fada9aa 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/ChangesIndexHealthCheck.java +++ b/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/ChangesIndexHealthCheck.java
@@ -74,7 +74,7 @@ @Override public void onSuccess(String name, int oldVersion, int newVersion) { - if (!name.equals("changes") || oldVersion == newVersion) { + if (!isLuceneIndex || !name.equals("changes") || oldVersion == newVersion) { return; } @@ -106,6 +106,10 @@ } private Optional<ChangesIndexLockFiles> getChangesIndexLockFiles(Path indexDir) { + if (!isLuceneIndex) { + Optional.empty(); + } + FileBasedConfig cfg = new FileBasedConfig(indexDir.resolve("gerrit_index.config").toFile(), FS.detect()); try {