RED-3880: Fixed index migration, always shutdown if migrate only

This commit is contained in:
deiflaender 2022-04-14 12:22:09 +02:00
parent 113b575b3a
commit cdaddb3399

View File

@ -33,13 +33,15 @@ public class MigrationStarterService {
public void migrate() throws JsonProcessingException {
// This can only run in post upgrade hook, because otherwise the old service is still runnnig.
if (settings.isMigrateOnly() && indexInformationService.hasIndexChanged()) {
log.info("Index has changed and will be closed, dropped, recreated and all files will be indexed");
String indexMessage = objectMapper.writeValueAsString(IndexMessage.builder().messageType(IndexMessageType.DROP).build());
indexingMessageReceiver.receiveIndexingRequest(indexMessage);
if (settings.isMigrateOnly()) {
if (indexInformationService.hasIndexChanged()) {
log.info("Index has changed and will be closed, dropped, recreated and all files will be indexed");
String indexMessage = objectMapper.writeValueAsString(IndexMessage.builder()
.messageType(IndexMessageType.DROP)
.build());
indexingMessageReceiver.receiveIndexingRequest(indexMessage);
}
System.exit(SpringApplication.exit(ctx, () -> 0));
}
}
}