Flush before closing column family handles

This commit is contained in:
Andrea Cavalli 2024-10-18 12:50:23 +02:00
parent 02eea5ac66
commit 97cf151afb

View File

@ -149,13 +149,6 @@ public sealed interface TransactionalDB extends Closeable {
} catch (Exception ex) { } catch (Exception ex) {
exceptions.add(ex); exceptions.add(ex);
} }
for (ColumnFamilyHandle handle : handles) {
try {
handle.close();
} catch (Exception ex) {
exceptions.add(ex);
}
}
try { try {
if (db.isOwningHandle()) { if (db.isOwningHandle()) {
db.flushWal(true); db.flushWal(true);
@ -165,11 +158,18 @@ public sealed interface TransactionalDB extends Closeable {
} }
try (var options = new FlushOptions().setWaitForFlush(true).setAllowWriteStall(true)) { try (var options = new FlushOptions().setWaitForFlush(true).setAllowWriteStall(true)) {
if (db.isOwningHandle()) { if (db.isOwningHandle()) {
db.flush(options); db.flush(options, handles);
} }
} catch (RocksDBException e) { } catch (RocksDBException e) {
exceptions.add(e); exceptions.add(e);
} }
for (ColumnFamilyHandle handle : handles) {
try {
handle.close();
} catch (Exception ex) {
exceptions.add(ex);
}
}
try { try {
if (db.isOwningHandle()) { if (db.isOwningHandle()) {
db.closeE(); db.closeE();