Add ssh command to activate the latest index

In case the online indexer fails, this allows the admins to activate
the latest index.

Change-Id: I59ebf2bce02a599b87d0f7771fc806ff64a3ba64
This commit is contained in:
Hugo Arès
2015-06-30 10:36:08 -04:00
parent 3a593351d6
commit 47f15bed74
6 changed files with 108 additions and 2 deletions

View File

@@ -182,6 +182,22 @@ public class LuceneVersionManager implements LifecycleListener {
return false;
}
/**
* Activate the latest index if the current index is not already the latest.
*
* @return true if index was activate, otherwise false.
* @throws ReindexerAlreadyRunningException
*/
public synchronized boolean activateLatestIndex()
throws ReindexerAlreadyRunningException {
validateReindexerNotRunning();
if (!isCurrentIndexVersionLatest()) {
reindexer.activateIndex();
return true;
}
return false;
}
private boolean isCurrentIndexVersionLatest() {
return reindexer == null
|| reindexer.getVersion() == indexes.getSearchIndex().getSchema()