Browse Source

HOT FIX: close RocksDB objects in correct order (#7076)

Reviewers: Bill Bejeck <bill@confluent.io>, Matthias J. Sax <matthias@confluent.io>
pull/7091/head
A. Sophie Blee-Goldman 5 years ago committed by Matthias J. Sax
parent
commit
d2328a1a0e
  1. 3
      streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java
  2. 4
      streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java

3
streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java

@ -1384,7 +1384,8 @@ class RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter extends Options
@Override @Override
public void close() { public void close() {
columnFamilyOptions.close(); // ColumnFamilyOptions should be closed last
dbOptions.close(); dbOptions.close();
columnFamilyOptions.close();
} }
} }

4
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; 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(); dbAccessor.close();
db.close();
userSpecifiedOptions.close(); userSpecifiedOptions.close();
wOptions.close(); wOptions.close();
fOptions.close(); fOptions.close();
db.close();
filter.close(); filter.close();
cache.close(); cache.close();

Loading…
Cancel
Save