This is an automated email from the ASF dual-hosted git repository. edimitrova pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit 670bcff596958839778562d2918b363c03ca5ec9 Merge: be9db09 44ace88 Author: Ekaterina Dimitrova <[email protected]> AuthorDate: Tue Nov 16 14:35:48 2021 -0500 Merge branch 'cassandra-4.0' into trunk .build/build-rat.xml | 1 + CHANGES.txt | 1 + NEWS.txt | 5 + conf/cassandra.yaml | 4 +- src/java/org/apache/cassandra/config/Config.java | 2 + src/java/org/apache/cassandra/config/Replaces.java | 45 ++++++ .../org/apache/cassandra/config/ReplacesList.java | 34 +++++ .../cassandra/config/YamlConfigurationLoader.java | 164 ++++++++++++++++++++- .../cassandra_deprecated_parameters_names.yaml | 56 +++++++ .../LoadOldYAMLBackwardCompatibilityTest.java | 44 ++++++ .../config/YamlConfigurationLoaderTest.java | 14 +- 11 files changed, 359 insertions(+), 11 deletions(-) diff --cc CHANGES.txt index 7cc49c3,cb8a8a9..f533407 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,64 -1,5 +1,65 @@@ -4.0.2 +4.1 + * Refactor normal/preview/IR repair to standardize repair cleanup and error handling of failed RepairJobs (CASSANDRA-17069) + * Log missing peers in StartupClusterConnectivityChecker (CASSANDRA-17130) + * Introduce separate rate limiting settings for entire SSTable streaming (CASSANDRA-17065) + * Implement Virtual Tables for Auth Caches (CASSANDRA-16914) + * Actively update auth cache in the background (CASSANDRA-16957) + * Add unix time conversion functions (CASSANDRA-17029) + * JVMStabilityInspector.forceHeapSpaceOomMaybe should handle all non-heap OOMs rather than only supporting direct only (CASSANDRA-17128) + * Forbid other Future implementations with checkstyle (CASSANDRA-17055) + * commit log was switched from non-daemon to daemon threads, which causes the JVM to exit in some case as no non-daemon threads are active (CASSANDRA-17085) + * Add a Denylist to block reads and writes on specific partition keys (CASSANDRA-12106) + * v4+ protocol did not clean up client warnings, which caused leaking the state (CASSANDRA-17054) + * Remove duplicate toCQLString in ReadCommand (CASSANDRA-17023) + * Ensure hint window is persistent across restarts of a node (CASSANDRA-14309) + * Allow to GRANT or REVOKE multiple permissions in a single statement (CASSANDRA-17030) + * Allow to grant permission for all tables in a keyspace (CASSANDRA-17027) + * Log time spent writing keys during compaction (CASSANDRA-17037) + * Make nodetool compactionstats and sstable_tasks consistent (CASSANDRA-16976) + * Add metrics and logging around index summary redistribution (CASSANDRA-17036) + * Add configuration options for minimum allowable replication factor and default replication factor (CASSANDRA-14557) + * Expose information about stored hints via a nodetool command and a virtual table (CASSANDRA-14795) + * Add broadcast_rpc_address to system.local (CASSANDRA-11181) + * Add support for type casting in WHERE clause components and in the values of INSERT/UPDATE statements (CASSANDRA-14337) + * add credentials file support to CQLSH (CASSANDRA-16983) + * Skip remaining bytes in the Envelope buffer when a ProtocolException is thrown to avoid double decoding (CASSANDRA-17026) + * Allow reverse iteration of resources during permissions checking (CASSANDRA-17016) + * Add feature to verify correct ownership of attached locations on disk at startup (CASSANDRA-16879) + * Make SSLContext creation pluggable/extensible (CASSANDRA-16666) + * Add soft/hard limits to local reads to protect against reading too much data in a single query (CASSANDRA-16896) + * Avoid token cache invalidation for removing a non-member node (CASSANDRA-15290) + * Allow configuration of consistency levels on auth operations (CASSANDRA-12988) + * Add number of sstables in a compaction to compactionstats output (CASSANDRA-16844) + * Upgrade Caffeine to 2.9.2 (CASSANDRA-15153) + * Allow DELETE and TRUNCATE to work on Virtual Tables if the implementation allows it (CASSANDRA-16806) + * Include SASI components to snapshots (CASSANDRA-15134) + * Fix missed wait latencies in the output of `nodetool tpstats -F` (CASSANDRA-16938) + * Reduce native transport max frame size to 16MB (CASSANDRA-16886) + * Add support for filtering using IN restrictions (CASSANDRA-14344) + * Provide a nodetool command to invalidate auth caches (CASSANDRA-16404) + * Catch read repair timeout exceptions and add metric (CASSANDRA-16880) + * Exclude Jackson 1.x transitive dependency of hadoop* provided dependencies (CASSANDRA-16854) + * Add client warnings and abort to tombstone and coordinator reads which go past a low/high watermark (CASSANDRA-16850) + * Add TTL support to nodetool snapshots (CASSANDRA-16789) + * Allow CommitLogSegmentReader to optionally skip sync marker CRC checks (CASSANDRA-16842) + * allow blocking IPs from updating metrics about traffic (CASSANDRA-16859) + * Request-Based Native Transport Rate-Limiting (CASSANDRA-16663) + * Implement nodetool getauditlog command (CASSANDRA-16725) + * Clean up repair code (CASSANDRA-13720) + * Background schedule to clean up orphaned hints files (CASSANDRA-16815) + * Modify SecondaryIndexManager#indexPartition() to retrieve only columns for which indexes are actually being built (CASSANDRA-16776) + * Batch the token metadata update to improve the speed (CASSANDRA-15291) + * Reduce the log level on "expected" repair exceptions (CASSANDRA-16775) + * Make JMXTimer expose attributes using consistent time unit (CASSANDRA-16760) + * Remove check on gossip status from DynamicEndpointSnitch::updateScores (CASSANDRA-11671) + * Fix AbstractReadQuery::toCQLString not returning valid CQL (CASSANDRA-16510) + * Log when compacting many tombstones (CASSANDRA-16780) + * Display bytes per level in tablestats for LCS tables (CASSANDRA-16799) + * Add isolated flush timer to CommitLogMetrics and ensure writes correspond to single WaitingOnCommit data points (CASSANDRA-16701) + * Add a system property to set hostId if not yet initialized (CASSANDRA-14582) + * GossiperTest.testHasVersion3Nodes didn't take into account trunk version changes, fixed to rely on latest version (CASSANDRA-16651) +Merged from 4.0: + * internode_send_buff_size_in_bytes and internode_recv_buff_size_in_bytes have new names. Backward compatibility with the old names added (CASSANDRA-17141) * Remove unused configuration parameters from cassandra.yaml (CASSANDRA-17132) * Queries performed with NODE_LOCAL consistency level do not update request metrics (CASSANDRA-17052) * Fix multiple full sources can be select unexpectedly for bootstrap streaming (CASSANDRA-16945) diff --cc NEWS.txt index 9f5a9f1,5460aa2..9707cce --- a/NEWS.txt +++ b/NEWS.txt @@@ -177,6 -140,6 +177,11 @@@ New feature Upgrading --------- ++ - As part of the Internode Messaging improvement work in CASSANDRA-15066, internode_send_buff_size_in_bytes and ++ internode_recv_buff_size_in_bytes were renamed to internode_socket_send_buffer_size_in_bytes and ++ internode_socket_receive_buffer_size_in_bytes. To support upgrades pre-4.0, we add backward compatibility and ++ currently both old and new names should work. Cassandra 4.0.0 and Cassandra 4.0.1 work ONLY with the new names ++ (They weren't updated in cassandra.yaml though). - DESCRIBE|DESC was moved to server side in Cassandra 4.0. As a consequence DESRIBE|DESC will not work in cqlsh 6.0.0 being connected to earlier major Cassandra versions where DESCRIBE does not exist server side. - cqlsh shell startup script now prefers 'python3' before 'python' when identifying a runtime. diff --cc src/java/org/apache/cassandra/config/YamlConfigurationLoader.java index b6969f0,05b18be..1bdb9a5 --- a/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java +++ b/src/java/org/apache/cassandra/config/YamlConfigurationLoader.java @@@ -276,4 -336,97 +336,98 @@@ public class YamlConfigurationLoader im } } } + + /** + * @param klass to get replacements for + * @return map of old names and replacements needed. + */ + private static Map<Class<?>, Map<String, Replacement>> getNameReplacements(Class<?> klass) + { + List<Replacement> replacements = getReplacements(klass); + Map<Class<?>, Map<String, Replacement>> objectOldNames = new HashMap<>(); + for (Replacement r : replacements) + { + Map<String, Replacement> oldNames = objectOldNames.computeIfAbsent(r.parent, ignore -> new HashMap<>()); + if (!oldNames.containsKey(r.oldName)) + oldNames.put(r.oldName, r); + else + { + throw new ConfigurationException("Invalid annotations, you have more than one @Replaces annotation in " + + "Config class with same old name(" + r.oldName + ") defined."); + } + } + return objectOldNames; + } + + private static List<Replacement> getReplacements(Class<?> klass) + { + List<Replacement> replacements = new ArrayList<>(); + for (Field field : klass.getDeclaredFields()) + { + String newName = field.getName(); + final ReplacesList[] byType = field.getAnnotationsByType(ReplacesList.class); + if (byType == null || byType.length == 0) + { + Replaces r = field.getAnnotation(Replaces.class); + if (r != null) + addReplacement(klass, replacements, newName, r); + } + else + { + for (ReplacesList replacesList : byType) + for (Replaces r : replacesList.value()) + addReplacement(klass, replacements, newName, r); + } + } + return replacements.isEmpty() ? Collections.emptyList() : replacements; + } + + private static void addReplacement(Class<?> klass, + List<Replacement> replacements, + String newName, + Replaces r) + { + String oldName = r.oldName(); + boolean deprecated = r.deprecated(); + + replacements.add(new Replacement(klass, oldName, newName, deprecated)); + } + + /** + * Holder for replacements to support backward compatibility between old and new names for configuration parameters + * backported partially from trunk(CASSANDRA-15234) to support a bug fix/improvement in Cassadra 4.0 + * (CASSANDRA-17141) + */ + static final class Replacement + { + /** + * Currently we use for Config class + */ + final Class<?> parent; + /** + * Old name of the configuration parameter + */ + final String oldName; + /** + * New name used for the configuration parameter + */ + final String newName; + /** + * A flag to mark whether the old name is deprecated and fire a warning to the user. By default we set it to false. + */ + final boolean deprecated; + + Replacement(Class<?> parent, + String oldName, + String newName, + boolean deprecated) + { + this.parent = Objects.requireNonNull(parent); + this.oldName = Objects.requireNonNull(oldName); + this.newName = Objects.requireNonNull(newName); + // by default deprecated is false + this.deprecated = deprecated; + } + } } ++ diff --cc test/unit/org/apache/cassandra/config/YamlConfigurationLoaderTest.java index a1cb955,3b7e64e..e036c0a --- a/test/unit/org/apache/cassandra/config/YamlConfigurationLoaderTest.java +++ b/test/unit/org/apache/cassandra/config/YamlConfigurationLoaderTest.java @@@ -96,31 -53,7 +100,33 @@@ public class YamlConfigurationLoaderTes assertEquals(seedProvider, config.seed_provider); // Check a parameterized class assertEquals(false, config.client_encryption_options.optional); // Check a nested object assertEquals(true, config.client_encryption_options.enabled); // Check a nested object + assertEquals(5, config.internode_socket_send_buffer_size_in_bytes); // Check names backward compatibility (CASSANDRA-17141) + assertEquals(5, config.internode_socket_receive_buffer_size_in_bytes); // Check names backward compatibility (CASSANDRA-17141) } + + @Test + public void sharedErrorReportingExclusions() + { + Config config = load("data/config/YamlConfigurationLoaderTest/shared_client_error_reporting_exclusions.yaml"); + SubnetGroups expected = new SubnetGroups(Arrays.asList("127.0.0.1", "127.0.0.0/31")); + assertThat(config.client_error_reporting_exclusions).isEqualTo(expected); + assertThat(config.internode_error_reporting_exclusions).isEqualTo(expected); + } + + private static Config load(String path) + { + URL url = YamlConfigurationLoaderTest.class.getClassLoader().getResource(path); + if (url == null) + { + try + { + url = new File(path).toURI().toURL(); + } + catch (MalformedURLException e) + { + throw new AssertionError(e); + } + } + return new YamlConfigurationLoader().loadConfig(url); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
