diff options
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java index b576d1cb5d2..45623bbe611 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java @@ -33,6 +33,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.logging.Level; import java.util.logging.Logger; @@ -103,12 +104,35 @@ public class VespaModelFactory implements ModelFactory { return buildModel(createDeployState(modelContext, new ValidationParameters(ValidationParameters.IgnoreValidationErrors.TRUE))); } + private void logReindexingReasons(List<ConfigChangeAction> changeActions, + VespaModel nextModel, + Optional<Model> currentActiveModel) + { + if (currentActiveModel.isEmpty()) { + return; + } + for (ConfigChangeAction action : changeActions) { + if (action.getType().equals(ConfigChangeAction.Type.REINDEX)) { + VespaModel currentModel = (VespaModel) currentActiveModel.get(); + var currentVersion = currentModel.version(); + var currentMeta = currentModel.applicationPackage().getMetaData(); + var nextVersion = nextModel.version(); + var nextMeta = nextModel.applicationPackage().getMetaData(); + log.log(Level.INFO, String.format("Model [%s/%s] -> [%s/%s] triggers reindexing: %s", + currentModel.version().toString(), currentMeta.toString(), + nextModel.version().toString(), nextMeta.toString(), + action.toString())); + } + } + } + @Override public ModelCreateResult createAndValidateModel(ModelContext modelContext, ValidationParameters validationParameters) { validateXml(modelContext, validationParameters.ignoreValidationErrors()); DeployState deployState = createDeployState(modelContext, validationParameters); VespaModel model = buildModel(deployState); List<ConfigChangeAction> changeActions = validateModel(model, deployState, validationParameters); + logReindexingReasons(changeActions, model, deployState.getPreviousModel()); return new ModelCreateResult(model, changeActions); } |