From dbb55e27b16b1be62a4979614f9b5c6a564ccffa Mon Sep 17 00:00:00 2001 From: CalvinNeo Date: Tue, 23 Apr 2024 18:05:32 +0800 Subject: [PATCH 1/6] z Signed-off-by: CalvinNeo --- dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp index 7d5211b9745..85bfd96ecdd 100644 --- a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp +++ b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp @@ -253,6 +253,7 @@ void ReadIndexDataNode::doAddHistoryTasks(Timestamp ts, kvrpcpb::ReadIndexRespon } } { + LOG_TRACE(DB::Logger::get(), "[Learner Read] Add histroy tasks ts={} region_id={}", ts, region_id); history_success_tasks.emplace(ts, std::move(resp)); // move resp } } From 4df9505e640a275dcaf76b1f807d5b79e46770b3 Mon Sep 17 00:00:00 2001 From: CalvinNeo Date: Tue, 23 Apr 2024 19:14:46 +0800 Subject: [PATCH 2/6] z Signed-off-by: CalvinNeo --- dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp index 85bfd96ecdd..fe22e93f995 100644 --- a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp +++ b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp @@ -82,7 +82,7 @@ void ReadIndexDataNode::runOneRound(const TiFlashRaftProxyHelper & helper, const e.second->update(history_success_tasks->second); } - LOG_TRACE( + LOG_DEBUG( DB::Logger::get(), "[Learner Read] Read Index in Batch(use histroy), max_ts={} region_id={} waiting_tasks={} " "running_tasks={} histroy_ts={}", From b0d7ad9f08d02452c2b499e8f50ad2975d1a13ab Mon Sep 17 00:00:00 2001 From: CalvinNeo Date: Tue, 23 Apr 2024 19:29:01 +0800 Subject: [PATCH 3/6] a Signed-off-by: CalvinNeo --- dbms/src/Storages/RegionQueryInfo.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dbms/src/Storages/RegionQueryInfo.h b/dbms/src/Storages/RegionQueryInfo.h index 66f74f38d71..f5572d61e51 100644 --- a/dbms/src/Storages/RegionQueryInfo.h +++ b/dbms/src/Storages/RegionQueryInfo.h @@ -72,14 +72,18 @@ struct MvccQueryInfo // A cache for Region -> read index result between retries using ReadIndexRes = std::unordered_map; - ReadIndexRes read_index_res_cache; DM::ScanContextPtr scan_context; - +private: + ReadIndexRes read_index_res_cache; public: explicit MvccQueryInfo(bool resolve_locks_ = false, UInt64 start_ts_ = 0, DM::ScanContextPtr scan_ctx = nullptr); - void addReadIndexResToCache(RegionID region_id, UInt64 read_index) { read_index_res_cache[region_id] = read_index; } + void addReadIndexResToCache(RegionID region_id, UInt64 read_index) { + LOG_DEBUG(DB::Logger::get(), "addReadIndexResToCache region_id={} read_index={} start_ts={}", region_id, read_index, start_ts); + read_index_res_cache[region_id] = read_index; + } + UInt64 getReadIndexRes(RegionID region_id) const { if (auto it = read_index_res_cache.find(region_id); it != read_index_res_cache.end()) From e8e578da79fb8d3b95d7a04e254a730dc118b010 Mon Sep 17 00:00:00 2001 From: CalvinNeo Date: Tue, 23 Apr 2024 19:30:20 +0800 Subject: [PATCH 4/6] a Signed-off-by: CalvinNeo --- dbms/src/Storages/RegionQueryInfo.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dbms/src/Storages/RegionQueryInfo.h b/dbms/src/Storages/RegionQueryInfo.h index f5572d61e51..db527bee2b3 100644 --- a/dbms/src/Storages/RegionQueryInfo.h +++ b/dbms/src/Storages/RegionQueryInfo.h @@ -74,14 +74,22 @@ struct MvccQueryInfo using ReadIndexRes = std::unordered_map; DM::ScanContextPtr scan_context; + private: ReadIndexRes read_index_res_cache; + public: explicit MvccQueryInfo(bool resolve_locks_ = false, UInt64 start_ts_ = 0, DM::ScanContextPtr scan_ctx = nullptr); - void addReadIndexResToCache(RegionID region_id, UInt64 read_index) { - LOG_DEBUG(DB::Logger::get(), "addReadIndexResToCache region_id={} read_index={} start_ts={}", region_id, read_index, start_ts); - read_index_res_cache[region_id] = read_index; + void addReadIndexResToCache(RegionID region_id, UInt64 read_index) + { + LOG_DEBUG( + DB::Logger::get(), + "addReadIndexResToCache region_id={} read_index={} start_ts={}", + region_id, + read_index, + start_ts); + read_index_res_cache[region_id] = read_index; } UInt64 getReadIndexRes(RegionID region_id) const From e6e36625189eb6e62224b3d16c75c9683fa824bb Mon Sep 17 00:00:00 2001 From: CalvinNeo Date: Tue, 23 Apr 2024 19:37:44 +0800 Subject: [PATCH 5/6] a Signed-off-by: CalvinNeo --- dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp index fe22e93f995..e7b6acad7f3 100644 --- a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp +++ b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp @@ -253,7 +253,7 @@ void ReadIndexDataNode::doAddHistoryTasks(Timestamp ts, kvrpcpb::ReadIndexRespon } } { - LOG_TRACE(DB::Logger::get(), "[Learner Read] Add histroy tasks ts={} region_id={}", ts, region_id); + LOG_DEBUG(DB::Logger::get(), "[Learner Read] Add histroy tasks ts={} region_id={}", ts, region_id); history_success_tasks.emplace(ts, std::move(resp)); // move resp } } From 27777ed7c40fffd72fd842e1ba62db4a7c9ec00f Mon Sep 17 00:00:00 2001 From: CalvinNeo Date: Tue, 23 Apr 2024 19:48:01 +0800 Subject: [PATCH 6/6] a Signed-off-by: CalvinNeo --- dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp index e7b6acad7f3..f141ec9b28e 100644 --- a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp +++ b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp @@ -123,7 +123,7 @@ void ReadIndexDataNode::runOneRound(const TiFlashRaftProxyHelper & helper, const } } - LOG_TRACE( + LOG_DEBUG( DB::Logger::get(), "[Learner Read] Read Index in Batch(new request), max_ts={} region_id={} waiting_tasks={} " "running_tasks={} should_build_running_task={} build_success={}",