Details
-
Bug
-
Resolution: Fixed
-
Major
-
2.5.1
-
Security Level: Public
-
None
-
Untriaged
-
Unknown
Description
If a database's configuration's wal_flush_before_commit is set to true, and a lot of documents are added in a transaction, then ForestDB will eventually start flushing the WAL after every fdb_set call, causing a major slowdown. (In my benchmark code I'm seeing the populate-database test take 3x as long with wal_flush_before_commit enabled.)
The problem I'm seeing is that the trigger for a WAL flush is
wal_get_size(file) > _fdb_get_wal_threshold(handle))
(forestdb.cc:2030). But when a transaction is active, the flush doesn't actually commit the WAL, so its size doesn't decrease. Therefore, once wal_get_size hits a large enough value, every single fdb_set call will trigger another flush.