Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db: avoid acquiring DB.mu during batch commit, unless rotating memtable
Previously, DB.commitWrite would acquire the DB.mu before calling makeRoomForWrite to ensure the current memtable had sufficient space for the batch's contents. When DB.commitWrite is called, the caller already holds the commit pipeline's mutex providing mutual exclusion with other committers and, crucially, preventing the concurrent rotation of the memtable. This commit adjusts DB.commitWrite to attempt reserving space in the current mutable memtable before acquiring DB.mu. In the common case, if successful, there is no need to acquire DB.mu. If unsuccessful, the committer falls back to acuqiring DB.mu and rotating the memtable through calling makeRoomForWrite. Close #2680.
- Loading branch information