diff options
author | Benety Goh <benety@mongodb.com> | 2021-05-26 13:45:49 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-26 18:26:59 +0000 |
commit | 044ada4e8958efb1c8e045bb5a6e0702bb0686cf (patch) | |
tree | e6ff0d1b3246d237fb7862947c3bcf0307822c00 /src | |
parent | e812f2356243c2a20e2869ca9d06869ba8129ee4 (diff) | |
download | mongo-044ada4e8958efb1c8e045bb5a6e0702bb0686cf.tar.gz |
SERVER-56424 Sorter detects and converts out of disk space system error rather than throwing default unnamed error code
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/sorter/sorter.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp index 330b3b6cc1f..9b6a49d4752 100644 --- a/src/mongo/db/sorter/sorter.cpp +++ b/src/mongo/db/sorter/sorter.cpp @@ -1132,6 +1132,14 @@ void SortedFileWriter<Key, Value>::spill() { try { _file.write(reinterpret_cast<const char*>(&size), sizeof(size)); _file.write(outBuffer, std::abs(size)); + } catch (const std::system_error& ex) { + if (ex.code() == std::errc::no_space_on_device) { + msgasserted(ErrorCodes::OutOfDiskSpace, + str::stream() << ex.what() << ": " << _fileFullPath); + } + msgasserted(5642403, + str::stream() << "error writing to file \"" << _fileFullPath + << "\": " << sorter::myErrnoWithDescription()); } catch (const std::exception&) { msgasserted(16821, str::stream() << "error writing to file \"" << _fileFullPath |