private <T> void validateAttributeHnswIndexSetting(ClusterSpec.Id id,
                                                       Attribute currentAttr, Attribute nextAttr,
                                                       Function<HnswIndexParams, T> settingValueProvider,
                                                       String setting,
                                                       List<VespaConfigChangeAction> result) {
        T currentValue = settingValueProvider.apply(currentAttr.hnswIndexParams().get());
        T nextValue = settingValueProvider.apply(nextAttr.hnswIndexParams().get());
        if (!Objects.equals(currentValue, nextValue)) {
            String message = String.format("change hnsw index property '%s' from '%s' to '%s'", setting, currentValue, nextValue);
            if (setting.equals("max-links-per-node"))
                deployState.validationOverrides()
                           .invalid(ValidationId.hnswSettingsChange,
                                    message + ". This requires the hnsw index to be rebuilt during initialization, which may take a long time",
                                    deployState.now());
            result.add(new VespaRestartAction(id, new ChangeMessageBuilder(nextAttr.getName()).addChange(message).build()));
        }
    }
Validates the changes between the current and next set of attribute fields in a document database.

@author geirst
config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidator.java