Skip to content

Commit

Permalink
issue-2542:correct message name and correct stop req handler
Browse files Browse the repository at this point in the history
  • Loading branch information
vladstepanyuk committed Jan 20, 2025
1 parent ce08484 commit 11b0ec6
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 24 deletions.
6 changes: 3 additions & 3 deletions cloud/blockstore/libs/storage/api/volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace NCloud::NBlockStore::NStorage {
xxx(UpdateVolumeParams, __VA_ARGS__) \
xxx(ChangeStorageConfig, __VA_ARGS__) \
xxx(GetStorageConfig, __VA_ARGS__) \
xxx(StopPartionBeforeVolumeDestruction, __VA_ARGS__) \
xxx(StopPartitionBeforeVolumeDestruction, __VA_ARGS__) \

// BLOCKSTORE_VOLUME_REQUESTS

Expand Down Expand Up @@ -332,8 +332,8 @@ struct TEvVolume
EvGetStorageConfigRequest = EvBegin + 58,
EvGetStorageConfigResponse = EvBegin + 59,

EvStopPartionBeforeVolumeDestructionRequest = EvBegin + 60,
EvStopPartionBeforeVolumeDestructionResponse = EvBegin + 61,
EvStopPartitionBeforeVolumeDestructionRequest = EvBegin + 60,
EvStopPartitionBeforeVolumeDestructionResponse = EvBegin + 61,

EvEnd
};
Expand Down
6 changes: 3 additions & 3 deletions cloud/blockstore/libs/storage/protos/volume.proto
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,9 @@ message TGetStorageConfigResponse
}

////////////////////////////////////////////////////////////////////////////////
// StopPartionBeforeVolumeDestruction request/response.
// StopPartitionBeforeVolumeDestruction request/response.

message TStopPartionBeforeVolumeDestructionRequest
message TStopPartitionBeforeVolumeDestructionRequest
{
// Optional request headers.
THeaders Headers = 1;
Expand All @@ -666,7 +666,7 @@ message TStopPartionBeforeVolumeDestructionRequest
string DiskId = 2;
}

message TStopPartionBeforeVolumeDestructionResponse
message TStopPartitionBeforeVolumeDestructionResponse
{
// Optional error, set only if error happened.
NCloud.NProto.TError Error = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class TDestroyVolumeActor final
const TActorContext& ctx);

void HandleStopPartitions(
const TEvVolume::TEvStopPartionBeforeVolumeDestructionResponse::TPtr&
const TEvVolume::TEvStopPartitionBeforeVolumeDestructionResponse::TPtr&
ev,
const TActorContext& ctx);

Expand Down Expand Up @@ -189,7 +189,7 @@ void TDestroyVolumeActor::DeallocateDisk(const TActorContext& ctx)
void TDestroyVolumeActor::StopPartitions(const TActorContext& ctx)
{
auto stopPartReq = std::make_unique<
TEvVolume::TEvStopPartionBeforeVolumeDestructionRequest>();
TEvVolume::TEvStopPartitionBeforeVolumeDestructionRequest>();
stopPartReq->Record.SetDiskId(DiskId);
NCloud::Send(ctx, MakeVolumeProxyServiceId(), std::move(stopPartReq));
}
Expand Down Expand Up @@ -398,7 +398,7 @@ void TDestroyVolumeActor::HandleStatVolumeResponse(
}

void TDestroyVolumeActor::HandleStopPartitions(
const TEvVolume::TEvStopPartionBeforeVolumeDestructionResponse::TPtr& ev,
const TEvVolume::TEvStopPartitionBeforeVolumeDestructionResponse::TPtr& ev,
const TActorContext& ctx)
{
Y_UNUSED(ev);
Expand Down Expand Up @@ -435,7 +435,7 @@ STFUNC(TDestroyVolumeActor::StateWork)
HandleStatVolumeResponse);

HFunc(
TEvVolume::TEvStopPartionBeforeVolumeDestructionResponse,
TEvVolume::TEvStopPartitionBeforeVolumeDestructionResponse,
HandleStopPartitions);

default:
Expand Down
6 changes: 3 additions & 3 deletions cloud/blockstore/libs/storage/volume/testlib/test_env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,10 @@ TVolumeClient::CreateReadMetaHistoryRequest()
return std::make_unique<TEvVolumePrivate::TEvReadMetaHistoryRequest>();
}

std::unique_ptr<TEvVolume::TEvStopPartionBeforeVolumeDestructionRequest>
TVolumeClient::CreateStopPartionBeforeVolumeDestructionRequest() {
std::unique_ptr<TEvVolume::TEvStopPartitionBeforeVolumeDestructionRequest>
TVolumeClient::CreateStopPartitionBeforeVolumeDestructionRequest() {
return std::make_unique<
TEvVolume::TEvStopPartionBeforeVolumeDestructionRequest>();
TEvVolume::TEvStopPartitionBeforeVolumeDestructionRequest>();
}

void TVolumeClient::SendRemoteHttpInfo(
Expand Down
4 changes: 2 additions & 2 deletions cloud/blockstore/libs/storage/volume/testlib/test_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ class TVolumeClient
std::unique_ptr<TEvVolumePrivate::TEvReadMetaHistoryRequest>
CreateReadMetaHistoryRequest();

std::unique_ptr<TEvVolume::TEvStopPartionBeforeVolumeDestructionRequest>
CreateStopPartionBeforeVolumeDestructionRequest();
std::unique_ptr<TEvVolume::TEvStopPartitionBeforeVolumeDestructionRequest>
CreateStopPartitionBeforeVolumeDestructionRequest();

void SendRemoteHttpInfo(
const TString& params,
Expand Down
18 changes: 11 additions & 7 deletions cloud/blockstore/libs/storage/volume/volume_actor_startstop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,23 +341,24 @@ void TVolumeActor::StartPartitionsForGc(const TActorContext& ctx)
PartitionsStartedReason = EPartitionsStartedReason::STARTED_FOR_GC;
}

void TVolumeActor::HandleStopPartionBeforeVolumeDestruction(
const TEvVolume::TEvStopPartionBeforeVolumeDestructionRequest::TPtr& ev,
void TVolumeActor::HandleStopPartitionBeforeVolumeDestruction(
const TEvVolume::TEvStopPartitionBeforeVolumeDestructionRequest::TPtr& ev,
const TActorContext& ctx)
{
if (!State->GetDiskRegistryBasedPartitionActor()) {
LOG_ERROR(
ctx,
TBlockStoreComponents::VOLUME,
"[%lu] StopPartionBeforeVolumeDestruction request was send to not "
"[%lu] StopPartitionBeforeVolumeDestruction request was send to "
"not "
"DR based disk",
TabletID());

NCloud::Reply(
ctx,
*ev,
std::make_unique<
TEvVolume::TEvStopPartionBeforeVolumeDestructionResponse>(
TEvVolume::TEvStopPartitionBeforeVolumeDestructionResponse>(
MakeError(E_NOT_IMPLEMENTED, "request not supported")));
return;
}
Expand All @@ -368,8 +369,6 @@ void TVolumeActor::HandleStopPartionBeforeVolumeDestruction(
"[%lu] Stop Partition before volume destruction",
TabletID());

CancelRequests(ctx);

auto reqInfo =
CreateRequestInfo(ev->Sender, ev->Cookie, ev->Get()->CallContext);
StopPartitions(
Expand All @@ -381,8 +380,13 @@ void TVolumeActor::HandleStopPartionBeforeVolumeDestruction(
*reqInfo,
std::make_unique<
TEvVolume::
TEvStopPartionBeforeVolumeDestructionResponse>());
TEvStopPartitionBeforeVolumeDestructionResponse>());
});

TerminateTransactions(ctx);
KillActors(ctx);
CancelRequests(ctx);

BecomeAux(ctx, STATE_ZOMBIE);
}

Expand Down
4 changes: 2 additions & 2 deletions cloud/blockstore/libs/storage/volume/volume_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8157,10 +8157,10 @@ Y_UNIT_TEST_SUITE(TVolumeTest)
false);


volume.StopPartionBeforeVolumeDestruction();
volume.StopPartitionBeforeVolumeDestruction();
UNIT_ASSERT(partitionsStopped);

// Check that volume after TEvStopPartionBeforeVolumeDestructionRequest
// Check that volume after TEvStopPartitionBeforeVolumeDestructionRequest
// in zombie state and rejects requsts.
volume.SendGetVolumeInfoRequest();
auto response = volume.RecvGetVolumeInfoResponse();
Expand Down

0 comments on commit 11b0ec6

Please sign in to comment.