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-07-20 20:40:40 +0000
commitb16aad93159684f4dd9a1640997cf78338aa8aea (patch)
tree46ae72e9633fff1a872baff2939a2a678a232c94
parent58cb09ed37fdcbf55b405d8fb17742bdd901e99d (diff)
downloadmongo-b16aad93159684f4dd9a1640997cf78338aa8aea.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 aa387dcb944..661b2effab0 100644
--- a/src/mongo/db/sorter/sorter.cpp
+++ b/src/mongo/db/sorter/sorter.cpp
@@ -1033,6 +1033,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() << ": " << _fileName);
+ }
+ msgasserted(5642403,
+ str::stream() << "error writing to file \"" << _fileName
+ << "\": " << sorter::myErrnoWithDescription());
} catch (const std::exception&) {
msgasserted(16821,
str::stream() << "error writing to file \"" << _fileName