kafka-commits mailing list archives

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

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


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

commit 74b672b0fa11bd5989f1e1f2559686ed433999ed
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  | 5 ++++-
 2 files changed, 6 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 c07e43b..ba83c02 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
@@ -1356,7 +1356,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 109b8c3..ee62ec7 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
@@ -374,11 +374,14 @@ public class RocksDBStore implements KeyValueStore<Bytes, byte[]>
{
 
         open = false;
         closeOpenIterators();
+
+        // 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();
 
         dbAccessor = null;


Mime
View raw message