summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/client.cpp
diff options
context:
space:
mode:
authorhiddenpath <[email protected]>2024-12-19 21:42:25 +0300
committerhiddenpath <[email protected]>2024-12-19 22:01:45 +0300
commit9ae7e7cc07f96dea61e2875b0978feb5ca354caf (patch)
tree14224d0dd7a2b0b03e04031dddbf812ff2613cac /yt/cpp/mapreduce/client/client.cpp
parentcd46bd9fd4cf19e780612d8321e2fdec1b214999 (diff)
[yt/cpp/mapreduce] YT-23616: Move SkyShareTable implementation to THttpRawClient
commit_hash:92ea122e55a25d9ae51128f652c4e43c1e72c05d
Diffstat (limited to 'yt/cpp/mapreduce/client/client.cpp')
-rw-r--r--yt/cpp/mapreduce/client/client.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/yt/cpp/mapreduce/client/client.cpp b/yt/cpp/mapreduce/client/client.cpp
index 9e3976b144b..69f0147a66a 100644
--- a/yt/cpp/mapreduce/client/client.cpp
+++ b/yt/cpp/mapreduce/client/client.cpp
@@ -1352,11 +1352,27 @@ TNode::TListType TClient::SkyShareTable(
const TSkyShareTableOptions& options)
{
CheckShutdown();
- return NRawClient::SkyShareTable(
- ClientRetryPolicy_->CreatePolicyForGenericRequest(),
- Context_,
- tablePaths,
- options);
+
+ // As documented at https://wiki.yandex-team.ru/yt/userdoc/blob_tables/#shag3.sozdajomrazdachu
+ // first request returns HTTP status code 202 (Accepted). And we need retrying until we have 200 (OK).
+ TResponseInfo response;
+ while (response.HttpCode != 200) {
+ response = RequestWithRetry<TResponseInfo>(
+ ClientRetryPolicy_->CreatePolicyForGenericRequest(),
+ [this, &tablePaths, &options] (TMutationId /*mutationId*/) {
+ return RawClient_->SkyShareTable(tablePaths, options);
+ });
+ TWaitProxy::Get()->Sleep(TDuration::Seconds(5));
+ }
+
+ if (options.KeyColumns_) {
+ return NodeFromJsonString(response.Response)["torrents"].AsList();
+ } else {
+ TNode torrent;
+ torrent["key"] = TNode::CreateList();
+ torrent["rbtorrent"] = response.Response;
+ return TNode::TListType{torrent};
+ }
}
TCheckPermissionResponse TClient::CheckPermission(