Closed jowlyzhang closed 3 weeks ago
@ajkr Thank you for the quick review!
@jowlyzhang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@jowlyzhang merged this pull request in facebook/rocksdb@f5e44f34904d78d1f649452dc19ef3b36b94ea9d.
This PR fix a possible manual flush hanging scenario because of its expectation that others will clear out excessive memtables was not met. The root cause is the FlushRequest rescheduling logic is using a stricter criteria for what a write stall is about to happen means than
WaitUntilFlushWouldNotStallWrites
does. Currently, the former thinks a write stall is about to happen when the last memtable is half full, and it will instead reschedule queued FlushRequest and not actually proceed with the flush. While the latter thinks if we already start to use the last memtable, we should wait until some other background flush jobs clear out some memtables before proceed this manual flush.If we make them use the same criteria, we can guarantee that at any time when
WaitUntilFlushWouldNotStallWrites
is waiting, it's not because the rescheduling logic is holding it back.Test plan: Added unit test