diff options
author | ivanmorozov333 <ivanmorozov@ydb.tech> | 2024-11-12 15:18:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-12 15:18:24 +0300 |
commit | d478158f5ac9681a437672985210e2e8fe6290f2 (patch) | |
tree | b1068914d16d56ac551b758a78d1538ccdcca8e3 | |
parent | 75b75e9d58fb78a90617b31ebe7489b1cfc165a0 (diff) | |
download | ydb-d478158f5ac9681a437672985210e2e8fe6290f2.tar.gz |
dont scan unappropriate portions in tiering (#11509)
6 files changed, 12 insertions, 14 deletions
diff --git a/ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.cpp b/ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.cpp index 659062338b..a36e02595d 100644 --- a/ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.cpp +++ b/ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.cpp @@ -19,12 +19,15 @@ std::optional<TInstant> TTierInfo::ScalarToInstant(const std::shared_ptr<arrow:: } } -TTiering::TTieringContext TTiering::GetTierToMove(const std::shared_ptr<arrow::Scalar>& max, const TInstant now) const { +TTiering::TTieringContext TTiering::GetTierToMove(const std::shared_ptr<arrow::Scalar>& max, const TInstant now, const bool skipEviction) const { AFL_VERIFY(OrderedTiers.size()); std::optional<TString> nextTierName; std::optional<TDuration> nextTierDuration; for (auto& tierRef : GetOrderedTiers()) { auto& tierInfo = tierRef.Get(); + if (skipEviction && tierInfo.GetName() != NTiering::NCommon::DeleteTierName) { + continue; + } auto mpiOpt = tierInfo.ScalarToInstant(max); Y_ABORT_UNLESS(mpiOpt); const TInstant maxTieringPortionInstant = *mpiOpt; diff --git a/ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.h b/ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.h index 2569662c04..77f090e3b9 100644 --- a/ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.h +++ b/ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.h @@ -149,7 +149,7 @@ public: } }; - TTieringContext GetTierToMove(const std::shared_ptr<arrow::Scalar>& max, const TInstant now) const; + TTieringContext GetTierToMove(const std::shared_ptr<arrow::Scalar>& max, const TInstant now, const bool skipEviction) const; const TTiersMap& GetTierByName() const { return TierByName; diff --git a/ydb/core/tx/columnshard/engines/storage/actualizer/tiering/tiering.cpp b/ydb/core/tx/columnshard/engines/storage/actualizer/tiering/tiering.cpp index bd2d992e38..dd9fffc9e8 100644 --- a/ydb/core/tx/columnshard/engines/storage/actualizer/tiering/tiering.cpp +++ b/ydb/core/tx/columnshard/engines/storage/actualizer/tiering/tiering.cpp @@ -43,7 +43,8 @@ std::optional<TTieringActualizer::TFullActualizationInfo> TTieringActualizer::Bu max = it->second; } } - auto tieringInfo = Tiering->GetTierToMove(max, now); + const bool skipEviction = !NYDBTest::TControllers::GetColumnShardController()->CheckPortionForEvict(portion); + auto tieringInfo = Tiering->GetTierToMove(max, now, skipEviction); AFL_TRACE(NKikimrServices::TX_COLUMNSHARD)("tiering_info", tieringInfo.DebugString()); std::optional<i64> d; std::set<TString> storagesWrite; @@ -149,13 +150,7 @@ void TTieringActualizer::DoExtractTasks( } bool limitEnriched = false; for (auto&& p : portions) { - auto portion = externalContext.GetPortionVerified(p); - if (!address.WriteIs(NBlobOperations::TGlobal::DefaultStorageId) && !address.WriteIs(NTiering::NCommon::DeleteTierName)) { - if (!NYDBTest::TControllers::GetColumnShardController()->CheckPortionForEvict(portion)) { - Counters.SkipEvictionForCompaction->Add(1); - continue; - } - } + const auto& portion = externalContext.GetPortionVerified(p); auto info = BuildActualizationInfo(*portion, tasksContext.GetActualInstant()); AFL_VERIFY(info); auto portionScheme = portion->GetSchema(VersionedIndex); diff --git a/ydb/core/tx/columnshard/hooks/abstract/abstract.cpp b/ydb/core/tx/columnshard/hooks/abstract/abstract.cpp index 94acb1bc8c..28d07734ad 100644 --- a/ydb/core/tx/columnshard/hooks/abstract/abstract.cpp +++ b/ydb/core/tx/columnshard/hooks/abstract/abstract.cpp @@ -24,8 +24,8 @@ ui64 ICSController::GetGuaranteeIndexationStartBytesLimit() const { return DoGetGuaranteeIndexationStartBytesLimit(defaultValue); } -bool ICSController::CheckPortionForEvict(const std::shared_ptr<NOlap::TPortionInfo>& portion) const { - return portion->HasRuntimeFeature(NOlap::TPortionInfo::ERuntimeFeature::Optimized) && !portion->HasInsertWriteId(); +bool ICSController::CheckPortionForEvict(const NOlap::TPortionInfo& portion) const { + return portion.HasRuntimeFeature(NOlap::TPortionInfo::ERuntimeFeature::Optimized) && !portion.HasInsertWriteId(); } } diff --git a/ydb/core/tx/columnshard/hooks/abstract/abstract.h b/ydb/core/tx/columnshard/hooks/abstract/abstract.h index 0f32f19b73..010e543e2a 100644 --- a/ydb/core/tx/columnshard/hooks/abstract/abstract.h +++ b/ydb/core/tx/columnshard/hooks/abstract/abstract.h @@ -146,7 +146,7 @@ public: const std::set<NOlap::TSnapshot>& /*snapshotsToSave*/, const std::set<NOlap::TSnapshot>& /*snapshotsToRemove*/) { } - virtual bool CheckPortionForEvict(const std::shared_ptr<NOlap::TPortionInfo>& portion) const; + virtual bool CheckPortionForEvict(const NOlap::TPortionInfo& portion) const; TDuration GetPingCheckPeriod() const { const TDuration defaultValue = 0.6 * GetReadTimeoutClean(); diff --git a/ydb/core/tx/columnshard/test_helper/controllers.h b/ydb/core/tx/columnshard/test_helper/controllers.h index a3e1eb1de4..8886700d45 100644 --- a/ydb/core/tx/columnshard/test_helper/controllers.h +++ b/ydb/core/tx/columnshard/test_helper/controllers.h @@ -36,7 +36,7 @@ protected: return TDuration::Zero(); } public: - virtual bool CheckPortionForEvict(const std::shared_ptr<TPortionInfo>& portion) const override { + virtual bool CheckPortionForEvict(const TPortionInfo& portion) const override { if (SkipSpecialCheckForEvict) { return true; } else { |