This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch release-1.13
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.13 by this push:
     new 0e1468a  [FLINK-21986][State Backends] fix native memory used by 
RocksDB not be released timely after job restart
0e1468a is described below

commit 0e1468a4aadf68019f034eaad8bbf50a8ecf9589
Author: wangfeifan <[email protected]>
AuthorDate: Thu Apr 15 14:18:53 2021 +0800

    [FLINK-21986][State Backends] fix native memory used by RocksDB not be 
released timely after job restart
    
    [FLINK-21986][State Backends] fix spotless-check error
    
    This closes #15619.
---
 .../flink/contrib/streaming/state/RocksDBOperationUtils.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBOperationUtils.java
 
b/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBOperationUtils.java
index e14d83b..74dcc92 100644
--- 
a/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBOperationUtils.java
+++ 
b/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBOperationUtils.java
@@ -248,8 +248,16 @@ public class RocksDBOperationUtils {
     public static void addColumnFamilyOptionsToCloseLater(
             List<ColumnFamilyOptions> columnFamilyOptions, ColumnFamilyHandle 
columnFamilyHandle) {
         try {
-            if (columnFamilyHandle != null && 
columnFamilyHandle.getDescriptor() != null) {
-                
columnFamilyOptions.add(columnFamilyHandle.getDescriptor().getOptions());
+            // IMPORTANT NOTE: Do not call ColumnFamilyHandle#getDescriptor() 
just to judge if it
+            // return null and then call it again when it return is not null. 
That will cause
+            // task manager native memory used by RocksDB can't be released 
timely after job
+            // restart.
+            // The problem can find in : 
https://issues.apache.org/jira/browse/FLINK-21986
+            if (columnFamilyHandle != null) {
+                ColumnFamilyDescriptor columnFamilyDescriptor = 
columnFamilyHandle.getDescriptor();
+                if (columnFamilyDescriptor != null) {
+                    
columnFamilyOptions.add(columnFamilyDescriptor.getOptions());
+                }
             }
         } catch (RocksDBException e) {
             // ignore

Reply via email to