diff --git a/CHANGES.txt b/CHANGES.txt index 336ae65b11..9cf76fd914 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -75,6 +75,7 @@ * Update JNA library to 5.9.0 and snappy-java to version 1.1.8.4 (CASSANDRA-17040) Merged from 4.0: + * Deduplicate warnings for deprecated parameters (changed names) (CASSANDRA-17160) * Update ant-junit to version 1.10.12 (CASSANDRA-17218) * Add droppable tombstone metrics to nodetool tablestats (CASSANDRA-16308) * Fix disk failure triggered when enabling FQL on an unclean directory (CASSANDRA-17136) diff --git a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java index 1bdb9a5879..dc9b7fb616 100644 --- a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java +++ b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java @@ -219,6 +219,8 @@ public class YamlConfigurationLoader implements ConfigurationLoader private final Set nullProperties = new HashSet<>(); + private final Set deprecationWarnings = new HashSet<>(); + private final Map, Map> replacements; public PropertiesChecker(Map, Map> replacements) @@ -232,7 +234,7 @@ public class YamlConfigurationLoader implements ConfigurationLoader { final Property result; Map typeReplacements = replacements.getOrDefault(type, Collections.emptyMap()); - if(typeReplacements.containsKey(name)) + if (typeReplacements.containsKey(name)) { Replacement replacement = typeReplacements.get(name); final Property newProperty = super.getProperty(type, replacement.newName); @@ -269,17 +271,14 @@ public class YamlConfigurationLoader implements ConfigurationLoader } }; - if(replacement.deprecated) - { - logger.warn("{} parameter has been deprecated. It has a new name; For more information, please refer to NEWS.txt", name); - } + if (replacement.deprecated) + deprecationWarnings.add(replacement.oldName); } else { result = super.getProperty(type, name); } - if (result instanceof MissingProperty) { missingProperties.add(result.getName()); @@ -326,14 +325,13 @@ public class YamlConfigurationLoader implements ConfigurationLoader public void check() throws ConfigurationException { if (!nullProperties.isEmpty()) - { throw new ConfigurationException("Invalid yaml. Those properties " + nullProperties + " are not valid", false); - } if (!missingProperties.isEmpty()) - { throw new ConfigurationException("Invalid yaml. Please remove properties " + missingProperties + " from your cassandra.yaml", false); - } + + if (!deprecationWarnings.isEmpty()) + logger.warn("{} parameters have been deprecated. They have new names; For more information, please refer to NEWS.txt", deprecationWarnings); } }