Skip to content

Commit

Permalink
issue-2725: correct issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vladstepanyuk committed Jan 24, 2025
1 parent 46d4ae3 commit 5399a89
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "disk_registry_actor.h"
#include "cloud/blockstore/libs/storage/core/proto_helpers.h"
#include <cloud/blockstore/libs/storage/core/proto_helpers.h>

#include <cloud/blockstore/libs/storage/api/disk_agent.h>

Expand Down
3 changes: 1 addition & 2 deletions cloud/blockstore/libs/storage/testlib/disk_agent_mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ class TDiskAgentMock final
private:
STFUNC(StateWork)
{
auto typeRewrite = ev->GetTypeRewrite();
switch (typeRewrite) {
switch (ev->GetTypeRewrite()) {
HFunc(NActors::TEvents::TEvPoisonPill, HandlePoisonPill);

HFunc(TEvDiskAgent::TEvReadDeviceBlocksRequest, HandleReadDeviceBlocks);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "volume_actor.h"

#include "cloud/blockstore/libs/storage/core/proto_helpers.h"
#include <cloud/blockstore/libs/storage/core/proto_helpers.h>

#include <cloud/blockstore/libs/kikimr/events.h>
#include <cloud/blockstore/libs/storage/api/disk_agent.h>
Expand All @@ -16,6 +16,8 @@ using namespace NKikimr::NTabletFlatExecutor;

namespace {

////////////////////////////////////////////////////////////////////////////////

class TAcquireDevicesActor final
: public TActorBootstrapped<TAcquireDevicesActor>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ void TVolumeActor::HandleAcquireDiskResponse(
}

void TVolumeActor::HandleDevicesAcquireFinishedImpl(
const NProto::TError& error,
const NActors::TActorContext& ctx)
const NProto::TError& error,
const NActors::TActorContext& ctx)
{
ScheduleAcquireDiskIfNeeded(ctx);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "volume_actor.h"
#include "cloud/blockstore/libs/storage/core/proto_helpers.h"
#include <cloud/blockstore/libs/storage/core/proto_helpers.h>

#include <cloud/blockstore/libs/kikimr/events.h>
#include <cloud/blockstore/libs/storage/api/disk_agent.h>
Expand Down
11 changes: 3 additions & 8 deletions cloud/blockstore/libs/storage/volume/volume_events_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,16 +413,11 @@ struct TEvVolumePrivate
EvExternalDrainDone
>;

using TEvDevicesAcquireFinished = TRequestEvent<
TDevicesAcquireFinished,
EvDevicesAcquireFinished
>;
using TEvDevicesAcquireFinished =
TResponseEvent<TDevicesAcquireFinished, EvDevicesAcquireFinished>;

using TEvDevicesReleaseFinished =
TRequestEvent<
TDevicesReleaseFinished,
EvDevicesReleaseFinished
>;
TResponseEvent<TDevicesReleaseFinished, EvDevicesReleaseFinished>;
};

} // namespace NCloud::NBlockStore::NStorage
9 changes: 3 additions & 6 deletions cloud/blockstore/libs/storage/volume/volume_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,12 +726,9 @@ class TVolumeState

TVector<NProto::TDeviceConfig> GetAllDevicesForAcquireRelease()
{

size_t allDevicesCount = Meta.GetDevices().size();
for (const auto& replica: Meta.GetReplicas()) {
allDevicesCount += replica.GetDevices().size();
}
allDevicesCount += GetMeta().GetMigrations().size();
const size_t allDevicesCount =
((Meta.ReplicasSize() + 1) * Meta.DevicesSize()) +
GetMeta().MigrationsSize();

TVector<NProto::TDeviceConfig> resultDevices;
resultDevices.reserve(allDevicesCount);
Expand Down
15 changes: 6 additions & 9 deletions cloud/blockstore/libs/storage/volume/volume_state_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1956,9 +1956,9 @@ Y_UNIT_TEST_SUITE(TVolumeStateTest)
r2.AddDevices()->SetDeviceUUID("d5");
r2.AddDevices()->SetDeviceUUID("d6");

auto deviceMigration = NProto::TDeviceMigration();
NProto::TDeviceMigration deviceMigration;
deviceMigration.SetSourceDeviceId("d1");
*deviceMigration.MutableTargetDevice()->MutableDeviceUUID() = "d7";
deviceMigration.MutableTargetDevice()->SetDeviceUUID("d7");

meta.MutableMigrations()->Add(std::move(deviceMigration));
volumeState.ResetMeta(meta);
Expand All @@ -1967,13 +1967,10 @@ Y_UNIT_TEST_SUITE(TVolumeStateTest)
deviceUUIDSExpected{"d1", "d2", "d3", "d4", "d5", "d6", "d7"};

auto devices = volumeState.GetAllDevicesForAcquireRelease();
auto devicesUUIDS =
devices | std::views::transform([](const auto& el)
{ return el.GetDeviceUUID(); });

THashSet<TString> devicesUUIDSActual(
devicesUUIDS.begin(),
devicesUUIDS.end());
THashSet<TString> devicesUUIDSActual;
for (const auto& d: volumeState.GetAllDevicesForAcquireRelease()) {
devicesUUIDSActual.insert(d.GetDeviceUUID());
}

UNIT_ASSERT_EQUAL(deviceUUIDSExpected, devicesUUIDSActual);
}
Expand Down
1 change: 1 addition & 0 deletions cloud/blockstore/libs/storage/volume/volume_ut_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ using namespace NTestVolume;

using namespace NTestVolumeHelpers;

////////////////////////////////////////////////////////////////////////////////

Y_UNIT_TEST_SUITE(TVolumeTest)
{
Expand Down

0 comments on commit 5399a89

Please sign in to comment.