asfgit closed pull request #6660: [FLINK-9735] Potential resource leak in
RocksDBStateBackend#getDbOptions
URL: https://github.com/apache/flink/pull/6660
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBResource.java
b/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBResource.java
index 0407cc7e32a..a415a83b5d8 100644
---
a/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBResource.java
+++
b/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBResource.java
@@ -30,6 +30,8 @@
import org.rocksdb.ReadOptions;
import org.rocksdb.RocksDB;
import org.rocksdb.WriteOptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
@@ -43,6 +45,8 @@
*/
public class RocksDBResource extends ExternalResource {
+ private static final Logger LOG =
LoggerFactory.getLogger(RocksDBResource.class);
+
/** Factory for {@link DBOptions} and {@link ColumnFamilyOptions}. */
private final OptionsFactory optionsFactory;
@@ -74,11 +78,25 @@ public RocksDBResource() {
this(new OptionsFactory() {
@Override
public DBOptions createDBOptions(DBOptions
currentOptions) {
+ //close it before reuse the reference.
+ try {
+ currentOptions.close();
+ } catch (Exception e) {
+ LOG.error("Close previous DBOptions's
instance failed.", e);
+ }
+
return
PredefinedOptions.FLASH_SSD_OPTIMIZED.createDBOptions();
}
@Override
public ColumnFamilyOptions
createColumnOptions(ColumnFamilyOptions currentOptions) {
+ //close it before reuse the reference.
+ try {
+ currentOptions.close();
+ } catch (Exception e) {
+ LOG.error("Close previous DBOptions's
instance failed.", e);
+ }
+
return
PredefinedOptions.FLASH_SSD_OPTIMIZED.createColumnOptions();
}
});
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services