summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-05-26 13:45:49 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-18 02:43:36 +0000
commit57f7c1c616905cf4ef79e99553af02a52bfc898a (patch)
treef3431c975c21d98088bfff4c108a6e3152e2e32c
parent3db3df0dcf3da3cf5d6c5392b00ef5d117d17ddf (diff)
downloadmongo-57f7c1c616905cf4ef79e99553af02a52bfc898a.tar.gz
SERVER-56424 Sorter detects and converts out of disk space system error rather than throwing default unnamed error code
(cherry picked from commit 044ada4e8958efb1c8e045bb5a6e0702bb0686cf)
-rw-r--r--src/mongo/db/sorter/sorter.cpp8
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