aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkvk1920 <kvk1920@yandex-team.com>2023-09-28 11:50:48 +0300
committerkvk1920 <kvk1920@yandex-team.com>2023-09-28 12:20:50 +0300
commit9d99d203cd9fb5924a97c92caf19e3be12c4d37d (patch)
tree75d39d44ce2b41fc62b75b14e986465b7a161aea
parentaf36c1aa28ec2ef337bc39a6095c1905f52fdb94 (diff)
downloadydb-9d99d203cd9fb5924a97c92caf19e3be12c4d37d.tar.gz
Per-request read complexity limits cosmetic
-rw-r--r--yt/yt/client/api/cypress_client.h6
-rw-r--r--yt/yt/core/ytree/request_complexity_limiter.cpp2
-rw-r--r--yt/yt/core/ytree/request_complexity_limits.cpp4
-rw-r--r--yt/yt/core/ytree/ypath_detail.cpp4
4 files changed, 7 insertions, 9 deletions
diff --git a/yt/yt/client/api/cypress_client.h b/yt/yt/client/api/cypress_client.h
index 128403106f1..332a6f44e23 100644
--- a/yt/yt/client/api/cypress_client.h
+++ b/yt/yt/client/api/cypress_client.h
@@ -9,7 +9,7 @@ namespace NYT::NApi {
////////////////////////////////////////////////////////////////////////////////
-struct TReadCypressReqeustOptions
+struct TReadCypressRequestOptions
{
NYTree::TReadRequestComplexityOverrides ComplexityLimits;
};
@@ -20,7 +20,7 @@ struct TGetNodeOptions
, public TMasterReadOptions
, public TSuppressableAccessTrackingOptions
, public TPrerequisiteOptions
- , public TReadCypressReqeustOptions
+ , public TReadCypressRequestOptions
{
// NB(eshcherbin): Used in profiling Orchid.
NYTree::IAttributeDictionaryPtr Options;
@@ -65,7 +65,7 @@ struct TListNodeOptions
, public TMasterReadOptions
, public TSuppressableAccessTrackingOptions
, public TPrerequisiteOptions
- , public TReadCypressReqeustOptions
+ , public TReadCypressRequestOptions
{
NYTree::TAttributeFilter Attributes;
std::optional<i64> MaxSize;
diff --git a/yt/yt/core/ytree/request_complexity_limiter.cpp b/yt/yt/core/ytree/request_complexity_limiter.cpp
index 5858aba7ee8..5751eea514c 100644
--- a/yt/yt/core/ytree/request_complexity_limiter.cpp
+++ b/yt/yt/core/ytree/request_complexity_limiter.cpp
@@ -7,7 +7,7 @@ using namespace NYson;
////////////////////////////////////////////////////////////////////////////////
TReadRequestComplexityLimiter::TReadRequestComplexityLimiter(TReadRequestComplexity limits) noexcept
- : Limits_{limits}
+ : Limits_(limits)
{ }
void TReadRequestComplexityLimiter::Charge(TReadRequestComplexity usage) noexcept
diff --git a/yt/yt/core/ytree/request_complexity_limits.cpp b/yt/yt/core/ytree/request_complexity_limits.cpp
index a21dfffc4b6..faea8bdc32f 100644
--- a/yt/yt/core/ytree/request_complexity_limits.cpp
+++ b/yt/yt/core/ytree/request_complexity_limits.cpp
@@ -34,9 +34,7 @@ void TReadRequestComplexityOverrides::Validate(TReadRequestComplexity max) const
doCheck("node_count", NodeCount, max.NodeCount);
doCheck("result_size", ResultSize, max.ResultSize);
- if (!error.IsOK()) {
- THROW_ERROR error;
- }
+ error.ThrowOnError();
}
void FromProto(
diff --git a/yt/yt/core/ytree/ypath_detail.cpp b/yt/yt/core/ytree/ypath_detail.cpp
index 03e8552ff0d..55103fee732 100644
--- a/yt/yt/core/ytree/ypath_detail.cpp
+++ b/yt/yt/core/ytree/ypath_detail.cpp
@@ -594,7 +594,7 @@ void OnAttributeRead(auto* context, auto* response, const TErrorOr<TYsonString>&
return;
}
- auto yson = ysonOrError.Value().AsStringBuf();
+ auto yson = ysonOrError.Value().ToString();
if (auto limiter = context->GetReadRequestComplexityLimiter()) {
limiter->Charge({
@@ -607,7 +607,7 @@ void OnAttributeRead(auto* context, auto* response, const TErrorOr<TYsonString>&
}
}
- response->set_value(TString(yson));
+ response->set_value(yson);
context->Reply();
}