kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mj...@apache.org
Subject [kafka] branch 2.3 updated: HOT FIX: close RocksDB objects in correct order (#7076)
Date Fri, 12 Jul 2019 19:44:57 GMT
This is an automated email from the ASF dual-hosted git repository.

mjsax pushed a commit to branch 2.3
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.3 by this push:
     new 5942700  HOT FIX: close RocksDB objects in correct order (#7076)
5942700 is described below

commit 5942700a45363170c914f5a450bba0d9b3ca05d8
Author: A. Sophie Blee-Goldman <sophie@confluent.io>
AuthorDate: Fri Jul 12 12:43:46 2019 -0700

    HOT FIX: close RocksDB objects in correct order (#7076)
    
    Reviewers: Bill Bejeck <bill@confluent.io>, Matthias J. Sax <matthias@confluent.io>
---
 .../RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java   | 3 ++-
 .../java/org/apache/kafka/streams/state/internals/RocksDBStore.java   | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java
b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java
index d28682a..5b892a2 100644
--- a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java
+++ b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java
@@ -1384,7 +1384,8 @@ class RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter extends
Options
 
     @Override
     public void close() {
-        columnFamilyOptions.close();
+        // ColumnFamilyOptions should be closed last
         dbOptions.close();
+        columnFamilyOptions.close();
     }
 }
diff --git a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
index 0643e64..bcc4372 100644
--- a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
+++ b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
@@ -402,11 +402,13 @@ public class RocksDBStore implements KeyValueStore<Bytes, byte[]>,
BulkLoadingSt
             configSetter = null;
         }
 
+        // Important: do not rearrange the order in which the below objects are closed!
+        // Order of closing must follow: ColumnFamilyHandle > RocksDB > DBOptions >
ColumnFamilyOptions
         dbAccessor.close();
+        db.close();
         userSpecifiedOptions.close();
         wOptions.close();
         fOptions.close();
-        db.close();
         filter.close();
         cache.close();
 


Mime
View raw message