summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/operation_preparer.cpp
diff options
context:
space:
mode:
authorermolovd <[email protected]>2026-02-02 16:13:30 +0300
committerermolovd <[email protected]>2026-02-02 17:46:03 +0300
commit9cfcbb8725f64ffbfdb1e51e0a6c39eaa94fbc31 (patch)
tree1ad14a8dcdacd0ce9aab20e201a424924600642b /yt/cpp/mapreduce/client/operation_preparer.cpp
parentbe23f9b57f2f14457b6f3296455f5e52cf15cffa (diff)
operation_preparer uses IClient methods instead of IRawClient to enable retries
commit_hash:067376925c20e9ab7e1bf25d91ebb5e17b692c51
Diffstat (limited to 'yt/cpp/mapreduce/client/operation_preparer.cpp')
-rw-r--r--yt/cpp/mapreduce/client/operation_preparer.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/yt/cpp/mapreduce/client/operation_preparer.cpp b/yt/cpp/mapreduce/client/operation_preparer.cpp
index fc728b3b9f6..d3f9e5d8028 100644
--- a/yt/cpp/mapreduce/client/operation_preparer.cpp
+++ b/yt/cpp/mapreduce/client/operation_preparer.cpp
@@ -210,22 +210,19 @@ TRichYPath TOperationPreparer::LockFile(const TRichYPath& path)
{
CheckValidity();
- auto lockRequest = Client_->GetRawClient()->CreateRawBatchRequest();
- auto lockIdFuture = lockRequest->Lock(
+ auto fileTx = Client_->AttachTransaction(
FileTransaction_->GetId(),
- path.Path_,
- ELockMode::LM_SNAPSHOT,
- TLockOptions().Waitable(true));
+ TAttachTransactionOptions()
+ .AbortOnTermination(false)
+ .AutoPingable(false));
- lockRequest->ExecuteBatch();
+ auto lock = fileTx->Lock(path.Path_, ELockMode::LM_SNAPSHOT);
- auto nodeIdFuture = Client_->GetRawClient()->Get(
- FileTransaction_->GetId(),
- ::TStringBuilder() << '#' << GetGuidAsString(lockIdFuture.GetValue()) << "/@node_id");
+ auto nodeId = lock->GetLockedNodeId();
auto result = path;
result.OriginalPath(path.Path_);
- result.Path("#" + nodeIdFuture.AsString());
+ result.Path("#" + nodeId.AsGuidString());
YT_LOG_DEBUG("Locked file %v, new path is %v",
*result.OriginalPath_,
@@ -380,8 +377,7 @@ const TVector<TRichYPath>& TJobPreparer::TEagerLockingFileCache::GetFiles() cons
void TJobPreparer::TEagerLockingFileCache::InsertFile(const TRichYPath& path)
{
- LockedFiles_.emplace_back(
- OperationPreparer_.LockFile(path));
+ LockedFiles_.emplace_back(OperationPreparer_.LockFile(path));
}
////////////////////////////////////////////////////////////////////////////////