diff options
author | a-sumin <a-sumin@yandex-team.com> | 2023-04-10 15:28:58 +0300 |
---|---|---|
committer | a-sumin <a-sumin@yandex-team.com> | 2023-04-10 15:28:58 +0300 |
commit | c6c5b4a72c1f23e9c0b7f27ba35d51dfa7731594 (patch) | |
tree | aa96eb029145f9ee7eb6e70237d2ae2271fcd400 | |
parent | 96a67139545e4e9fe45eb11cd25c3cdc4e11cc36 (diff) | |
download | ydb-c6c5b4a72c1f23e9c0b7f27ba35d51dfa7731594.tar.gz |
Do not overwrite ErrorReason
4 files changed, 19 insertions, 16 deletions
diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.cpp index 8b7af89d97..7e05633b8f 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.cpp @@ -454,7 +454,7 @@ void TBlackboard::AddErrorResponse(const TLogoBlobID &id, ui32 orderNumber) { EStrategyOutcome TBlackboard::RunStrategy(TLogContext &logCtx, const IStrategy& s, TBatchedVec<TBlobStates::value_type*> *finished) { IStrategy& temp = const_cast<IStrategy&>(s); // better UX Y_VERIFY(BlobStates.size()); - EStrategyOutcome outcome = EStrategyOutcome::IN_PROGRESS; + TString errorReason; for (auto it = BlobStates.begin(); it != BlobStates.end(); ++it) { auto& blob = it->second; if (!blob.IsChanged) { @@ -468,7 +468,6 @@ EStrategyOutcome TBlackboard::RunStrategy(TLogContext &logCtx, const IStrategy& DoneCount--; blob.IsDone = false; } - outcome = EStrategyOutcome::IN_PROGRESS; break; case EStrategyOutcome::ERROR: @@ -479,11 +478,11 @@ EStrategyOutcome TBlackboard::RunStrategy(TLogContext &logCtx, const IStrategy& if (finished) { finished->push_back(&*it); } - if (outcome.ErrorReason) { - outcome.ErrorReason += " && "; - outcome.ErrorReason += res.ErrorReason; + if (errorReason) { + errorReason += " && "; + errorReason += res.ErrorReason; } else { - outcome.ErrorReason = res.ErrorReason; + errorReason = res.ErrorReason; } } if (!blob.IsDone) { @@ -506,9 +505,10 @@ EStrategyOutcome TBlackboard::RunStrategy(TLogContext &logCtx, const IStrategy& break; } } - if (DoneCount == (BlobStates.size() + DoneBlobStates.size())) { - outcome = EStrategyOutcome::DONE; - } + + const bool isDone = (DoneCount == (BlobStates.size() + DoneBlobStates.size())); + EStrategyOutcome outcome(isDone ? EStrategyOutcome::DONE : EStrategyOutcome::IN_PROGRESS); + outcome.ErrorReason = std::move(errorReason); return outcome; } diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_base.h b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_base.h index 6f7a78c27a..ef7ae14e61 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_base.h +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_base.h @@ -66,8 +66,8 @@ public: } } - NKikimrProto::EReplyStatus PutWithResult(const TLogoBlobID& id, const TString& buffer, TEvBlobStorage::TEvPut::ETactic tactic - = TEvBlobStorage::TEvPut::TacticDefault) { + TAutoPtr<TEvBlobStorage::TEvPutResult> PutWithResult(const TLogoBlobID& id, const TString& buffer, + TEvBlobStorage::TEvPut::ETactic tactic = TEvBlobStorage::TEvPut::TacticDefault) { SendToBSProxy(GetActorContext(), Info->GroupID, new TEvBlobStorage::TEvPut(id, buffer, TInstant::Max(), NKikimrBlobStorage::TabletLog, tactic)); auto resp = WaitForSpecificEvent<TEvBlobStorage::TEvPutResult>(&TFaultToleranceTestBase::ProcessUnexpectedEvent); @@ -99,7 +99,7 @@ public: Y_FAIL(); } } - return resp->Get()->Status; + return resp->Release(); } NKikimrProto::EReplyStatus PutToVDisk(ui32 vdiskOrderNum, const TLogoBlobID& id, const TString& part) { @@ -144,7 +144,7 @@ public: void Put(const TLogoBlobID& id, const TString& buffer, NKikimrProto::EReplyStatus expectedStatus = NKikimrProto::OK, TEvBlobStorage::TEvPut::ETactic tactic = TEvBlobStorage::TEvPut::TacticDefault) { - UNIT_ASSERT_VALUES_EQUAL(PutWithResult(id, buffer, tactic), expectedStatus); + UNIT_ASSERT_VALUES_EQUAL(PutWithResult(id, buffer, tactic)->Status, expectedStatus); } void CheckBlob(const TLogoBlobID& id, bool mustRestoreFirst, NKikimrProto::EReplyStatus status, const TString& buffer) { diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_put.h b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_put.h index 72ac7de57f..8577d28e1f 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_put.h +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_put.h @@ -37,20 +37,23 @@ public: TLogoBlobID id; TString data; std::tie(id, data) = makeBlob(); - switch (const NKikimrProto::EReplyStatus status = PutWithResult(id, data, tactic)) { + TAutoPtr<TEvBlobStorage::TEvPutResult> result = PutWithResult(id, data, tactic); + switch (result->Status) { case NKikimrProto::OK: // whenever the PUT request finishes with success, the blob must be actually written and should // be restored in any case while fitting failure model + Y_ASSERT(fitsFailModel); dataMap[id] = data; break; case NKikimrProto::ERROR: // ERROR can only be generated if the failure model is exceeded Y_ASSERT(!fitsFailModel); + UNIT_ASSERT_VALUES_UNEQUAL("", result->ErrorReason); break; default: - Y_FAIL("unexpected status %s", NKikimrProto::EReplyStatus_Name(status).data()); + Y_FAIL("unexpected status %s", NKikimrProto::EReplyStatus_Name(result->Status).data()); } }; diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_range.h b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_range.h index 6a5b319c01..3216c718ec 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_range.h +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_range.h @@ -33,7 +33,7 @@ public: buffer += b; TLogoBlobID id(tabletId, generation, step, 0 /*channel*/, buffer.size(), 0); if (defaultExpectedStatus == NKikimrProto::OK) { - UNIT_ASSERT_VALUES_EQUAL(NKikimrProto::OK, PutWithResult(id, buffer, TEvBlobStorage::TEvPut::TacticMaxThroughput)); + UNIT_ASSERT_VALUES_EQUAL(NKikimrProto::OK, PutWithResult(id, buffer, TEvBlobStorage::TEvPut::TacticMaxThroughput)->Status); } else { PutWithResult(id, buffer, TEvBlobStorage::TEvPut::TacticMaxThroughput); } |