Skip to content

Commit 57e6766

Browse files
committed
fix
1 parent 2f6f4e0 commit 57e6766

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

ydb/library/yql/providers/yt/provider/yql_yt_io_discovery.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class TYtIODiscoveryTransformer : public TGraphTransformerBase {
192192
return ctx.ChangeChild(readNode.Ref(), 2, InitializeWalkFolders(std::move(key), cluster, keyPos, ctx));
193193
}
194194
else if (key.GetWalkFolderImplArgs()) {
195-
PendingWalkFoldersKeys_.push_back(key.GetWalkFolderImplArgs()->StateKey);
195+
Y_ENSURE(PendingWalkFoldersKeys_.contains(key.GetWalkFolderImplArgs()->StateKey));
196196
}
197197
else if (!key.IsAnonymous()) {
198198
if (PendingCanonizations_.insert(std::make_pair(std::make_pair(cluster, key.GetPath()), paths.size())).second) {
@@ -344,6 +344,7 @@ class TYtIODiscoveryTransformer : public TGraphTransformerBase {
344344
if (!res.Success()) {
345345
PendingCanonizations_.clear();
346346
PendingRanges_.clear();
347+
PendingWalkFoldersKeys_.clear();
347348
CanonizeFuture_ = {};
348349
CanonizationRangesFoldersFuture_ = {};
349350

@@ -675,7 +676,7 @@ class TYtIODiscoveryTransformer : public TGraphTransformerBase {
675676
<< args.InitialFolder.Attributes.size();
676677
const auto instanceKey = ctx.NextUniqueId;
677678
State_->WalkFoldersState.emplace(instanceKey, std::move(walkFolders));
678-
PendingWalkFoldersKeys_.push_back(instanceKey);
679+
PendingWalkFoldersKeys_.insert(instanceKey);
679680

680681
auto walkFoldersImplNode = Build<TYtWalkFoldersImpl>(ctx, key.GetNode()->Pos())
681682
.ProcessStateKey()
@@ -702,12 +703,13 @@ class TYtIODiscoveryTransformer : public TGraphTransformerBase {
702703
YQL_CLOG(INFO, ProviderYt) << "Failed to parse WalkFolderImpl args";
703704
return {};
704705
}
705-
706706
const auto instanceKey = parsedKey.GetWalkFolderImplArgs()->StateKey;
707+
if (*PendingWalkFoldersKeys_.begin() != instanceKey) {
708+
return readNode.Ptr();
709+
}
707710

708711
auto walkFoldersInstanceIt = this->State_->WalkFoldersState.find(instanceKey);
709712
YQL_ENSURE(!walkFoldersInstanceIt.IsEnd());
710-
711713
auto& walkFoldersImpl = walkFoldersInstanceIt->second;
712714

713715
Y_ENSURE(walkFoldersImpl.GetAnyOpFuture().HasValue(),
@@ -723,7 +725,7 @@ class TYtIODiscoveryTransformer : public TGraphTransformerBase {
723725
if (walkFoldersImpl.IsFinished()) {
724726
YQL_CLOG(INFO, ProviderYt) << "Building result expr for WalkFolders with key: " << instanceKey;
725727
this->State_->WalkFoldersState.erase(instanceKey);
726-
PendingWalkFoldersKeys_.pop_back();
728+
PendingWalkFoldersKeys_.erase(instanceKey);
727729

728730
auto type = Build<TCoStructType>(ctx, readNode.Pos())
729731
.Add<TExprList>()
@@ -858,7 +860,7 @@ class TYtIODiscoveryTransformer : public TGraphTransformerBase {
858860

859861
TWalkFoldersImpl& GetCurrentWalkFoldersInstance() const {
860862
Y_ENSURE(!PendingWalkFoldersKeys_.empty());
861-
const auto key = PendingWalkFoldersKeys_.back();
863+
const auto key = PendingWalkFoldersKeys_.begin();
862864
auto stateIt = State_->WalkFoldersState.find(key);
863865
YQL_ENSURE(stateIt != State_->WalkFoldersState.end());
864866
return stateIt->second;
@@ -878,7 +880,7 @@ class TYtIODiscoveryTransformer : public TGraphTransformerBase {
878880
THashMap<std::pair<TString, TYtKey::TRange>, std::pair<TPosition, NThreading::TFuture<IYtGateway::TTableRangeResult>>> PendingRanges_;
879881
THashMap<std::pair<TString, TYtKey::TFolderList>, std::pair<TPosition, NThreading::TFuture<IYtGateway::TFolderResult>>> PendingFolders_;
880882
THashMap<std::pair<TString, TString>, size_t> PendingCanonizations_; // cluster, original table path -> positions in canon result
881-
TVector<ui64> PendingWalkFoldersKeys_;
883+
THashSet<ui64> PendingWalkFoldersKeys_;
882884
NThreading::TFuture<IYtGateway::TCanonizePathsResult> CanonizeFuture_;
883885
NThreading::TFuture<void> CanonizationRangesFoldersFuture_;
884886

ydb/library/yql/providers/yt/provider/yql_yt_provider.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ void TYtState::Reset() {
307307
AnonymousLabels.clear();
308308
NodeHash.clear();
309309
Checkpoints.clear();
310+
WalkFoldersState.clear();
310311
NextEpochId = 1;
311312
}
312313

0 commit comments

Comments
 (0)