aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorivanmorozov333 <ivanmorozov@ydb.tech>2024-11-21 17:15:03 +0300
committerGitHub <noreply@github.com>2024-11-21 17:15:03 +0300
commit25f884a6c35e1c72d94a90ad39f06f56c3931a95 (patch)
tree2e6ae2659edaff3056eab94ecc429e9d167a76df
parent3541f4a25a78607baf70aeccc0f28f36e5717bc2 (diff)
downloadydb-25f884a6c35e1c72d94a90ad39f06f56c3931a95.tar.gz
fix filter usage for partial reading (#11835)
-rw-r--r--ydb/core/kqp/ut/olap/indexes_ut.cpp2
-rw-r--r--ydb/core/protos/config.proto1
-rw-r--r--ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetched_data.h1
-rw-r--r--ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetching.cpp3
-rw-r--r--ydb/core/tx/columnshard/hooks/abstract/abstract.h6
-rw-r--r--ydb/core/tx/columnshard/hooks/testing/controller.h6
6 files changed, 18 insertions, 1 deletions
diff --git a/ydb/core/kqp/ut/olap/indexes_ut.cpp b/ydb/core/kqp/ut/olap/indexes_ut.cpp
index caaf1b44c2..e553efb34d 100644
--- a/ydb/core/kqp/ut/olap/indexes_ut.cpp
+++ b/ydb/core/kqp/ut/olap/indexes_ut.cpp
@@ -22,6 +22,7 @@ Y_UNIT_TEST_SUITE(KqpOlapIndexes) {
csController->SetOverridePeriodicWakeupActivationPeriod(TDuration::Seconds(1));
csController->SetOverrideLagForCompactionBeforeTierings(TDuration::Seconds(1));
csController->SetOverrideReduceMemoryIntervalLimit(1LLU << 30);
+ csController->SetOverrideMemoryLimitForPortionReading(1e+10);
TLocalHelper(kikimr).CreateTestOlapTable();
auto tableClient = kikimr.GetTableClient();
@@ -322,6 +323,7 @@ Y_UNIT_TEST_SUITE(KqpOlapIndexes) {
void Execute() const {
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
csController->SetOverrideReduceMemoryIntervalLimit(1LLU << 30);
+ csController->SetOverrideMemoryLimitForPortionReading(1e+10);
TLocalHelper(*Kikimr).CreateTestOlapTable();
auto tableClient = Kikimr->GetTableClient();
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index f3799a244b..a18f14b8fb 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -1698,6 +1698,7 @@ message TColumnShardConfig {
optional uint32 SmallPortionDetectSizeLimit = 24 [default = 1048576]; // 1 << 20
optional bool ColumnChunksV0Usage = 25 [default = true];
optional bool ColumnChunksV1Usage = 26 [default = true];
+ optional uint64 MemoryLimitScanPortion = 27 [default = 100000000];
}
message TSchemeShardConfig {
diff --git a/ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetched_data.h b/ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetched_data.h
index 1a6a78cf53..cfd2113bb1 100644
--- a/ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetched_data.h
+++ b/ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetched_data.h
@@ -36,6 +36,7 @@ public:
return;
}
AFL_VERIFY(!DataAdded);
+ UseFilter = value;
}
bool HasPortionAccessor() const {
diff --git a/ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetching.cpp b/ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetching.cpp
index fbeaba7f09..a7461b6b76 100644
--- a/ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetching.cpp
+++ b/ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/fetching.cpp
@@ -289,7 +289,8 @@ TConclusion<bool> TPortionAccessorFetchingStep::DoExecuteInplace(
TConclusion<bool> TDetectInMem::DoExecuteInplace(const std::shared_ptr<IDataSource>& source, const TFetchingScriptCursor& /*step*/) const {
if (Columns.GetColumnsCount()) {
- source->SetSourceInMemory(source->GetColumnRawBytes(Columns.GetColumnIds()) < 1e+8);
+ source->SetSourceInMemory(
+ source->GetColumnRawBytes(Columns.GetColumnIds()) < NYDBTest::TControllers::GetColumnShardController()->GetMemoryLimitScanPortion());
} else {
source->SetSourceInMemory(true);
}
diff --git a/ydb/core/tx/columnshard/hooks/abstract/abstract.h b/ydb/core/tx/columnshard/hooks/abstract/abstract.h
index 010e543e2a..cc3856edfa 100644
--- a/ydb/core/tx/columnshard/hooks/abstract/abstract.h
+++ b/ydb/core/tx/columnshard/hooks/abstract/abstract.h
@@ -130,6 +130,9 @@ protected:
virtual TDuration DoGetLagForCompactionBeforeTierings(const TDuration defaultValue) const {
return defaultValue;
}
+ virtual ui64 DoGetMemoryLimitScanPortion(const ui64 defaultValue) const {
+ return defaultValue;
+ }
private:
inline static const NKikimrConfig::TColumnShardConfig DefaultConfig = {};
@@ -146,6 +149,9 @@ public:
const std::set<NOlap::TSnapshot>& /*snapshotsToSave*/, const std::set<NOlap::TSnapshot>& /*snapshotsToRemove*/) {
}
+ ui64 GetMemoryLimitScanPortion() const {
+ return DoGetMemoryLimitScanPortion(GetConfig().GetMemoryLimitScanPortion());
+ }
virtual bool CheckPortionForEvict(const NOlap::TPortionInfo& portion) const;
TDuration GetPingCheckPeriod() const {
diff --git a/ydb/core/tx/columnshard/hooks/testing/controller.h b/ydb/core/tx/columnshard/hooks/testing/controller.h
index a8e259877f..7b20288134 100644
--- a/ydb/core/tx/columnshard/hooks/testing/controller.h
+++ b/ydb/core/tx/columnshard/hooks/testing/controller.h
@@ -22,6 +22,7 @@ private:
YDB_ACCESSOR_DEF(std::optional<TDuration>, OverrideCompactionActualizationLag);
YDB_ACCESSOR_DEF(std::optional<TDuration>, OverrideTasksActualizationLag);
YDB_ACCESSOR_DEF(std::optional<TDuration>, OverrideReadTimeoutClean);
+ YDB_ACCESSOR(std::optional<ui64>, OverrideMemoryLimitForPortionReading, 100);
EOptimizerCompactionWeightControl CompactionControl = EOptimizerCompactionWeightControl::Force;
YDB_ACCESSOR(std::optional<ui64>, OverrideReduceMemoryIntervalLimit, 1024);
@@ -130,6 +131,11 @@ private:
THashSet<TString> SharingIds;
protected:
virtual ::NKikimr::NColumnShard::TBlobPutResult::TPtr OverrideBlobPutResultOnCompaction(const ::NKikimr::NColumnShard::TBlobPutResult::TPtr original, const NOlap::TWriteActionsCollection& actions) const override;
+
+ virtual ui64 DoGetMemoryLimitScanPortion(const ui64 defaultValue) const override {
+ return OverrideMemoryLimitForPortionReading.value_or(defaultValue);
+ }
+
virtual TDuration DoGetLagForCompactionBeforeTierings(const TDuration def) const override {
return OverrideLagForCompactionBeforeTierings.value_or(def);
}