From 97cf151afbddcac8ed43fc95b0f05cfa813efd3d Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Fri, 18 Oct 2024 12:50:23 +0200 Subject: [PATCH] Flush before closing column family handles --- .../core/impl/rocksdb/TransactionalDB.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/TransactionalDB.java b/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/TransactionalDB.java index b0e5bf1..7842d51 100644 --- a/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/TransactionalDB.java +++ b/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/TransactionalDB.java @@ -149,13 +149,6 @@ public sealed interface TransactionalDB extends Closeable { } catch (Exception ex) { exceptions.add(ex); } - for (ColumnFamilyHandle handle : handles) { - try { - handle.close(); - } catch (Exception ex) { - exceptions.add(ex); - } - } try { if (db.isOwningHandle()) { db.flushWal(true); @@ -165,11 +158,18 @@ public sealed interface TransactionalDB extends Closeable { } try (var options = new FlushOptions().setWaitForFlush(true).setAllowWriteStall(true)) { if (db.isOwningHandle()) { - db.flush(options); + db.flush(options, handles); } } catch (RocksDBException e) { exceptions.add(e); } + for (ColumnFamilyHandle handle : handles) { + try { + handle.close(); + } catch (Exception ex) { + exceptions.add(ex); + } + } try { if (db.isOwningHandle()) { db.closeE();