Skip to content

Commit 37895c3

Browse files
authored
rocksdb: fix out of bounds when flush is empty (#3605)
1 parent 9591d66 commit 37895c3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

execution_chain/db/core_db/backend/rocksdb_desc.nim

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@ proc commit*(
7272
# Write to disk if everyone that opened a session also committed it
7373
?rdb.db.write(session.batch)
7474

75-
# This flush forces memtables to be written to disk, which is necessary given
76-
# the use of vector memtables which have very bad lookup performance.
77-
rdb.db.flush(session.families.mapIt(it.handle())).isOkOr:
78-
# Not sure what to do here - the commit above worked so it would be strange
79-
# to have an error here
80-
warn "Could not flush database", error
75+
if session.families.len > 0:
76+
# This flush forces memtables to be written to disk, which is necessary given
77+
# the use of vector memtables which have very bad lookup performance.
78+
rdb.db.flush(session.families.mapIt(it.handle())).isOkOr:
79+
# Not sure what to do here - the commit above worked so it would be strange
80+
# to have an error here
81+
warn "Could not flush database", error
8182

8283
ok()
8384

0 commit comments

Comments
 (0)