diff options
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/client/shard_connection.cpp | 1 | ||||
-rw-r--r-- | src/mongo/s/d_split.cpp | 6 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batch_write_exec.cpp | 14 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batch_write_exec_test.cpp | 7 | ||||
-rw-r--r-- | src/mongo/s/write_ops/write_error_detail.cpp | 12 | ||||
-rw-r--r-- | src/mongo/s/write_ops/write_error_detail.h | 3 |
6 files changed, 5 insertions, 38 deletions
diff --git a/src/mongo/s/client/shard_connection.cpp b/src/mongo/s/client/shard_connection.cpp index 177fd934e8c..0f64014f5e8 100644 --- a/src/mongo/s/client/shard_connection.cpp +++ b/src/mongo/s/client/shard_connection.cpp @@ -41,7 +41,6 @@ #include "mongo/s/client/shard.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" -#include "mongo/s/stale_exception.h" #include "mongo/s/version_manager.h" #include "mongo/util/concurrency/spin_lock.h" #include "mongo/util/exit.h" diff --git a/src/mongo/s/d_split.cpp b/src/mongo/s/d_split.cpp index d8a690d211e..4aa5231ccc6 100644 --- a/src/mongo/s/d_split.cpp +++ b/src/mongo/s/d_split.cpp @@ -681,9 +681,9 @@ public: // Mongos >= v3.2 sends the full version, v3.0 only sends the epoch. // TODO(SERVER-20742): Stop parsing epoch separately after 3.2. OID cmdEpoch; - auto& operationVersion = OperationShardingState::get(txn); - if (operationVersion.hasShardVersion()) { - cmdVersion = operationVersion.getShardVersion(nss); + auto& oss = OperationShardingState::get(txn); + if (oss.hasShardVersion()) { + cmdVersion = oss.getShardVersion(nss); cmdEpoch = cmdVersion.epoch(); } else { BSONElement epochElem(cmdObj["epoch"]); diff --git a/src/mongo/s/write_ops/batch_write_exec.cpp b/src/mongo/s/write_ops/batch_write_exec.cpp index d9ce669e3f7..e056e05609c 100644 --- a/src/mongo/s/write_ops/batch_write_exec.cpp +++ b/src/mongo/s/write_ops/batch_write_exec.cpp @@ -79,12 +79,6 @@ static void noteStaleResponses(const vector<ShardError*>& staleErrors, NSTargete } } -static bool isShardMetadataChanging(const vector<ShardError*>& staleErrors) { - if (!staleErrors.empty() && staleErrors.back()->error.isErrInfoSet()) - return staleErrors.back()->error.getErrInfo()["inCriticalSection"].trueValue(); - return false; -} - // The number of times we'll try to continue a batch op if no progress is being made // This only applies when no writes are occurring and metadata is not changing on reload static const int kMaxRoundsWithoutProgress(5); @@ -152,7 +146,6 @@ void BatchWriteExec::executeBatch(OperationContext* txn, size_t numSent = 0; size_t numToSend = childBatches.size(); - bool remoteMetadataChanging = false; while (numSent != numToSend) { // Collect batches out on the network, mapped by endpoint OwnedHostBatchMap ownedPendingBatches; @@ -270,11 +263,6 @@ void BatchWriteExec::executeBatch(OperationContext* txn, ++stats->numStaleBatches; } - // Remember if the shard is actively changing metadata right now - if (isShardMetadataChanging(staleErrors)) { - remoteMetadataChanging = true; - } - // Remember that we successfully wrote to this shard // NOTE: This will record lastOps for shards where we actually didn't update // or delete any documents, which preserves old behavior but is conservative @@ -327,7 +315,7 @@ void BatchWriteExec::executeBatch(OperationContext* txn, // int currCompletedOps = batchOp.numWriteOpsIn(WriteOpState_Completed); - if (currCompletedOps == numCompletedOps && !targeterChanged && !remoteMetadataChanging) { + if (currCompletedOps == numCompletedOps && !targeterChanged) { ++numRoundsWithoutProgress; } else { numRoundsWithoutProgress = 0; diff --git a/src/mongo/s/write_ops/batch_write_exec_test.cpp b/src/mongo/s/write_ops/batch_write_exec_test.cpp index 100fb1806a1..bf0e4c8685a 100644 --- a/src/mongo/s/write_ops/batch_write_exec_test.cpp +++ b/src/mongo/s/write_ops/batch_write_exec_test.cpp @@ -290,11 +290,6 @@ TEST(BatchWriteExecTests, ManyStaleOpWithMigration) { error.setErrCode(ErrorCodes::StaleShardVersion); error.setErrMessage("mock stale error"); for (int i = 0; i < 10; i++) { - if (i % 2 == 0) - error.setErrInfo(BSONObj()); - else - error.setErrInfo(BSON("inCriticalSection" << true)); - mockResults.push_back(new MockWriteResult(backend.shardHost, error)); } @@ -306,7 +301,7 @@ TEST(BatchWriteExecTests, ManyStaleOpWithMigration) { backend.exec->executeBatch(&txn, request, &response, &stats); ASSERT(response.getOk()); - ASSERT_EQUALS(stats.numStaleBatches, 10); + ASSERT_EQUALS(stats.numStaleBatches, 6); } } // namespace diff --git a/src/mongo/s/write_ops/write_error_detail.cpp b/src/mongo/s/write_ops/write_error_detail.cpp index cc2368154fe..51baaecd790 100644 --- a/src/mongo/s/write_ops/write_error_detail.cpp +++ b/src/mongo/s/write_ops/write_error_detail.cpp @@ -154,10 +154,6 @@ void WriteErrorDetail::setIndex(int index) { _isIndexSet = true; } -void WriteErrorDetail::unsetIndex() { - _isIndexSet = false; -} - bool WriteErrorDetail::isIndexSet() const { return _isIndexSet; } @@ -172,10 +168,6 @@ void WriteErrorDetail::setErrCode(int errCode) { _isErrCodeSet = true; } -void WriteErrorDetail::unsetErrCode() { - _isErrCodeSet = false; -} - bool WriteErrorDetail::isErrCodeSet() const { return _isErrCodeSet; } @@ -190,10 +182,6 @@ void WriteErrorDetail::setErrInfo(const BSONObj& errInfo) { _isErrInfoSet = true; } -void WriteErrorDetail::unsetErrInfo() { - _isErrInfoSet = false; -} - bool WriteErrorDetail::isErrInfoSet() const { return _isErrInfoSet; } diff --git a/src/mongo/s/write_ops/write_error_detail.h b/src/mongo/s/write_ops/write_error_detail.h index 9c431f02f57..e0dec80ce52 100644 --- a/src/mongo/s/write_ops/write_error_detail.h +++ b/src/mongo/s/write_ops/write_error_detail.h @@ -77,17 +77,14 @@ public: // void setIndex(int index); - void unsetIndex(); bool isIndexSet() const; int getIndex() const; void setErrCode(int errCode); - void unsetErrCode(); bool isErrCodeSet() const; int getErrCode() const; void setErrInfo(const BSONObj& errInfo); - void unsetErrInfo(); bool isErrInfoSet() const; const BSONObj& getErrInfo() const; |