aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPisarenko Grigoriy <grigoriypisar@ydb.tech>2025-04-04 22:32:52 +0500
committerGitHub <noreply@github.com>2025-04-04 20:32:52 +0300
commitb7a5a766c07b0ed33c2a92b82edd17fca5bed01c (patch)
treec7189b23f226020c7d14541a1b7277b951c86200
parentd3b5643642fd0fe6c1f1930a83c215502f6a76b5 (diff)
downloadydb-b7a5a766c07b0ed33c2a92b82edd17fca5bed01c.tar.gz
YQ kqprun, fixed storage setup with domains (#16795)
-rw-r--r--ydb/core/testlib/test_client.cpp30
-rw-r--r--ydb/core/testlib/test_client.h3
-rw-r--r--ydb/tests/tools/kqprun/src/ydb_setup.cpp4
3 files changed, 34 insertions, 3 deletions
diff --git a/ydb/core/testlib/test_client.cpp b/ydb/core/testlib/test_client.cpp
index e5b302db88..0189659853 100644
--- a/ydb/core/testlib/test_client.cpp
+++ b/ydb/core/testlib/test_client.cpp
@@ -927,11 +927,39 @@ namespace Tests {
host.SetHostConfigId(hostConfig.GetHostConfigId());
bsConfigureRequest->Record.MutableRequest()->AddCommand()->MutableDefineBox()->CopyFrom(boxConfig);
+ std::unordered_map<TString, ui64> poolsConfigGenerations;
+ if (Settings->FetchPoolsGeneration) {
+ auto bsDescribeRequest = MakeHolder<TEvBlobStorage::TEvControllerConfigRequest>();
+ auto& describeCommand = *bsDescribeRequest->Record.MutableRequest()->AddCommand()->MutableReadStoragePool();
+ describeCommand.SetBoxId(Settings->BOX_ID);
+ for (const auto& [_, storagePool] : Settings->StoragePoolTypes) {
+ describeCommand.AddName(storagePool.GetName());
+ }
+
+ Runtime->SendToPipe(MakeBSControllerID(), sender, bsDescribeRequest.Release(), 0, pipeConfig);
+ TAutoPtr<IEventHandle> handleDescResponse;
+ const auto descResponse = Runtime->GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(handleDescResponse);
+
+ const auto& response = descResponse->Record.GetResponse();
+ if (!response.GetSuccess()) {
+ Cerr << "\n\n descResponse is #" << descResponse->Record.DebugString() << "\n\n";
+ }
+ UNIT_ASSERT(descResponse->Record.GetResponse().GetSuccess());
+ UNIT_ASSERT_VALUES_EQUAL(response.StatusSize(), 1);
+ const auto& status = response.GetStatus(0);
+
+ poolsConfigGenerations.reserve(status.StoragePoolSize());
+ for (const auto& storagePool : status.GetStoragePool()) {
+ UNIT_ASSERT(poolsConfigGenerations.emplace(storagePool.GetName(), storagePool.GetItemConfigGeneration()).second);
+ }
+ }
+
for (const auto& [poolKind, storagePool] : Settings->StoragePoolTypes) {
if (storagePool.GetNumGroups() > 0) {
auto* command = bsConfigureRequest->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool();
command->CopyFrom(storagePool);
- command->SetItemConfigGeneration(Settings->StorageGeneration);
+ const auto poolGenerationIt = poolsConfigGenerations.find(storagePool.GetName());
+ command->SetItemConfigGeneration(poolGenerationIt == poolsConfigGenerations.end() ? Settings->StorageGeneration : poolGenerationIt->second);
}
}
diff --git a/ydb/core/testlib/test_client.h b/ydb/core/testlib/test_client.h
index c9559afd8d..1c4b013901 100644
--- a/ydb/core/testlib/test_client.h
+++ b/ydb/core/testlib/test_client.h
@@ -128,6 +128,7 @@ namespace Tests {
ui32 NodeCount = 1;
ui32 DynamicNodeCount = 0;
ui64 StorageGeneration = 0;
+ bool FetchPoolsGeneration = false;
NFake::TStorage CustomDiskParams;
TControls Controls;
TAppPrepare::TFnReg FrFactory = &DefaultFrFactory;
@@ -189,7 +190,7 @@ namespace Tests {
TServerSettings& SetDomainName(const TString& value);
TServerSettings& SetNodeCount(ui32 value) { NodeCount = value; return *this; }
TServerSettings& SetDynamicNodeCount(ui32 value) { DynamicNodeCount = value; return *this; }
- TServerSettings& SetStorageGeneration(ui64 value) { StorageGeneration = value; return *this; }
+ TServerSettings& SetStorageGeneration(ui64 storageGeneration, bool fetchPoolsGeneration = false) { StorageGeneration = storageGeneration; FetchPoolsGeneration = fetchPoolsGeneration; return *this; }
TServerSettings& SetCustomDiskParams(const NFake::TStorage& value) { CustomDiskParams = value; return *this; }
TServerSettings& SetControls(const TControls& value) { Controls = value; return *this; }
TServerSettings& SetFrFactory(const TAppPrepare::TFnReg& value) { FrFactory = value; return *this; }
diff --git a/ydb/tests/tools/kqprun/src/ydb_setup.cpp b/ydb/tests/tools/kqprun/src/ydb_setup.cpp
index ea7cbadaac..2d6e3aad58 100644
--- a/ydb/tests/tools/kqprun/src/ydb_setup.cpp
+++ b/ydb/tests/tools/kqprun/src/ydb_setup.cpp
@@ -249,7 +249,9 @@ private:
serverSettings.SetEnableMockOnSingleNode(!Settings_.DisableDiskMock && !Settings_.PDisksPath);
serverSettings.SetCustomDiskParams(storage);
- serverSettings.SetStorageGeneration(StorageMeta_.GetStorageGeneration());
+
+ const auto storageGeneration = StorageMeta_.GetStorageGeneration();
+ serverSettings.SetStorageGeneration(storageGeneration, storageGeneration > 0);
}
NKikimr::Tests::TServerSettings GetServerSettings(ui32 grpcPort) {