summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/split_chunk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/split_chunk.cpp')
-rw-r--r--src/mongo/db/s/split_chunk.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/s/split_chunk.cpp b/src/mongo/db/s/split_chunk.cpp
index 7a34132f7ad..181fa43c1fa 100644
--- a/src/mongo/db/s/split_chunk.cpp
+++ b/src/mongo/db/s/split_chunk.cpp
@@ -144,10 +144,10 @@ StatusWith<boost::optional<ChunkRange>> splitChunk(OperationContext* opCtx,
auto scopedDistLock = Grid::get(opCtx)->catalogClient()->getDistLockManager()->lock(
opCtx, nss.ns(), whyMessage, DistLockManager::kSingleLockAttemptTimeout);
if (!scopedDistLock.isOK()) {
- errmsg = str::stream() << "could not acquire collection lock for " << nss.toString()
- << " to split chunk " << chunkRange.toString() << " "
- << causedBy(scopedDistLock.getStatus());
- return {scopedDistLock.getStatus().code(), errmsg};
+ return scopedDistLock.getStatus().withContext(
+ str::stream() << "could not acquire collection lock for " << nss.toString()
+ << " to split chunk "
+ << chunkRange.toString());
}
// If the shard key is hashed, then we must make sure that the split points are of type
@@ -220,7 +220,7 @@ StatusWith<boost::optional<ChunkRange>> splitChunk(OperationContext* opCtx,
<< refreshStatus.toString();
warning() << redact(errmsg);
- return {errorStatus.code(), errmsg};
+ return errorStatus.withReason(errmsg);
}
}