Fix RocksDB auto-recovery from SpaceLimit err (#5334)

Summary:
If RocksDB is configured with a positive max_allowed_space (via sst file manager),
then the sst file manager should use this value instead of total free disk
space to determine whether to clear the background error of space limit
reached.

In DBSSTTest.DBWithMaxSpaceAllowed, we configure a low space limit that is very
likely lower than the free disk space of the test machine. Therefore, once the
test db encounters a Status::SpaceLimit, error handler will call into sst file
manager to start error recovery which may clear the bg error since disk free
space is larger than reserved_disk_buffer_.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5334

Differential Revision: D15501622

Pulled By: riversand963

fbshipit-source-id: 58035efc450b062d6b28c78c322005ec3705fb47
This commit is contained in:
Yanqin Jin 2019-05-24 18:35:11 -07:00 committed by Facebook Github Bot
parent b09c018b4d
commit bd9f1d2d0f

View File

@ -266,6 +266,9 @@ void SstFileManagerImpl::ClearError() {
uint64_t free_space;
Status s = env_->GetFreeSpace(path_, &free_space);
free_space = max_allowed_space_ > 0
? std::min(max_allowed_space_, free_space)
: free_space;
if (s.ok()) {
// In case of multi-DB instances, some of them may have experienced a
// soft error and some a hard error. In the SstFileManagerImpl, a hard