Skip to content

Commit b7a5a76

Browse files
authored
YQ kqprun, fixed storage setup with domains (#16795)
1 parent d3b5643 commit b7a5a76

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

ydb/core/testlib/test_client.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,11 +927,39 @@ namespace Tests {
927927
host.SetHostConfigId(hostConfig.GetHostConfigId());
928928
bsConfigureRequest->Record.MutableRequest()->AddCommand()->MutableDefineBox()->CopyFrom(boxConfig);
929929

930+
std::unordered_map<TString, ui64> poolsConfigGenerations;
931+
if (Settings->FetchPoolsGeneration) {
932+
auto bsDescribeRequest = MakeHolder<TEvBlobStorage::TEvControllerConfigRequest>();
933+
auto& describeCommand = *bsDescribeRequest->Record.MutableRequest()->AddCommand()->MutableReadStoragePool();
934+
describeCommand.SetBoxId(Settings->BOX_ID);
935+
for (const auto& [_, storagePool] : Settings->StoragePoolTypes) {
936+
describeCommand.AddName(storagePool.GetName());
937+
}
938+
939+
Runtime->SendToPipe(MakeBSControllerID(), sender, bsDescribeRequest.Release(), 0, pipeConfig);
940+
TAutoPtr<IEventHandle> handleDescResponse;
941+
const auto descResponse = Runtime->GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(handleDescResponse);
942+
943+
const auto& response = descResponse->Record.GetResponse();
944+
if (!response.GetSuccess()) {
945+
Cerr << "\n\n descResponse is #" << descResponse->Record.DebugString() << "\n\n";
946+
}
947+
UNIT_ASSERT(descResponse->Record.GetResponse().GetSuccess());
948+
UNIT_ASSERT_VALUES_EQUAL(response.StatusSize(), 1);
949+
const auto& status = response.GetStatus(0);
950+
951+
poolsConfigGenerations.reserve(status.StoragePoolSize());
952+
for (const auto& storagePool : status.GetStoragePool()) {
953+
UNIT_ASSERT(poolsConfigGenerations.emplace(storagePool.GetName(), storagePool.GetItemConfigGeneration()).second);
954+
}
955+
}
956+
930957
for (const auto& [poolKind, storagePool] : Settings->StoragePoolTypes) {
931958
if (storagePool.GetNumGroups() > 0) {
932959
auto* command = bsConfigureRequest->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool();
933960
command->CopyFrom(storagePool);
934-
command->SetItemConfigGeneration(Settings->StorageGeneration);
961+
const auto poolGenerationIt = poolsConfigGenerations.find(storagePool.GetName());
962+
command->SetItemConfigGeneration(poolGenerationIt == poolsConfigGenerations.end() ? Settings->StorageGeneration : poolGenerationIt->second);
935963
}
936964
}
937965

ydb/core/testlib/test_client.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ namespace Tests {
128128
ui32 NodeCount = 1;
129129
ui32 DynamicNodeCount = 0;
130130
ui64 StorageGeneration = 0;
131+
bool FetchPoolsGeneration = false;
131132
NFake::TStorage CustomDiskParams;
132133
TControls Controls;
133134
TAppPrepare::TFnReg FrFactory = &DefaultFrFactory;
@@ -189,7 +190,7 @@ namespace Tests {
189190
TServerSettings& SetDomainName(const TString& value);
190191
TServerSettings& SetNodeCount(ui32 value) { NodeCount = value; return *this; }
191192
TServerSettings& SetDynamicNodeCount(ui32 value) { DynamicNodeCount = value; return *this; }
192-
TServerSettings& SetStorageGeneration(ui64 value) { StorageGeneration = value; return *this; }
193+
TServerSettings& SetStorageGeneration(ui64 storageGeneration, bool fetchPoolsGeneration = false) { StorageGeneration = storageGeneration; FetchPoolsGeneration = fetchPoolsGeneration; return *this; }
193194
TServerSettings& SetCustomDiskParams(const NFake::TStorage& value) { CustomDiskParams = value; return *this; }
194195
TServerSettings& SetControls(const TControls& value) { Controls = value; return *this; }
195196
TServerSettings& SetFrFactory(const TAppPrepare::TFnReg& value) { FrFactory = value; return *this; }

ydb/tests/tools/kqprun/src/ydb_setup.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ class TYdbSetup::TImpl {
249249

250250
serverSettings.SetEnableMockOnSingleNode(!Settings_.DisableDiskMock && !Settings_.PDisksPath);
251251
serverSettings.SetCustomDiskParams(storage);
252-
serverSettings.SetStorageGeneration(StorageMeta_.GetStorageGeneration());
252+
253+
const auto storageGeneration = StorageMeta_.GetStorageGeneration();
254+
serverSettings.SetStorageGeneration(storageGeneration, storageGeneration > 0);
253255
}
254256

255257
NKikimr::Tests::TServerSettings GetServerSettings(ui32 grpcPort) {

0 commit comments

Comments
 (0)