aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkruall <kruall@ydb.tech>2022-11-09 16:02:50 +0300
committerkruall <kruall@ydb.tech>2022-11-09 16:02:50 +0300
commitf8d4d3ee45485a990e2e3e5bdd13648e27e45a7a (patch)
tree493e21dc8a18ce92bb1e5eca40afbf94dd46f5be
parent6735fd34dc275e7c3a2183764ce285ba247df821 (diff)
downloadydb-f8d4d3ee45485a990e2e3e5bdd13648e27e45a7a.tar.gz
Fix behaviour when error occured in vpatch request,
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor.cpp30
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor_ut.cpp37
2 files changed, 42 insertions, 25 deletions
diff --git a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor.cpp b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor.cpp
index c7131d6dbc..fbcb4c7881 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor.cpp
+++ b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor.cpp
@@ -169,6 +169,9 @@ namespace NKikimr::NPrivate {
Become(&TThis::StartState);
TDuration liveDuration = Deadline - TActivationContext::Now();
+ if (!Deadline || liveDuration > CommonLiveTime) {
+ liveDuration = CommonLiveTime;
+ }
Schedule(liveDuration, new TKikimrEvents::TEvWakeup);
}
@@ -263,14 +266,16 @@ namespace NKikimr::NPrivate {
ErrorReason = TStringBuilder() << "Recieve not OK status from VGetResult,"
<< " received status# " << NKikimrProto::EReplyStatus_Name(record.GetStatus());
SendVPatchResult(NKikimrProto::ERROR);
- PassAway();
+ NotifySkeletonAboutDying();
+ Become(&TThis::ErrorState);
return;
}
if (record.ResultSize() != 1) {
ErrorReason = TStringBuilder() << "Recieve not correct result count from VGetResult,"
<< " expetced 1 but given " << record.ResultSize();
SendVPatchResult(NKikimrProto::ERROR);
- PassAway();
+ NotifySkeletonAboutDying();
+ Become(&TThis::ErrorState);
return;
}
@@ -281,7 +286,8 @@ namespace NKikimr::NPrivate {
<< " received status# " << NKikimrProto::EReplyStatus_Name(record.GetStatus())
<< " response status# " << NKikimrProto::EReplyStatus_Name(item.GetStatus());
SendVPatchResult(NKikimrProto::ERROR);
- PassAway();
+ NotifySkeletonAboutDying();
+ Become(&TThis::ErrorState);
return;
}
@@ -428,7 +434,6 @@ namespace NKikimr::NPrivate {
Sender = ev->Sender;
Cookie = ev->Cookie;
SendVPatchResult(NKikimrProto::ERROR);
- PassAway();
}
void Handle(TEvBlobStorage::TEvVPatchDiff::TPtr &ev) {
@@ -471,7 +476,7 @@ namespace NKikimr::NPrivate {
if (forceEnd) {
SendVPatchResult(NKikimrProto::OK);
- PassAway();
+ NotifySkeletonAndDie();
return;
}
@@ -487,7 +492,8 @@ namespace NKikimr::NPrivate {
if (!CheckDiff(Diffs, "Diff from DSProxy")) {
SendVPatchResult(NKikimrProto::ERROR);
- PassAway();
+ NotifySkeletonAboutDying();
+ Become(&TThis::ErrorState);
return;
}
@@ -516,7 +522,7 @@ namespace NKikimr::NPrivate {
ResultEvent->SetStatusFlagsAndFreeSpace(record.GetStatusFlags(), record.GetApproximateFreeSpaceShare());
SendVPatchResult(status);
- PassAway();
+ NotifySkeletonAndDie();
}
void HandleError(TEvBlobStorage::TEvVPatchXorDiff::TPtr &ev) {
@@ -556,10 +562,9 @@ namespace NKikimr::NPrivate {
if (ResultEvent) {
SendVPatchResult(NKikimrProto::ERROR);
- PassAway();
- } else {
- Become(&TThis::ErrorState);
+ NotifySkeletonAboutDying();
}
+ Become(&TThis::ErrorState);
return;
}
@@ -581,13 +586,12 @@ namespace NKikimr::NPrivate {
}
void NotifySkeletonAndDie() {
- Send(LeaderId, new TEvVPatchDyingRequest(PatchedBlobId));
+ NotifySkeletonAboutDying();
PassAway();
}
void NotifySkeletonAboutDying() {
Send(LeaderId, new TEvVPatchDyingRequest(PatchedBlobId));
- Schedule(CommonLiveTime, new TEvVPatchDyingConfirm);
}
void HandleInStartState(TKikimrEvents::TEvWakeup::TPtr &/*ev*/) {
@@ -653,7 +657,6 @@ namespace NKikimr::NPrivate {
hFunc(TEvBlobStorage::TEvVPutResult, Handle)
IgnoreFunc(TEvBlobStorage::TEvVPatchXorDiffResult)
hFunc(TKikimrEvents::TEvWakeup, HandleInDataStates)
- IgnoreFunc(TEvVPatchDyingConfirm)
default: Y_FAIL_S(VDiskLogPrefix << " unexpected event " << ToString(ev->GetTypeRewrite()));
}
}
@@ -664,7 +667,6 @@ namespace NKikimr::NPrivate {
hFunc(TEvBlobStorage::TEvVPutResult, Handle)
hFunc(TEvBlobStorage::TEvVPatchXorDiff, Handle)
hFunc(TKikimrEvents::TEvWakeup, HandleInParityStates)
- IgnoreFunc(TEvVPatchDyingConfirm)
default: Y_FAIL_S(VDiskLogPrefix << " unexpected event " << ToString(ev->GetTypeRewrite()));
}
}
diff --git a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor_ut.cpp b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor_ut.cpp
index 7e8e724475..4e3f904579 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor_ut.cpp
+++ b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vpatch_actor_ut.cpp
@@ -341,7 +341,8 @@ namespace NKikimr {
TVector<ui64> sendingEvents {
TEvBlobStorage::EvVGet,
TEvBlobStorage::EvVPatchFoundParts,
- TEvBlobStorage::EvVPatchResult};
+ TEvBlobStorage::EvVPatchResult,
+ TEvBlobStorage::EvVPatchDyingRequest};
MakeVPatchFindingPartsTest(NKikimrProto::OK, {1}, std::move(receivingEvents), std::move(sendingEvents));
}
@@ -353,7 +354,8 @@ namespace NKikimr {
TVector<ui64> sendingEvents {
TEvBlobStorage::EvVGet,
TEvBlobStorage::EvVPatchFoundParts,
- TEvBlobStorage::EvVPatchResult};
+ TEvBlobStorage::EvVPatchResult,
+ TEvBlobStorage::EvVPatchDyingRequest};
MakeVPatchFindingPartsTest(NKikimrProto::OK, {1, 2}, std::move(receivingEvents), std::move(sendingEvents));
}
@@ -482,6 +484,8 @@ namespace NKikimr {
if (isKilled) {
auto result = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvVPatchResult>(handle);
UNIT_ASSERT(result->Record.GetStatus() == NKikimrProto::ERROR);
+ handle = MakeHolder<IEventHandle>(vPatchActorId, edgeActor, new TEvVPatchDyingConfirm);
+ runtime.Send(handle.Release());
testData.WaitEndTest();
return;
}
@@ -511,7 +515,8 @@ namespace NKikimr {
TEvBlobStorage::EvVPatchFoundParts,
TEvBlobStorage::EvVGet,
TEvBlobStorage::EvVPut,
- TEvBlobStorage::EvVPatchResult};
+ TEvBlobStorage::EvVPatchResult,
+ TEvBlobStorage::EvVPatchDyingRequest};
TVector<ui8> foundPartIds = {1};
MakeVPatchTest(NKikimrProto::OK, NKikimrProto::OK, 100, {1}, 1, 0,
@@ -523,12 +528,14 @@ namespace NKikimr {
TEvents::TSystem::Bootstrap,
TEvBlobStorage::EvVGetResult,
TEvBlobStorage::EvVPatchDiff,
- TEvBlobStorage::EvVGetResult};
+ TEvBlobStorage::EvVGetResult,
+ TEvBlobStorage::EvVPatchDyingConfirm};
TVector<ui64> sendingEvents {
TEvBlobStorage::EvVGet,
TEvBlobStorage::EvVPatchFoundParts,
TEvBlobStorage::EvVGet,
- TEvBlobStorage::EvVPatchResult};
+ TEvBlobStorage::EvVPatchResult,
+ TEvBlobStorage::EvVPatchDyingRequest};
TVector<ui8> foundPartIds = {1};
MakeVPatchTest(NKikimrProto::ERROR, NKikimrProto::OK, 100, {1}, 1, 0,
@@ -547,7 +554,8 @@ namespace NKikimr {
TEvBlobStorage::EvVPatchFoundParts,
TEvBlobStorage::EvVGet,
TEvBlobStorage::EvVPut,
- TEvBlobStorage::EvVPatchResult};
+ TEvBlobStorage::EvVPatchResult,
+ TEvBlobStorage::EvVPatchDyingRequest};
TVector<ui8> foundPartIds = {1};
MakeVPatchTest(NKikimrProto::OK, NKikimrProto::ERROR, 100, {1}, 1, 0,
@@ -610,6 +618,8 @@ namespace NKikimr {
TAutoPtr<IEventHandle> handle;
testData.Runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvVPatchXorDiffResult>(handle);
ReceiveVPatchResult(testData, status);
+ handle = MakeHolder<IEventHandle>(vPatchActorId, edgeActor, new TEvVPatchDyingConfirm);
+ runtime.Send(handle.Release());
testData.WaitEndTest();
} else {
testData.ForceEndTest();
@@ -631,7 +641,8 @@ namespace NKikimr {
TEvBlobStorage::EvVGet,
TEvBlobStorage::EvVPut,
TEvBlobStorage::EvVPatchResult,
- TEvBlobStorage::EvVPatchResult};
+ TEvBlobStorage::EvVPatchResult,
+ TEvBlobStorage::EvVPatchDyingRequest};
TVector<TDiff> diffs;
diffs.emplace_back("", 0, true, false);
@@ -644,12 +655,14 @@ namespace NKikimr {
TEvents::TSystem::Bootstrap,
TEvBlobStorage::EvVGetResult,
TEvBlobStorage::EvVPatchXorDiff,
- TEvBlobStorage::EvVPatchDiff,};
+ TEvBlobStorage::EvVPatchDiff,
+ TEvBlobStorage::EvVPatchDyingConfirm};
TVector<ui64> sendingEvents {
TEvBlobStorage::EvVGet,
TEvBlobStorage::EvVPatchFoundParts,
TEvBlobStorage::EvVPatchXorDiffResult,
- TEvBlobStorage::EvVPatchResult};
+ TEvBlobStorage::EvVPatchResult,
+ TEvBlobStorage::EvVPatchDyingRequest};
TVector<TDiff> diffs;
diffs.emplace_back("", 100, true, false);
@@ -662,12 +675,14 @@ namespace NKikimr {
TEvents::TSystem::Bootstrap,
TEvBlobStorage::EvVGetResult,
TEvBlobStorage::EvVPatchXorDiff,
- TEvBlobStorage::EvVPatchDiff,};
+ TEvBlobStorage::EvVPatchDiff,
+ TEvBlobStorage::EvVPatchDyingConfirm};
TVector<ui64> sendingEvents {
TEvBlobStorage::EvVGet,
TEvBlobStorage::EvVPatchFoundParts,
TEvBlobStorage::EvVPatchXorDiffResult,
- TEvBlobStorage::EvVPatchResult};
+ TEvBlobStorage::EvVPatchResult,
+ TEvBlobStorage::EvVPatchDyingRequest};
TVector<TDiff> diffs;
diffs.emplace_back("aa", 3, true, false);