diff options
author | Matthew Saltz <matthew.saltz@mongodb.com> | 2019-01-28 14:27:19 -0500 |
---|---|---|
committer | Matthew Saltz <matthew.saltz@mongodb.com> | 2019-01-28 15:02:30 -0500 |
commit | a382373c08c3bcafb7931efa519a96cb6c3772bc (patch) | |
tree | 624ae50c0e6b3c40a73c799665dca16239ff3099 | |
parent | 0494c3f8b0b359fa98c5b191e12694150563d0b1 (diff) | |
download | mongo-a382373c08c3bcafb7931efa519a96cb6c3772bc.tar.gz |
SERVER-37046 Improve error message when moveChunk fails during top chunk optimization
-rw-r--r-- | src/mongo/db/s/balancer/balancer.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/s/chunk_splitter.cpp | 18 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp index 7b4759d3a35..c52c26b45ca 100644 --- a/src/mongo/db/s/balancer/balancer.cpp +++ b/src/mongo/db/s/balancer/balancer.cpp @@ -283,7 +283,7 @@ Status Balancer::moveSingleChunk(OperationContext* opCtx, void Balancer::report(OperationContext* opCtx, BSONObjBuilder* builder) { auto balancerConfig = Grid::get(opCtx)->getBalancerConfiguration(); - balancerConfig->refreshAndCheck(opCtx).transitional_ignore(); + balancerConfig->refreshAndCheck(opCtx).ignore(); const auto mode = balancerConfig->getBalancerMode(); @@ -395,7 +395,7 @@ void Balancer::_mainThread() { _endRound(opCtx.get(), _balancedLastTime ? kShortBalanceRoundInterval : kBalanceRoundDefaultInterval); - } catch (const std::exception& e) { + } catch (const DBException& e) { log() << "caught exception while doing balance: " << e.what(); // Just to match the opening statement if in log level 1 @@ -406,7 +406,7 @@ void Balancer::_mainThread() { ShardingLogging::get(opCtx.get()) ->logAction(opCtx.get(), "balancer.round", "", roundDetails.toBSON()) - .transitional_ignore(); + .ignore(); // Sleep a fair amount before retrying because of the error _endRound(opCtx.get(), kBalanceRoundDefaultInterval); diff --git a/src/mongo/db/s/chunk_splitter.cpp b/src/mongo/db/s/chunk_splitter.cpp index 2e6fb9cc4b7..d934615c9ce 100644 --- a/src/mongo/db/s/chunk_splitter.cpp +++ b/src/mongo/db/s/chunk_splitter.cpp @@ -398,15 +398,19 @@ void ChunkSplitter::_runAutosplit(std::shared_ptr<ChunkSplitStateDriver> chunkSp return; } - // Tries to move the top chunk out of the shard to prevent the hot spot from staying on a - // single shard. This is based on the assumption that succeeding inserts will fall on the - // top chunk. - moveChunk(opCtx.get(), nss, topChunkMinKey); + try { + // Tries to move the top chunk out of the shard to prevent the hot + // spot from staying on a single shard. This is based on the + // assumption that succeeding inserts will fall on the top chunk. + moveChunk(opCtx.get(), nss, topChunkMinKey); + } catch (const DBException& ex) { + log() << "Top-chunk optimization failed to move chunk " + << redact(ChunkRange(min, max).toString()) << " in collection " << nss + << " after a successful split" << causedBy(redact(ex.toStatus())); + } } catch (const DBException& ex) { log() << "Unable to auto-split chunk " << redact(ChunkRange(min, max).toString()) - << " in nss " << nss << causedBy(redact(ex.toStatus())); - } catch (const std::exception& e) { - log() << "caught exception while splitting chunk: " << redact(e.what()); + << " in namespace " << nss << causedBy(redact(ex.toStatus())); } } |