aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp
diff options
context:
space:
mode:
authorhiddenpath <hiddenpath@yandex-team.com>2025-02-18 20:34:08 +0300
committerhiddenpath <hiddenpath@yandex-team.com>2025-02-18 21:38:01 +0300
commitf29f61716d400e5eeb90d62ae9fc5ec0b7d3a39f (patch)
tree13b56a5db70e3c3773dabe0cc79279f614660e0c /yt/cpp
parent7fed694a0b014cec505a8117fc4be52cbf9792aa (diff)
downloadydb-f29f61716d400e5eeb90d62ae9fc5ec0b7d3a39f.tar.gz
YT-23616: Temprorary fallback to http implementation for some methods
This commit should be reverted when these methods will have corresponding RPC implementations. ``` void TRpcRawClient::DeleteRows( const TYPath& /*path*/, const TNode::TListType& /*keys*/, const TDeleteRowsOptions& /*options*/) { YT_UNIMPLEMENTED(); } ``` commit_hash:a7957f365cc49dce53d44d702288a41cb2ec45b9
Diffstat (limited to 'yt/cpp')
-rw-r--r--yt/cpp/mapreduce/client/client.cpp6
-rw-r--r--yt/cpp/mapreduce/http_client/raw_client.cpp44
-rw-r--r--yt/cpp/mapreduce/http_client/raw_requests.cpp66
-rw-r--r--yt/cpp/mapreduce/http_client/raw_requests.h18
4 files changed, 90 insertions, 44 deletions
diff --git a/yt/cpp/mapreduce/client/client.cpp b/yt/cpp/mapreduce/client/client.cpp
index 48e66435ab..004bfaf2d8 100644
--- a/yt/cpp/mapreduce/client/client.cpp
+++ b/yt/cpp/mapreduce/client/client.cpp
@@ -1178,7 +1178,7 @@ void TClient::InsertRows(
RequestWithRetry<void>(
ClientRetryPolicy_->CreatePolicyForGenericRequest(),
[this, &path, &rows, &options] (TMutationId /*mutationId*/) {
- RawClient_->InsertRows(path, rows, options);
+ NRawClient::InsertRows(Context_, path, rows, options);
});
}
@@ -1191,7 +1191,7 @@ void TClient::DeleteRows(
RequestWithRetry<void>(
ClientRetryPolicy_->CreatePolicyForGenericRequest(),
[this, &path, &keys, &options] (TMutationId /*mutationId*/) {
- RawClient_->DeleteRows(path, keys, options);
+ NRawClient::DeleteRows(Context_, path, keys, options);
});
}
@@ -1218,7 +1218,7 @@ TNode::TListType TClient::LookupRows(
return RequestWithRetry<TNode::TListType>(
ClientRetryPolicy_->CreatePolicyForGenericRequest(),
[this, &path, &keys, &options] (TMutationId /*mutationId*/) {
- return RawClient_->LookupRows(path, keys, options);
+ return NRawClient::LookupRows(Context_, path, keys, options);
});
}
diff --git a/yt/cpp/mapreduce/http_client/raw_client.cpp b/yt/cpp/mapreduce/http_client/raw_client.cpp
index 1390bd8b11..c86fd2494d 100644
--- a/yt/cpp/mapreduce/http_client/raw_client.cpp
+++ b/yt/cpp/mapreduce/http_client/raw_client.cpp
@@ -677,14 +677,7 @@ void THttpRawClient::InsertRows(
const TNode::TListType& rows,
const TInsertRowsOptions& options)
{
- TMutationId mutationId;
- THttpHeader header("PUT", "insert_rows");
- header.SetInputFormat(TFormat::YsonBinary());
- header.MergeParameters(NRawClient::SerializeParametersForInsertRows(Context_.Config->Prefix, path, options));
- auto body = NodeListToYsonString(rows);
- TRequestConfig config;
- config.IsHeavy = true;
- RequestWithoutRetry(Context_, mutationId, header, body, config)->GetResponse();
+ NRawClient::InsertRows(Context_, path, rows, options);
}
void THttpRawClient::TrimRows(
@@ -708,30 +701,7 @@ TNode::TListType THttpRawClient::LookupRows(
const TNode::TListType& keys,
const TLookupRowsOptions& options)
{
- TMutationId mutationId;
- THttpHeader header("PUT", "lookup_rows");
- header.AddPath(AddPathPrefix(path, Context_.Config->ApiVersion));
- header.SetInputFormat(TFormat::YsonBinary());
- header.SetOutputFormat(TFormat::YsonBinary());
-
- header.MergeParameters(BuildYsonNodeFluently().BeginMap()
- .DoIf(options.Timeout_.Defined(), [&] (TFluentMap fluent) {
- fluent.Item("timeout").Value(static_cast<i64>(options.Timeout_->MilliSeconds()));
- })
- .Item("keep_missing_rows").Value(options.KeepMissingRows_)
- .DoIf(options.Versioned_.Defined(), [&] (TFluentMap fluent) {
- fluent.Item("versioned").Value(*options.Versioned_);
- })
- .DoIf(options.Columns_.Defined(), [&] (TFluentMap fluent) {
- fluent.Item("column_names").Value(*options.Columns_);
- })
- .EndMap());
-
- auto body = NodeListToYsonString(keys);
- TRequestConfig config;
- config.IsHeavy = true;
- auto responseInfo = RequestWithoutRetry(Context_, mutationId, header, body, config);
- return NodeFromYsonString(responseInfo->GetResponse(), ::NYson::EYsonType::ListFragment).AsList();
+ return NRawClient::LookupRows(Context_, path, keys, options);
}
TNode::TListType THttpRawClient::SelectRows(
@@ -831,15 +801,7 @@ void THttpRawClient::DeleteRows(
const TNode::TListType& keys,
const TDeleteRowsOptions& options)
{
- TMutationId mutationId;
- THttpHeader header("PUT", "delete_rows");
- header.SetInputFormat(TFormat::YsonBinary());
- header.MergeParameters(NRawClient::SerializeParametersForDeleteRows(Context_.Config->Prefix, path, options));
-
- auto body = NodeListToYsonString(keys);
- TRequestConfig config;
- config.IsHeavy = true;
- RequestWithoutRetry(Context_, mutationId, header, body, config)->GetResponse();
+ NRawClient::DeleteRows(Context_, path, keys, options);
}
void THttpRawClient::FreezeTable(
diff --git a/yt/cpp/mapreduce/http_client/raw_requests.cpp b/yt/cpp/mapreduce/http_client/raw_requests.cpp
index 30b1619b71..130bea7eb8 100644
--- a/yt/cpp/mapreduce/http_client/raw_requests.cpp
+++ b/yt/cpp/mapreduce/http_client/raw_requests.cpp
@@ -15,6 +15,7 @@
#include <yt/cpp/mapreduce/interface/config.h>
#include <yt/cpp/mapreduce/interface/client.h>
+#include <yt/cpp/mapreduce/interface/fluent.h>
#include <yt/cpp/mapreduce/interface/operation.h>
#include <yt/cpp/mapreduce/interface/serialize.h>
#include <yt/cpp/mapreduce/interface/tvm.h>
@@ -308,6 +309,71 @@ NHttpClient::IHttpResponsePtr SkyShareTable(
return RequestWithoutRetry(skyApiHost, mutationId, header, "");
}
+void InsertRows(
+ const TClientContext& context,
+ const TYPath& path,
+ const TNode::TListType& rows,
+ const TInsertRowsOptions& options)
+{
+ TMutationId mutationId;
+ THttpHeader header("PUT", "insert_rows");
+ header.SetInputFormat(TFormat::YsonBinary());
+ header.MergeParameters(NRawClient::SerializeParametersForInsertRows(context.Config->Prefix, path, options));
+ auto body = NodeListToYsonString(rows);
+ TRequestConfig config;
+ config.IsHeavy = true;
+ RequestWithoutRetry(context, mutationId, header, body, config)->GetResponse();
+}
+
+TNode::TListType LookupRows(
+ const TClientContext& context,
+ const TYPath& path,
+ const TNode::TListType& keys,
+ const TLookupRowsOptions& options)
+{
+ TMutationId mutationId;
+ THttpHeader header("PUT", "lookup_rows");
+ header.AddPath(AddPathPrefix(path, context.Config->ApiVersion));
+ header.SetInputFormat(TFormat::YsonBinary());
+ header.SetOutputFormat(TFormat::YsonBinary());
+
+ header.MergeParameters(BuildYsonNodeFluently().BeginMap()
+ .DoIf(options.Timeout_.Defined(), [&] (TFluentMap fluent) {
+ fluent.Item("timeout").Value(static_cast<i64>(options.Timeout_->MilliSeconds()));
+ })
+ .Item("keep_missing_rows").Value(options.KeepMissingRows_)
+ .DoIf(options.Versioned_.Defined(), [&] (TFluentMap fluent) {
+ fluent.Item("versioned").Value(*options.Versioned_);
+ })
+ .DoIf(options.Columns_.Defined(), [&] (TFluentMap fluent) {
+ fluent.Item("column_names").Value(*options.Columns_);
+ })
+ .EndMap());
+
+ auto body = NodeListToYsonString(keys);
+ TRequestConfig config;
+ config.IsHeavy = true;
+ auto responseInfo = RequestWithoutRetry(context, mutationId, header, body, config);
+ return NodeFromYsonString(responseInfo->GetResponse(), ::NYson::EYsonType::ListFragment).AsList();
+}
+
+void DeleteRows(
+ const TClientContext& context,
+ const TYPath& path,
+ const TNode::TListType& keys,
+ const TDeleteRowsOptions& options)
+{
+ TMutationId mutationId;
+ THttpHeader header("PUT", "delete_rows");
+ header.SetInputFormat(TFormat::YsonBinary());
+ header.MergeParameters(NRawClient::SerializeParametersForDeleteRows(context.Config->Prefix, path, options));
+
+ auto body = NodeListToYsonString(keys);
+ TRequestConfig config;
+ config.IsHeavy = true;
+ RequestWithoutRetry(context, mutationId, header, body, config)->GetResponse();
+}
+
TAuthorizationInfo WhoAmI(const TClientContext& context)
{
TMutationId mutationId;
diff --git a/yt/cpp/mapreduce/http_client/raw_requests.h b/yt/cpp/mapreduce/http_client/raw_requests.h
index 1487624171..7273b8ad95 100644
--- a/yt/cpp/mapreduce/http_client/raw_requests.h
+++ b/yt/cpp/mapreduce/http_client/raw_requests.h
@@ -46,6 +46,24 @@ NHttpClient::IHttpResponsePtr SkyShareTable(
const std::vector<TYPath>& tablePaths,
const TSkyShareTableOptions& options);
+void InsertRows(
+ const TClientContext& context,
+ const TYPath& path,
+ const TNode::TListType& rows,
+ const TInsertRowsOptions& options);
+
+TNode::TListType LookupRows(
+ const TClientContext& context,
+ const TYPath& path,
+ const TNode::TListType& keys,
+ const TLookupRowsOptions& options);
+
+void DeleteRows(
+ const TClientContext& context,
+ const TYPath& path,
+ const TNode::TListType& keys,
+ const TDeleteRowsOptions& options);
+
TAuthorizationInfo WhoAmI(const TClientContext& context);
////////////////////////////////////////////////////////////////////////////////