CancelAllBackgroundWork: Flush of unpersisted data waits for stall conditions to clear and delays db close
- Dominant language
- C++
- Stars
- 32.1k
- Forks
- 6.9k
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Description
Hey RocksDB team,
I have a small question regarding the behavior when closing the db.
Currently, when `CancelAllBackgroundWork` is called, a flush is initiated if there is any unpersisted data - here https://github.com/facebook/rocksdb/blob/acf77e1bfee9ebb0867ac277927ed2e37276c493/db/db_impl/db_impl.cc#L496
The above flush request will wait until certain stall conditions are cleared - in detail here: https://github.com/facebook/rocksdb/blob/acf77e1bfee9ebb0867ac277927ed2e37276c493/db/db_impl/db_impl_compaction_flush.cc#L2617
Since the default value for `allow_write_stall` in `FlushOptions` is false. This means the DB Close() will have to wait for those stall conditions to clear.
I find this behaviour unexpected since the user is sometimes unaware of this connection and the call to close the db might take much longer than expected.
Is there a reason why we should not pass `allow_write_stall = true` ?
`CancelAllBackgroundWork(true)` can be passed if waiting for bg work is needed and the problem as i see it currently is that even when calling `CancelAllBackgroundWork(false)`, the call will be delayed in cases of unpersisted data and a stall condition.
Thanks
Contributor guide
Assessment
This issue has not been assessed yet.