diff options
author | kruall <[email protected]> | 2023-09-12 16:18:15 +0300 |
---|---|---|
committer | kruall <[email protected]> | 2023-09-12 16:37:31 +0300 |
commit | b41ef20dea019cfba4300ab3a0e5a7bb411459ee (patch) | |
tree | f897fd4dabb2f5e78fdc02c3bb88b5f0e5584756 | |
parent | fdfb93a765c82cb5facd94fa319464cc3dfc0c54 (diff) |
Fix dsproxy mock, KIKIMR-19329
-rw-r--r-- | ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp | 10 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h | 2 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/mock/model.h | 16 | ||||
-rw-r--r-- | ydb/core/blobstorage/nodewarden/node_warden_proxy.cpp | 2 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/ut_bscontroller/main.cpp | 2 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/ut_selfheal/env.h | 2 |
6 files changed, 23 insertions, 11 deletions
diff --git a/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp b/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp index 4917dad2724..8eb1436b730 100644 --- a/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp +++ b/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp @@ -93,6 +93,12 @@ namespace NKikimr { : TActor(&TBlobStorageGroupProxyMockActor::StateFunc) , Model(model ? std::move(model) : MakeIntrusive<NFake::TProxyDS>()) {} + + + TBlobStorageGroupProxyMockActor(ui32 groupId) + : TActor(&TBlobStorageGroupProxyMockActor::StateFunc) + , Model(MakeIntrusive<NFake::TProxyDS>(groupId)) + {} }; } // anon @@ -100,8 +106,8 @@ namespace NKikimr { return new TBlobStorageGroupProxyMockActor(std::move(model)); } - IActor *CreateBlobStorageGroupProxyMockActor() { - return new TBlobStorageGroupProxyMockActor(nullptr); + IActor *CreateBlobStorageGroupProxyMockActor(ui32 groupId) { + return new TBlobStorageGroupProxyMockActor(groupId); } } // NKikimr diff --git a/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h b/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h index 59daaba5dce..5cb37a57112 100644 --- a/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h +++ b/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h @@ -9,6 +9,6 @@ namespace NKikimr { } // NFake IActor *CreateBlobStorageGroupProxyMockActor(TIntrusivePtr<NFake::TProxyDS> model); - IActor *CreateBlobStorageGroupProxyMockActor(); + IActor *CreateBlobStorageGroupProxyMockActor(ui32 groupId); } // NKikimr diff --git a/ydb/core/blobstorage/dsproxy/mock/model.h b/ydb/core/blobstorage/dsproxy/mock/model.h index 608b95bfafd..cbd9d24784d 100644 --- a/ydb/core/blobstorage/dsproxy/mock/model.h +++ b/ydb/core/blobstorage/dsproxy/mock/model.h @@ -55,6 +55,12 @@ namespace NFake { TMap<TLogoBlobID, TBlob> Blobs; // By default only NKikimrBlobStorage::StatusIsValid is set TStorageStatusFlags StorageStatusFlags = TStorageStatusFlags(NKikimrBlobStorage::StatusIsValid); + const ui32 GroupId; + + public: + TProxyDS(ui32 groupId = 0) + : GroupId(groupId) + {} public: // BS events interface : Handle(event) -> event TEvBlobStorage::TEvPutResult* Handle(TEvBlobStorage::TEvPut *msg) { @@ -64,11 +70,11 @@ namespace NFake { // validate put against set blocks if (IsBlocked(id.TabletID(), id.Generation())) { - return new TEvBlobStorage::TEvPutResult(NKikimrProto::BLOCKED, id, GetStorageStatusFlags(), 0, 0.f); + return new TEvBlobStorage::TEvPutResult(NKikimrProto::BLOCKED, id, GetStorageStatusFlags(), GroupId, 0.f); } for (const auto& [tabletId, generation] : msg->ExtraBlockChecks) { if (IsBlocked(tabletId, generation)) { - return new TEvBlobStorage::TEvPutResult(NKikimrProto::BLOCKED, id, GetStorageStatusFlags(), 0, 0.f); + return new TEvBlobStorage::TEvPutResult(NKikimrProto::BLOCKED, id, GetStorageStatusFlags(), GroupId, 0.f); } } @@ -95,12 +101,12 @@ namespace NFake { // put an entry into logo blobs database and reply with success Blobs.emplace(id, std::move(msg->Buffer)); - return new TEvBlobStorage::TEvPutResult(NKikimrProto::OK, id, GetStorageStatusFlags(), 0, 0.f); + return new TEvBlobStorage::TEvPutResult(NKikimrProto::OK, id, GetStorageStatusFlags(), GroupId, 0.f); } TEvBlobStorage::TEvGetResult* Handle(TEvBlobStorage::TEvGet *msg) { // prepare result structure holding the returned data - auto result = std::make_unique<TEvBlobStorage::TEvGetResult>(NKikimrProto::OK, msg->QuerySize, 0u); + auto result = std::make_unique<TEvBlobStorage::TEvGetResult>(NKikimrProto::OK, msg->QuerySize, GroupId); // traverse against requested blobs and process them for (ui32 i = 0; i < msg->QuerySize; ++i) { @@ -202,7 +208,7 @@ namespace NFake { Y_VERIFY(from.Channel() == to.Channel()); Y_VERIFY(from.TabletID() == msg->TabletId); - auto result = std::make_unique<TEvBlobStorage::TEvRangeResult>(NKikimrProto::OK, from, to, 0u); + auto result = std::make_unique<TEvBlobStorage::TEvRangeResult>(NKikimrProto::OK, from, to, GroupId); auto process = [&](const TLogoBlobID& id, const TString& buffer) { result->Responses.emplace_back(id, buffer); diff --git a/ydb/core/blobstorage/nodewarden/node_warden_proxy.cpp b/ydb/core/blobstorage/nodewarden/node_warden_proxy.cpp index 9dea1ff94cf..bbdc298a3d6 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_proxy.cpp +++ b/ydb/core/blobstorage/nodewarden/node_warden_proxy.cpp @@ -22,7 +22,7 @@ void TNodeWarden::StartLocalProxy(ui32 groupId) { if (EnableProxyMock) { // create mock proxy - proxy.reset(CreateBlobStorageGroupProxyMockActor()); + proxy.reset(CreateBlobStorageGroupProxyMockActor(groupId)); } else if (auto info = NeedGroupInfo(groupId)) { if (info->BlobDepotId) { TActorId proxyActorId; diff --git a/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp b/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp index cee71cfa675..27417b3ef41 100644 --- a/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp +++ b/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp @@ -225,7 +225,7 @@ struct TEnvironmentSetup { void SetupStorage() { const TActorId proxyId = MakeBlobStorageProxyID(GroupId); - Runtime->RegisterService(proxyId, Runtime->Register(CreateBlobStorageGroupProxyMockActor(), NodeId), NodeId); + Runtime->RegisterService(proxyId, Runtime->Register(CreateBlobStorageGroupProxyMockActor(GroupId), NodeId), NodeId); } void SetupTablet() { diff --git a/ydb/core/mind/bscontroller/ut_selfheal/env.h b/ydb/core/mind/bscontroller/ut_selfheal/env.h index e7e5f0e7400..8c668469e3e 100644 --- a/ydb/core/mind/bscontroller/ut_selfheal/env.h +++ b/ydb/core/mind/bscontroller/ut_selfheal/env.h @@ -176,7 +176,7 @@ struct TEnvironmentSetup { void SetupStorage() { const TActorId proxyId = MakeBlobStorageProxyID(GroupId); - Runtime->RegisterService(proxyId, Runtime->Register(CreateBlobStorageGroupProxyMockActor(), NodeId)); + Runtime->RegisterService(proxyId, Runtime->Register(CreateBlobStorageGroupProxyMockActor(GroupId), NodeId)); for (ui32 nodeId : Runtime->GetNodes()) { const TActorId wardenId = Runtime->Register(new TNodeWardenMock(nodeId, TabletId), nodeId); |