Skip to content

Commit

Permalink
dont scan unappropriate portions in tiering (#11509)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 authored Nov 12, 2024
1 parent 75b75e9 commit d478158
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
5 changes: 4 additions & 1 deletion ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/columnshard/engines/scheme/tiering/tier_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class TTiering {
}
};

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/tx/columnshard/hooks/abstract/abstract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
2 changes: 1 addition & 1 deletion ydb/core/tx/columnshard/hooks/abstract/abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class ICSController {
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();
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/columnshard/test_helper/controllers.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TWaitCompactionController: public NYDBTest::NColumnShard::TController {
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 {
Expand Down

0 comments on commit d478158

Please sign in to comment.