From 38a1855cd8f7713fd57b98406aa7b3c323b5de8b Mon Sep 17 00:00:00 2001 From: Pavel Date: Mon, 20 Oct 2025 17:37:51 +0000 Subject: [PATCH 1/5] fix: add cpu:4 to ram:32 req (#27009) --- .github/last_commit.txt | 2 +- tests/integration/topic/describe_topic.cpp | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/last_commit.txt b/.github/last_commit.txt index bd4d1291fd..ae1437b3ec 100644 --- a/.github/last_commit.txt +++ b/.github/last_commit.txt @@ -1 +1 @@ -78aa6fa75eba124b91b200bfe76c67e94ee968a4 +97e6c30a04f89ebeb0f4b596d323e0434c346e54 diff --git a/tests/integration/topic/describe_topic.cpp b/tests/integration/topic/describe_topic.cpp index cc471a5d88..0bab267e2c 100644 --- a/tests/integration/topic/describe_topic.cpp +++ b/tests/integration/topic/describe_topic.cpp @@ -120,11 +120,6 @@ TEST_F(Describe, TEST_NAME(Location)) { } TEST_F(Describe, TEST_NAME(MetricsLevel)) { - char* ydbVersion = std::getenv("YDB_VERSION"); - if (ydbVersion != nullptr && std::string(ydbVersion) != "trunk") { - GTEST_SKIP() << "Skipping test for YDB version " << ydbVersion; - } - TTopicClient client(MakeDriver()); // const std::uint32_t MetricsLevelDisabled = 0; @@ -154,7 +149,7 @@ TEST_F(Describe, TEST_NAME(MetricsLevel)) { }; { - const std::string topic(GetTopicPath("topic-with-counters")); + const std::string topic("topic-with-counters"); createTopic(topic, MetricsLevelDetailed); checkFlag(topic, MetricsLevelDetailed); setMetricsLevel(topic, MetricsLevelObject); @@ -174,7 +169,7 @@ TEST_F(Describe, TEST_NAME(MetricsLevel)) { } { - const std::string topic(GetTopicPath("topic-without-counters-by-default")); + const std::string topic("topic-without-counters-by-default"); auto res = client.CreateTopic(topic).GetValueSync(); ASSERT_TRUE(res.IsSuccess()); Y_ENSURE(checkFlag(topic, {})); @@ -190,7 +185,7 @@ TEST_F(Describe, TEST_NAME(MetricsLevel)) { } { - const std::string topic(GetTopicPath("topic-without-counters")); + const std::string topic("topic-without-counters"); createTopic(topic, MetricsLevelObject); Y_ENSURE(checkFlag(topic, MetricsLevelObject)); setMetricsLevel(topic, MetricsLevelDetailed); From 15e8e59506341c7fada42d7730cb8bfd8a877d22 Mon Sep 17 00:00:00 2001 From: Bulat Date: Mon, 20 Oct 2025 17:37:58 +0000 Subject: [PATCH 2/5] [C++ SDK] Fixed not working PreferLocalDC (#27101) --- .github/last_commit.txt | 2 +- include/ydb-cpp-sdk/client/types/ydb.h | 6 ++++-- src/client/driver/driver.cpp | 2 +- src/client/impl/internal/common/balancing_policies.cpp | 2 +- src/client/impl/internal/common/balancing_policies.h | 4 ++-- .../impl/internal/db_driver_state/endpoint_pool.cpp | 10 ++++++---- .../impl/internal/db_driver_state/endpoint_pool.h | 5 +++-- src/client/impl/session/kqp_session_common.cpp | 3 ++- src/client/types/ydb.cpp | 4 ++-- 9 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.github/last_commit.txt b/.github/last_commit.txt index ae1437b3ec..29c0f07011 100644 --- a/.github/last_commit.txt +++ b/.github/last_commit.txt @@ -1 +1 @@ -97e6c30a04f89ebeb0f4b596d323e0434c346e54 +ec02f1861759f156df1cbd12b41565e07cfcc58f diff --git a/include/ydb-cpp-sdk/client/types/ydb.h b/include/ydb-cpp-sdk/client/types/ydb.h index cb89fa0a5e..c62652c609 100644 --- a/include/ydb-cpp-sdk/client/types/ydb.h +++ b/include/ydb-cpp-sdk/client/types/ydb.h @@ -4,6 +4,7 @@ #include "status_codes.h" #include +#include #include @@ -50,8 +51,8 @@ class TBalancingPolicy { friend class TDriver; public: //! Use preferable location, - //! location is a name of datacenter (VLA, MAN), if location is empty local datacenter is used - static TBalancingPolicy UsePreferableLocation(const std::string& location = {}); + //! location is a name of datacenter (VLA, MAN), if location is nullopt local datacenter is used + static TBalancingPolicy UsePreferableLocation(const std::optional& location = {}); //! Use all available cluster nodes regardless datacenter locality static TBalancingPolicy UseAllNodes(); @@ -71,6 +72,7 @@ class TBalancingPolicy { private: TBalancingPolicy(std::unique_ptr&& impl); + // For deprecated EBalancingPolicy TBalancingPolicy(EBalancingPolicy policy, const std::string& params); std::unique_ptr Impl_; diff --git a/src/client/driver/driver.cpp b/src/client/driver/driver.cpp index ba6a6559ab..e1e88dea22 100644 --- a/src/client/driver/driver.cpp +++ b/src/client/driver/driver.cpp @@ -70,7 +70,7 @@ class TDriverConfig::TImpl : public IConnectionsParams { TCP_KEEPALIVE_INTERVAL }; bool DrainOnDtors = true; - TBalancingPolicy::TImpl BalancingSettings = TBalancingPolicy::TImpl::UsePreferableLocation(""); + TBalancingPolicy::TImpl BalancingSettings = TBalancingPolicy::TImpl::UsePreferableLocation(std::nullopt); TDuration GRpcKeepAliveTimeout = TDuration::Seconds(10); bool GRpcKeepAlivePermitWithoutCalls = true; TDuration SocketIdleTimeout = TDuration::Minutes(6); diff --git a/src/client/impl/internal/common/balancing_policies.cpp b/src/client/impl/internal/common/balancing_policies.cpp index b3b943c63b..22ec50a622 100644 --- a/src/client/impl/internal/common/balancing_policies.cpp +++ b/src/client/impl/internal/common/balancing_policies.cpp @@ -9,7 +9,7 @@ TBalancingPolicy::TImpl TBalancingPolicy::TImpl::UseAllNodes() { return impl; } -TBalancingPolicy::TImpl TBalancingPolicy::TImpl::UsePreferableLocation(const std::string& location) { +TBalancingPolicy::TImpl TBalancingPolicy::TImpl::UsePreferableLocation(const std::optional& location) { TBalancingPolicy::TImpl impl; impl.PolicyType = EPolicyType::UsePreferableLocation; impl.Location = location; diff --git a/src/client/impl/internal/common/balancing_policies.h b/src/client/impl/internal/common/balancing_policies.h index 6c7e1c0905..f1180f37ed 100644 --- a/src/client/impl/internal/common/balancing_policies.h +++ b/src/client/impl/internal/common/balancing_policies.h @@ -19,14 +19,14 @@ class TBalancingPolicy::TImpl { static TImpl UseAllNodes(); - static TImpl UsePreferableLocation(const std::string& location); + static TImpl UsePreferableLocation(const std::optional& location); static TImpl UsePreferablePileState(EPileState pileState); EPolicyType PolicyType; // UsePreferableLocation - std::string Location; + std::optional Location; // UsePreferablePileState EPileState PileState; diff --git a/src/client/impl/internal/db_driver_state/endpoint_pool.cpp b/src/client/impl/internal/db_driver_state/endpoint_pool.cpp index 1895f39069..8bdbd19262 100644 --- a/src/client/impl/internal/db_driver_state/endpoint_pool.cpp +++ b/src/client/impl/internal/db_driver_state/endpoint_pool.cpp @@ -45,6 +45,7 @@ std::pair, bool> TEndpointPool::Updat // Is used to convert float to integer load factor // same integer values will be selected randomly. const float multiplicator = 10.0; + std::string selfLocation = result.Result.self_location(); std::unordered_map pileStates; for (const auto& pile : result.Result.pile_states()) { pileStates[pile.pile_name()] = pile; @@ -53,7 +54,7 @@ std::pair, bool> TEndpointPool::Updat for (const auto& endpoint : result.Result.endpoints()) { std::int32_t loadFactor = static_cast(multiplicator * std::min(LoadMax, std::max(LoadMin, endpoint.load_factor()))); std::uint64_t nodeId = endpoint.node_id(); - if (!IsLocalEndpoint(endpoint, pileStates)) { + if (!IsPreferredEndpoint(endpoint, selfLocation, pileStates)) { // Location mismatch, shift this endpoint loadFactor += GetLocalityShift(); } @@ -173,13 +174,14 @@ constexpr std::int32_t TEndpointPool::GetLocalityShift() { return LoadMax * Multiplicator; } -bool TEndpointPool::IsLocalEndpoint(const Ydb::Discovery::EndpointInfo& endpoint, - const std::unordered_map& pileStates) const { +bool TEndpointPool::IsPreferredEndpoint(const Ydb::Discovery::EndpointInfo& endpoint, + const std::string& selfLocation, + const std::unordered_map& pileStates) const { switch (BalancingPolicy_.PolicyType) { case TBalancingPolicy::TImpl::EPolicyType::UseAllNodes: return true; case TBalancingPolicy::TImpl::EPolicyType::UsePreferableLocation: - return endpoint.location() == BalancingPolicy_.Location; + return endpoint.location() == BalancingPolicy_.Location.value_or(selfLocation); case TBalancingPolicy::TImpl::EPolicyType::UsePreferablePileState: if (auto it = pileStates.find(endpoint.bridge_pile_name()); it != pileStates.end()) { return GetPileState(it->second.state()) == BalancingPolicy_.PileState; diff --git a/src/client/impl/internal/db_driver_state/endpoint_pool.h b/src/client/impl/internal/db_driver_state/endpoint_pool.h index c7d54ce510..b534593337 100644 --- a/src/client/impl/internal/db_driver_state/endpoint_pool.h +++ b/src/client/impl/internal/db_driver_state/endpoint_pool.h @@ -46,8 +46,9 @@ class TEndpointPool { static constexpr std::int32_t GetLocalityShift(); private: - bool IsLocalEndpoint(const Ydb::Discovery::EndpointInfo& endpoint, - const std::unordered_map& pileStates) const; + bool IsPreferredEndpoint(const Ydb::Discovery::EndpointInfo& endpoint, + const std::string& selfLocation, + const std::unordered_map& pileStates) const; EPileState GetPileState(const Ydb::Bridge::PileState::State& state) const; private: diff --git a/src/client/impl/session/kqp_session_common.cpp b/src/client/impl/session/kqp_session_common.cpp index e2a59de959..fc0fe64ef3 100644 --- a/src/client/impl/session/kqp_session_common.cpp +++ b/src/client/impl/session/kqp_session_common.cpp @@ -171,9 +171,10 @@ std::function TKqpSessionCommon::GetSmartDeleter(std:: switch (sessionImpl->GetState()) { case TKqpSessionCommon::S_STANDALONE: case TKqpSessionCommon::S_BROKEN: - case TKqpSessionCommon::S_CLOSING: + case TKqpSessionCommon::S_CLOSING: { client->DeleteSession(sessionImpl); break; + } case TKqpSessionCommon::S_IDLE: case TKqpSessionCommon::S_ACTIVE: { if (!client->ReturnSession(sessionImpl)) { diff --git a/src/client/types/ydb.cpp b/src/client/types/ydb.cpp index 332c03b626..f6083ec25e 100644 --- a/src/client/types/ydb.cpp +++ b/src/client/types/ydb.cpp @@ -10,7 +10,7 @@ namespace NYdb::inline V3 { TBalancingPolicy::TBalancingPolicy(EBalancingPolicy policy, const std::string& params) { switch (policy) { case EBalancingPolicy::UsePreferableLocation: - Impl_ = std::make_unique(TImpl::UsePreferableLocation(params)); + Impl_ = std::make_unique(TImpl::UsePreferableLocation(params.empty() ? std::nullopt : std::make_optional(params))); break; case EBalancingPolicy::UseAllNodes: Impl_ = std::make_unique(TImpl::UseAllNodes()); @@ -18,7 +18,7 @@ TBalancingPolicy::TBalancingPolicy(EBalancingPolicy policy, const std::string& p } } -TBalancingPolicy TBalancingPolicy::UsePreferableLocation(const std::string& location) { +TBalancingPolicy TBalancingPolicy::UsePreferableLocation(const std::optional& location) { return TBalancingPolicy(std::make_unique(TImpl::UsePreferableLocation(location))); } From d14cfe22062c32c6372530a671395f13218315dd Mon Sep 17 00:00:00 2001 From: Bulat Date: Mon, 20 Oct 2025 17:38:06 +0000 Subject: [PATCH 3/5] [C++ SDK] Fixed topic metrics test (#27168) --- .github/last_commit.txt | 2 +- tests/integration/topic/describe_topic.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/last_commit.txt b/.github/last_commit.txt index 29c0f07011..ca80b829d9 100644 --- a/.github/last_commit.txt +++ b/.github/last_commit.txt @@ -1 +1 @@ -ec02f1861759f156df1cbd12b41565e07cfcc58f +fec82809617b3cc3eaf47995d02287945e9ef8b0 diff --git a/tests/integration/topic/describe_topic.cpp b/tests/integration/topic/describe_topic.cpp index 0bab267e2c..cc471a5d88 100644 --- a/tests/integration/topic/describe_topic.cpp +++ b/tests/integration/topic/describe_topic.cpp @@ -120,6 +120,11 @@ TEST_F(Describe, TEST_NAME(Location)) { } TEST_F(Describe, TEST_NAME(MetricsLevel)) { + char* ydbVersion = std::getenv("YDB_VERSION"); + if (ydbVersion != nullptr && std::string(ydbVersion) != "trunk") { + GTEST_SKIP() << "Skipping test for YDB version " << ydbVersion; + } + TTopicClient client(MakeDriver()); // const std::uint32_t MetricsLevelDisabled = 0; @@ -149,7 +154,7 @@ TEST_F(Describe, TEST_NAME(MetricsLevel)) { }; { - const std::string topic("topic-with-counters"); + const std::string topic(GetTopicPath("topic-with-counters")); createTopic(topic, MetricsLevelDetailed); checkFlag(topic, MetricsLevelDetailed); setMetricsLevel(topic, MetricsLevelObject); @@ -169,7 +174,7 @@ TEST_F(Describe, TEST_NAME(MetricsLevel)) { } { - const std::string topic("topic-without-counters-by-default"); + const std::string topic(GetTopicPath("topic-without-counters-by-default")); auto res = client.CreateTopic(topic).GetValueSync(); ASSERT_TRUE(res.IsSuccess()); Y_ENSURE(checkFlag(topic, {})); @@ -185,7 +190,7 @@ TEST_F(Describe, TEST_NAME(MetricsLevel)) { } { - const std::string topic("topic-without-counters"); + const std::string topic(GetTopicPath("topic-without-counters")); createTopic(topic, MetricsLevelObject); Y_ENSURE(checkFlag(topic, MetricsLevelObject)); setMetricsLevel(topic, MetricsLevelDetailed); From 4ada4b355c3f08f0206becd15fcaa195c9577e40 Mon Sep 17 00:00:00 2001 From: Bulat Date: Mon, 20 Oct 2025 17:38:13 +0000 Subject: [PATCH 4/5] [C++ SDK] Added forgotten Reserve replacement in TExportClient (#27183) --- .github/last_commit.txt | 2 +- src/client/export/export.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/last_commit.txt b/.github/last_commit.txt index ca80b829d9..74c170ce52 100644 --- a/.github/last_commit.txt +++ b/.github/last_commit.txt @@ -1 +1 @@ -fec82809617b3cc3eaf47995d02287945e9ef8b0 +42606baa568dd1f0408b0651dce31577f28bcfe1 diff --git a/src/client/export/export.cpp b/src/client/export/export.cpp index 342329018c..4549605260 100644 --- a/src/client/export/export.cpp +++ b/src/client/export/export.cpp @@ -29,7 +29,8 @@ const std::string TExportToS3Settings::TEncryptionAlgorithm::CHACHA_20_POLY_1305 namespace { std::vector ItemsProgressFromProto(const google::protobuf::RepeatedPtrField& proto) { - std::vector result(proto.size()); + std::vector result; + result.reserve(proto.size()); for (const auto& protoItem : proto) { auto& item = result.emplace_back(); From 28f06e0b65478aa52c638130694a0a90476bd40e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 17:38:13 +0000 Subject: [PATCH 5/5] Update import generation: 27 --- .github/import_generation.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/import_generation.txt b/.github/import_generation.txt index f64f5d8d85..9902f17848 100644 --- a/.github/import_generation.txt +++ b/.github/import_generation.txt @@ -1 +1 @@ -27 +28