diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
| commit | 4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch) | |
| tree | 1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/s/write_ops/write_op.cpp | |
| parent | aa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff) | |
| parent | 8f0827553e09872941945a093b647a4211a9db7f (diff) | |
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0'
with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/s/write_ops/write_op.cpp')
| -rw-r--r-- | src/mongo/s/write_ops/write_op.cpp | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/src/mongo/s/write_ops/write_op.cpp b/src/mongo/s/write_ops/write_op.cpp index 6b33d3b9312..236c7efbc94 100644 --- a/src/mongo/s/write_ops/write_op.cpp +++ b/src/mongo/s/write_ops/write_op.cpp @@ -29,24 +29,7 @@ #include "mongo/s/write_ops/write_op.h" - -#include <absl/container/flat_hash_set.h> -#include <algorithm> -#include <boost/move/utility_core.hpp> -#include <boost/none.hpp> -#include <boost/optional/optional.hpp> -#include <ostream> -#include <string> - -#include "mongo/base/error_codes.h" -#include "mongo/base/status.h" -#include "mongo/bson/bsonobjbuilder.h" -#include "mongo/db/catalog/collection_uuid_mismatch_info.h" -#include "mongo/db/stats/counters.h" -#include "mongo/s/sharding_feature_flags_gen.h" #include "mongo/s/transaction_router.h" -#include "mongo/s/write_ops/batch_write_op.h" -#include "mongo/s/write_ops/batched_command_request.h" #include "mongo/util/assert_util.h" namespace mongo { @@ -96,16 +79,6 @@ write_ops::WriteError combineOpErrors(const std::vector<ChildWriteOp const*>& er Status(MultipleErrorsOccurredInfo(errB.arr()), msg.str())); } -bool isSafeToIgnoreErrorInPartiallyAppliedOp(write_ops::WriteError& error) { - // UUID mismatch errors are safe to ignore if the actualCollection is null in conjuntion with - // other successful operations. This is true because it means we wrongly targeted a non-owning - // shard with the operation and we wouldn't have applied any modifications anyway. - // - // Note this is only safe if we're using ShardVersion::IGNORED since we're ignoring any - // placement concern and broadcasting to all shards. - return error.getStatus().code() == ErrorCodes::CollectionUUIDMismatch && - !error.getStatus().extraInfo<CollectionUUIDMismatchInfo>()->actualCollection(); -} } // namespace const BatchItemRef& WriteOp::getWriteItem() const { @@ -209,29 +182,7 @@ void WriteOp::_updateOpState() { _state = WriteOpState_Ready; } else if (!childErrors.empty()) { _error = combineOpErrors(childErrors); - bool isTargetingAllShardsWithSVIgnored = - childErrors.front() - ->endpoint->shardVersion - .map([&](const auto& cv) { return ChunkVersion::isIgnoredVersion(cv); }) - .get_value_or(false); - // There are errors that are safe to ignore if they were correctly applied to other shards - // and we're using ShardVersion::IGNORED. They are safe to ignore as they can be interpreted - // as no-ops if the shard response had been instead a successful result since they wouldn't - // have modified any data. As a result, we can swallow the errors and treat them as a - // successful operation. - if (isTargetingAllShardsWithSVIgnored && isSafeToIgnoreErrorInPartiallyAppliedOp(*_error) && - !_successfulShardSet.empty()) { - if (!hasPendingChild) { - _error.reset(); - _state = WriteOpState_Completed; - } else { - // As this error is acceptable we wait until all other operations finish to take a - // decision. - return; - } - } else { - _state = WriteOpState_Error; - } + _state = WriteOpState_Error; } else if (hasPendingChild && _inTxn) { // Return early here since this means that there were no errors while in txn // but there are still ops that have not yet finished. |
