Browse Source

KAFKA-8784: remove default close for RocksDBConfigSetter (#10416)

Remove the default close implementation for RocksDBConfigSetter to avoid accidental memory leaks via C++ backed objects which are constructed but not closed by the user

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>
pull/10430/head
Walker Carlson 4 years ago committed by GitHub
parent
commit
e971d94eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      docs/streams/upgrade-guide.html
  2. 4
      streams/src/main/java/org/apache/kafka/streams/state/RocksDBConfigSetter.java
  3. 4
      streams/src/test/java/org/apache/kafka/test/MockRocksDbConfigSetter.java

3
docs/streams/upgrade-guide.html

@ -93,6 +93,9 @@ @@ -93,6 +93,9 @@
</p>
<h3><a id="streams_api_changes_300" href="#streams_api_changes_300">Streams API changes in 3.0.0</a></h3>
<p>
We removed the default implementation of <code>RocksDBConfigSetter#close()</code>.
</p>
<p>
We removed the following deprecated APIs:
</p>

4
streams/src/main/java/org/apache/kafka/streams/state/RocksDBConfigSetter.java

@ -57,7 +57,5 @@ public interface RocksDBConfigSetter { @@ -57,7 +57,5 @@ public interface RocksDBConfigSetter {
* @param storeName the name of the store being configured
* @param options the RocksDB options
*/
default void close(final String storeName, final Options options) {
LOG.warn("The default close will be removed in 3.0.0 -- you should overwrite it if you have implemented RocksDBConfigSetter");
}
void close(final String storeName, final Options options);
}

4
streams/src/test/java/org/apache/kafka/test/MockRocksDbConfigSetter.java

@ -32,4 +32,8 @@ public class MockRocksDbConfigSetter implements RocksDBConfigSetter { @@ -32,4 +32,8 @@ public class MockRocksDbConfigSetter implements RocksDBConfigSetter {
configMap.putAll(configs);
}
@Override
public void close(String storeName, Options options) {
}
}

Loading…
Cancel
Save