From aeae75df14e8edac417d948f14b488a8552f817c Mon Sep 17 00:00:00 2001 From: Siyang Tang Date: Thu, 27 Feb 2025 16:01:22 +0800 Subject: [PATCH 1/5] [enhancement](schema-change) Cloud schema change do clean up when job failed --- be/src/agent/task_worker_pool.cpp | 84 +++++++++++------------- be/src/cloud/cloud_schema_change_job.cpp | 13 ++++ be/src/cloud/cloud_schema_change_job.h | 2 + be/src/cloud/cloud_tablet.cpp | 24 ++----- be/src/olap/rowset/rowset.cpp | 14 ++++ be/src/olap/rowset/rowset.h | 2 + 6 files changed, 76 insertions(+), 63 deletions(-) diff --git a/be/src/agent/task_worker_pool.cpp b/be/src/agent/task_worker_pool.cpp index 329d94eaf3869a..bf4dfdddffec32 100644 --- a/be/src/agent/task_worker_pool.cpp +++ b/be/src/agent/task_worker_pool.cpp @@ -268,39 +268,46 @@ void alter_cloud_tablet(CloudStorageEngine& engine, const TAgentTaskRequest& age // Do not need to adjust delete success or not // Because if delete failed create rollup will failed TTabletId new_tablet_id = 0; - if (status.ok()) { - new_tablet_id = agent_task_req.alter_tablet_req_v2.new_tablet_id; - auto mem_tracker = MemTrackerLimiter::create_shared( - MemTrackerLimiter::Type::SCHEMA_CHANGE, - fmt::format("EngineAlterTabletTask#baseTabletId={}:newTabletId={}", - std::to_string(agent_task_req.alter_tablet_req_v2.base_tablet_id), - std::to_string(agent_task_req.alter_tablet_req_v2.new_tablet_id), - engine.memory_limitation_bytes_per_thread_for_schema_change())); - SCOPED_ATTACH_TASK(mem_tracker); - DorisMetrics::instance()->create_rollup_requests_total->increment(1); - Status res = Status::OK(); - try { - LOG_INFO("start {}", process_name) - .tag("signature", agent_task_req.signature) - .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) - .tag("new_tablet_id", new_tablet_id) - .tag("mem_limit", - engine.memory_limitation_bytes_per_thread_for_schema_change()); - DCHECK(agent_task_req.alter_tablet_req_v2.__isset.job_id); - CloudSchemaChangeJob job(engine, - std::to_string(agent_task_req.alter_tablet_req_v2.job_id), - agent_task_req.alter_tablet_req_v2.expiration); - status = job.process_alter_tablet(agent_task_req.alter_tablet_req_v2); - } catch (const Exception& e) { - status = e.to_status(); - } - if (!status.ok()) { - DorisMetrics::instance()->create_rollup_requests_failed->increment(1); - } - } + new_tablet_id = agent_task_req.alter_tablet_req_v2.new_tablet_id; + auto mem_tracker = MemTrackerLimiter::create_shared( + MemTrackerLimiter::Type::SCHEMA_CHANGE, + fmt::format("EngineAlterTabletTask#baseTabletId={}:newTabletId={}", + std::to_string(agent_task_req.alter_tablet_req_v2.base_tablet_id), + std::to_string(agent_task_req.alter_tablet_req_v2.new_tablet_id), + engine.memory_limitation_bytes_per_thread_for_schema_change())); + SCOPED_ATTACH_TASK(mem_tracker); + DorisMetrics::instance()->create_rollup_requests_total->increment(1); + + LOG_INFO("start {}", process_name) + .tag("signature", agent_task_req.signature) + .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) + .tag("new_tablet_id", new_tablet_id) + .tag("mem_limit", engine.memory_limitation_bytes_per_thread_for_schema_change()); + DCHECK(agent_task_req.alter_tablet_req_v2.__isset.job_id); + CloudSchemaChangeJob job(engine, std::to_string(agent_task_req.alter_tablet_req_v2.job_id), + agent_task_req.alter_tablet_req_v2.expiration); + status = [&]() { + HANDLE_EXCEPTION_IF_CATCH_EXCEPTION( + job.process_alter_tablet(agent_task_req.alter_tablet_req_v2), + [&](const doris::Exception& ex) { + DorisMetrics::instance()->create_rollup_requests_failed->increment(1); + job.clean_up_on_failed(); + }); + return Status::OK(); + }(); if (status.ok()) { increase_report_version(); + LOG_INFO("successfully {}", process_name) + .tag("signature", agent_task_req.signature) + .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) + .tag("new_tablet_id", new_tablet_id); + } else { + LOG_WARNING("failed to {}", process_name) + .tag("signature", agent_task_req.signature) + .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) + .tag("new_tablet_id", new_tablet_id) + .error(status); } // Return result to fe @@ -308,19 +315,6 @@ void alter_cloud_tablet(CloudStorageEngine& engine, const TAgentTaskRequest& age finish_task_request->__set_report_version(s_report_version); finish_task_request->__set_task_type(task_type); finish_task_request->__set_signature(signature); - - if (!status.ok() && !status.is()) { - LOG_WARNING("failed to {}", process_name) - .tag("signature", agent_task_req.signature) - .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) - .tag("new_tablet_id", new_tablet_id) - .error(status); - } else { - LOG_INFO("successfully {}", process_name) - .tag("signature", agent_task_req.signature) - .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) - .tag("new_tablet_id", new_tablet_id); - } finish_task_request->__set_task_status(status.to_thrift()); } @@ -557,8 +551,8 @@ PriorTaskWorkerPool::PriorTaskWorkerPool( std::function callback) : _callback(std::move(callback)) { for (int i = 0; i < normal_worker_count; ++i) { - auto st = Thread::create( - "Normal", name, [this] { normal_loop(); }, &_workers.emplace_back()); + auto st = + Thread::create("Normal", name, [this] { normal_loop(); }, &_workers.emplace_back()); CHECK(st.ok()) << name << ": " << st; } diff --git a/be/src/cloud/cloud_schema_change_job.cpp b/be/src/cloud/cloud_schema_change_job.cpp index d12bcdaa01e21c..e0a793a6611c19 100644 --- a/be/src/cloud/cloud_schema_change_job.cpp +++ b/be/src/cloud/cloud_schema_change_job.cpp @@ -494,4 +494,17 @@ Status CloudSchemaChangeJob::_process_delete_bitmap(int64_t alter_version, return Status::OK(); } +void CloudSchemaChangeJob::clean_up_on_failed() { + for (auto output_rs : _output_rowsets) { + output_rs->clear_cache(); + if (output_rs.use_count() > 2) { + LOG(WARNING) << "Rowset " << output_rs->rowset_id().to_string() << " has " + << output_rs.use_count() + << " references. File Cache won't be recycled when query is using it."; + continue; + } + output_rs->clear_file_cache(); + } +} + } // namespace doris diff --git a/be/src/cloud/cloud_schema_change_job.h b/be/src/cloud/cloud_schema_change_job.h index c77aae4857049d..dee71cd3104646 100644 --- a/be/src/cloud/cloud_schema_change_job.h +++ b/be/src/cloud/cloud_schema_change_job.h @@ -36,6 +36,8 @@ class CloudSchemaChangeJob { // This method is idempotent for a same request. Status process_alter_tablet(const TAlterTabletReqV2& request); + void clean_up_on_failed(); + private: Status _convert_historical_rowsets(const SchemaChangeParams& sc_params, cloud::TabletJobInfoPB& job); diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp index 7abd8568bcb5fd..f70a4260045a26 100644 --- a/be/src/cloud/cloud_tablet.cpp +++ b/be/src/cloud/cloud_tablet.cpp @@ -452,27 +452,15 @@ void CloudTablet::clear_cache() { } void CloudTablet::recycle_cached_data(const std::vector& rowsets) { - for (auto& rs : rowsets) { + for (const auto& rs : rowsets) { // Clear cached opened segments and inverted index cache in memory rs->clear_cache(); - } - - if (config::enable_file_cache) { - for (const auto& rs : rowsets) { - // rowsets and tablet._rs_version_map each hold a rowset shared_ptr, so at this point, the reference count of the shared_ptr is at least 2. - if (rs.use_count() > 2) { - LOG(WARNING) << "Rowset " << rs->rowset_id().to_string() << " has " - << rs.use_count() - << " references. File Cache won't be recycled when query is using it."; - continue; - } - for (int seg_id = 0; seg_id < rs->num_segments(); ++seg_id) { - // TODO: Segment::file_cache_key - auto file_key = Segment::file_cache_key(rs->rowset_id().to_string(), seg_id); - auto* file_cache = io::FileCacheFactory::instance()->get_by_path(file_key); - file_cache->remove_if_cached_async(file_key); - } + if (rs.use_count() > 2) { + LOG(WARNING) << "Rowset " << rs->rowset_id().to_string() << " has " << rs.use_count() + << " references. File Cache won't be recycled when query is using it."; + continue; } + rs->clear_file_cache(); } } diff --git a/be/src/olap/rowset/rowset.cpp b/be/src/olap/rowset/rowset.cpp index 0fd8e60f7cefdf..7e4b8a750264b3 100644 --- a/be/src/olap/rowset/rowset.cpp +++ b/be/src/olap/rowset/rowset.cpp @@ -19,6 +19,8 @@ #include +#include "common/config.h" +#include "io/cache/block_file_cache_factory.h" #include "olap/olap_define.h" #include "olap/segment_loader.h" #include "olap/tablet_schema.h" @@ -120,6 +122,18 @@ void Rowset::clear_cache() { } } +void Rowset::clear_file_cache() const { + if (!config::enable_file_cache) { + return; + } + for (int seg_id = 0; seg_id < num_segments(); ++seg_id) { + // TODO: Segment::file_cache_key + auto file_key = segment_v2::Segment::file_cache_key(rowset_id().to_string(), seg_id); + auto* file_cache = io::FileCacheFactory::instance()->get_by_path(file_key); + file_cache->remove_if_cached_async(file_key); + } +} + Result Rowset::segment_path(int64_t seg_id) { if (is_local()) { return local_segment_path(_tablet_path, _rowset_meta->rowset_id().to_string(), seg_id); diff --git a/be/src/olap/rowset/rowset.h b/be/src/olap/rowset/rowset.h index 01f321728f1bea..2af55cd1813c64 100644 --- a/be/src/olap/rowset/rowset.h +++ b/be/src/olap/rowset/rowset.h @@ -310,6 +310,8 @@ class Rowset : public std::enable_shared_from_this, public MetadataAdder void clear_cache(); + void clear_file_cache() const; + Result segment_path(int64_t seg_id); protected: From 7f8aa77a70f1f872d2f81b03d25310f340765b88 Mon Sep 17 00:00:00 2001 From: Siyang Tang Date: Thu, 27 Feb 2025 16:01:22 +0800 Subject: [PATCH 2/5] [enhancement](schema-change) Cloud schema change do clean up when job failed --- be/src/agent/task_worker_pool.cpp | 84 +++++++++++------------- be/src/cloud/cloud_schema_change_job.cpp | 13 ++++ be/src/cloud/cloud_schema_change_job.h | 2 + be/src/cloud/cloud_tablet.cpp | 24 ++----- be/src/olap/rowset/rowset.cpp | 14 ++++ be/src/olap/rowset/rowset.h | 2 + 6 files changed, 76 insertions(+), 63 deletions(-) diff --git a/be/src/agent/task_worker_pool.cpp b/be/src/agent/task_worker_pool.cpp index 329d94eaf3869a..bf4dfdddffec32 100644 --- a/be/src/agent/task_worker_pool.cpp +++ b/be/src/agent/task_worker_pool.cpp @@ -268,39 +268,46 @@ void alter_cloud_tablet(CloudStorageEngine& engine, const TAgentTaskRequest& age // Do not need to adjust delete success or not // Because if delete failed create rollup will failed TTabletId new_tablet_id = 0; - if (status.ok()) { - new_tablet_id = agent_task_req.alter_tablet_req_v2.new_tablet_id; - auto mem_tracker = MemTrackerLimiter::create_shared( - MemTrackerLimiter::Type::SCHEMA_CHANGE, - fmt::format("EngineAlterTabletTask#baseTabletId={}:newTabletId={}", - std::to_string(agent_task_req.alter_tablet_req_v2.base_tablet_id), - std::to_string(agent_task_req.alter_tablet_req_v2.new_tablet_id), - engine.memory_limitation_bytes_per_thread_for_schema_change())); - SCOPED_ATTACH_TASK(mem_tracker); - DorisMetrics::instance()->create_rollup_requests_total->increment(1); - Status res = Status::OK(); - try { - LOG_INFO("start {}", process_name) - .tag("signature", agent_task_req.signature) - .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) - .tag("new_tablet_id", new_tablet_id) - .tag("mem_limit", - engine.memory_limitation_bytes_per_thread_for_schema_change()); - DCHECK(agent_task_req.alter_tablet_req_v2.__isset.job_id); - CloudSchemaChangeJob job(engine, - std::to_string(agent_task_req.alter_tablet_req_v2.job_id), - agent_task_req.alter_tablet_req_v2.expiration); - status = job.process_alter_tablet(agent_task_req.alter_tablet_req_v2); - } catch (const Exception& e) { - status = e.to_status(); - } - if (!status.ok()) { - DorisMetrics::instance()->create_rollup_requests_failed->increment(1); - } - } + new_tablet_id = agent_task_req.alter_tablet_req_v2.new_tablet_id; + auto mem_tracker = MemTrackerLimiter::create_shared( + MemTrackerLimiter::Type::SCHEMA_CHANGE, + fmt::format("EngineAlterTabletTask#baseTabletId={}:newTabletId={}", + std::to_string(agent_task_req.alter_tablet_req_v2.base_tablet_id), + std::to_string(agent_task_req.alter_tablet_req_v2.new_tablet_id), + engine.memory_limitation_bytes_per_thread_for_schema_change())); + SCOPED_ATTACH_TASK(mem_tracker); + DorisMetrics::instance()->create_rollup_requests_total->increment(1); + + LOG_INFO("start {}", process_name) + .tag("signature", agent_task_req.signature) + .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) + .tag("new_tablet_id", new_tablet_id) + .tag("mem_limit", engine.memory_limitation_bytes_per_thread_for_schema_change()); + DCHECK(agent_task_req.alter_tablet_req_v2.__isset.job_id); + CloudSchemaChangeJob job(engine, std::to_string(agent_task_req.alter_tablet_req_v2.job_id), + agent_task_req.alter_tablet_req_v2.expiration); + status = [&]() { + HANDLE_EXCEPTION_IF_CATCH_EXCEPTION( + job.process_alter_tablet(agent_task_req.alter_tablet_req_v2), + [&](const doris::Exception& ex) { + DorisMetrics::instance()->create_rollup_requests_failed->increment(1); + job.clean_up_on_failed(); + }); + return Status::OK(); + }(); if (status.ok()) { increase_report_version(); + LOG_INFO("successfully {}", process_name) + .tag("signature", agent_task_req.signature) + .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) + .tag("new_tablet_id", new_tablet_id); + } else { + LOG_WARNING("failed to {}", process_name) + .tag("signature", agent_task_req.signature) + .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) + .tag("new_tablet_id", new_tablet_id) + .error(status); } // Return result to fe @@ -308,19 +315,6 @@ void alter_cloud_tablet(CloudStorageEngine& engine, const TAgentTaskRequest& age finish_task_request->__set_report_version(s_report_version); finish_task_request->__set_task_type(task_type); finish_task_request->__set_signature(signature); - - if (!status.ok() && !status.is()) { - LOG_WARNING("failed to {}", process_name) - .tag("signature", agent_task_req.signature) - .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) - .tag("new_tablet_id", new_tablet_id) - .error(status); - } else { - LOG_INFO("successfully {}", process_name) - .tag("signature", agent_task_req.signature) - .tag("base_tablet_id", agent_task_req.alter_tablet_req_v2.base_tablet_id) - .tag("new_tablet_id", new_tablet_id); - } finish_task_request->__set_task_status(status.to_thrift()); } @@ -557,8 +551,8 @@ PriorTaskWorkerPool::PriorTaskWorkerPool( std::function callback) : _callback(std::move(callback)) { for (int i = 0; i < normal_worker_count; ++i) { - auto st = Thread::create( - "Normal", name, [this] { normal_loop(); }, &_workers.emplace_back()); + auto st = + Thread::create("Normal", name, [this] { normal_loop(); }, &_workers.emplace_back()); CHECK(st.ok()) << name << ": " << st; } diff --git a/be/src/cloud/cloud_schema_change_job.cpp b/be/src/cloud/cloud_schema_change_job.cpp index ce202dbf2cd32d..58f03ab8909163 100644 --- a/be/src/cloud/cloud_schema_change_job.cpp +++ b/be/src/cloud/cloud_schema_change_job.cpp @@ -510,4 +510,17 @@ Status CloudSchemaChangeJob::_process_delete_bitmap(int64_t alter_version, return Status::OK(); } +void CloudSchemaChangeJob::clean_up_on_failed() { + for (auto output_rs : _output_rowsets) { + output_rs->clear_cache(); + if (output_rs.use_count() > 2) { + LOG(WARNING) << "Rowset " << output_rs->rowset_id().to_string() << " has " + << output_rs.use_count() + << " references. File Cache won't be recycled when query is using it."; + continue; + } + output_rs->clear_file_cache(); + } +} + } // namespace doris diff --git a/be/src/cloud/cloud_schema_change_job.h b/be/src/cloud/cloud_schema_change_job.h index c77aae4857049d..dee71cd3104646 100644 --- a/be/src/cloud/cloud_schema_change_job.h +++ b/be/src/cloud/cloud_schema_change_job.h @@ -36,6 +36,8 @@ class CloudSchemaChangeJob { // This method is idempotent for a same request. Status process_alter_tablet(const TAlterTabletReqV2& request); + void clean_up_on_failed(); + private: Status _convert_historical_rowsets(const SchemaChangeParams& sc_params, cloud::TabletJobInfoPB& job); diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp index e042c8074e0173..d5097a2755676f 100644 --- a/be/src/cloud/cloud_tablet.cpp +++ b/be/src/cloud/cloud_tablet.cpp @@ -452,27 +452,15 @@ void CloudTablet::clear_cache() { } void CloudTablet::recycle_cached_data(const std::vector& rowsets) { - for (auto& rs : rowsets) { + for (const auto& rs : rowsets) { // Clear cached opened segments and inverted index cache in memory rs->clear_cache(); - } - - if (config::enable_file_cache) { - for (const auto& rs : rowsets) { - // rowsets and tablet._rs_version_map each hold a rowset shared_ptr, so at this point, the reference count of the shared_ptr is at least 2. - if (rs.use_count() > 2) { - LOG(WARNING) << "Rowset " << rs->rowset_id().to_string() << " has " - << rs.use_count() - << " references. File Cache won't be recycled when query is using it."; - continue; - } - for (int seg_id = 0; seg_id < rs->num_segments(); ++seg_id) { - // TODO: Segment::file_cache_key - auto file_key = Segment::file_cache_key(rs->rowset_id().to_string(), seg_id); - auto* file_cache = io::FileCacheFactory::instance()->get_by_path(file_key); - file_cache->remove_if_cached_async(file_key); - } + if (rs.use_count() > 2) { + LOG(WARNING) << "Rowset " << rs->rowset_id().to_string() << " has " << rs.use_count() + << " references. File Cache won't be recycled when query is using it."; + continue; } + rs->clear_file_cache(); } } diff --git a/be/src/olap/rowset/rowset.cpp b/be/src/olap/rowset/rowset.cpp index 0fd8e60f7cefdf..7e4b8a750264b3 100644 --- a/be/src/olap/rowset/rowset.cpp +++ b/be/src/olap/rowset/rowset.cpp @@ -19,6 +19,8 @@ #include +#include "common/config.h" +#include "io/cache/block_file_cache_factory.h" #include "olap/olap_define.h" #include "olap/segment_loader.h" #include "olap/tablet_schema.h" @@ -120,6 +122,18 @@ void Rowset::clear_cache() { } } +void Rowset::clear_file_cache() const { + if (!config::enable_file_cache) { + return; + } + for (int seg_id = 0; seg_id < num_segments(); ++seg_id) { + // TODO: Segment::file_cache_key + auto file_key = segment_v2::Segment::file_cache_key(rowset_id().to_string(), seg_id); + auto* file_cache = io::FileCacheFactory::instance()->get_by_path(file_key); + file_cache->remove_if_cached_async(file_key); + } +} + Result Rowset::segment_path(int64_t seg_id) { if (is_local()) { return local_segment_path(_tablet_path, _rowset_meta->rowset_id().to_string(), seg_id); diff --git a/be/src/olap/rowset/rowset.h b/be/src/olap/rowset/rowset.h index 01f321728f1bea..2af55cd1813c64 100644 --- a/be/src/olap/rowset/rowset.h +++ b/be/src/olap/rowset/rowset.h @@ -310,6 +310,8 @@ class Rowset : public std::enable_shared_from_this, public MetadataAdder void clear_cache(); + void clear_file_cache() const; + Result segment_path(int64_t seg_id); protected: From 4b5f25848bcac768562de3bd957d94989866bd19 Mon Sep 17 00:00:00 2001 From: Siyang Tang Date: Thu, 6 Mar 2025 15:55:58 +0800 Subject: [PATCH 3/5] Update task_worker_pool.cpp --- be/src/agent/task_worker_pool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/be/src/agent/task_worker_pool.cpp b/be/src/agent/task_worker_pool.cpp index bf4dfdddffec32..e69d5dbbc1abeb 100644 --- a/be/src/agent/task_worker_pool.cpp +++ b/be/src/agent/task_worker_pool.cpp @@ -551,8 +551,8 @@ PriorTaskWorkerPool::PriorTaskWorkerPool( std::function callback) : _callback(std::move(callback)) { for (int i = 0; i < normal_worker_count; ++i) { - auto st = - Thread::create("Normal", name, [this] { normal_loop(); }, &_workers.emplace_back()); + auto st = Thread::create( + "Normal", name, [this] { normal_loop(); }, &_workers.emplace_back()); CHECK(st.ok()) << name << ": " << st; } From 6edd84f09867014ad548a2e05b891d959941bcd1 Mon Sep 17 00:00:00 2001 From: Siyang Tang Date: Thu, 6 Mar 2025 17:57:08 +0800 Subject: [PATCH 4/5] Update task_worker_pool.cpp --- be/src/agent/task_worker_pool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/be/src/agent/task_worker_pool.cpp b/be/src/agent/task_worker_pool.cpp index bf4dfdddffec32..e69d5dbbc1abeb 100644 --- a/be/src/agent/task_worker_pool.cpp +++ b/be/src/agent/task_worker_pool.cpp @@ -551,8 +551,8 @@ PriorTaskWorkerPool::PriorTaskWorkerPool( std::function callback) : _callback(std::move(callback)) { for (int i = 0; i < normal_worker_count; ++i) { - auto st = - Thread::create("Normal", name, [this] { normal_loop(); }, &_workers.emplace_back()); + auto st = Thread::create( + "Normal", name, [this] { normal_loop(); }, &_workers.emplace_back()); CHECK(st.ok()) << name << ": " << st; } From 6f38897d3dd66c2979f053911b3a9145c5c1c44e Mon Sep 17 00:00:00 2001 From: Siyang Tang Date: Mon, 10 Mar 2025 14:25:55 +0800 Subject: [PATCH 5/5] Update cloud_tablet.cpp --- be/src/cloud/cloud_tablet.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp index 1dff373dafdbe4..5a367810d0698e 100644 --- a/be/src/cloud/cloud_tablet.cpp +++ b/be/src/cloud/cloud_tablet.cpp @@ -454,6 +454,7 @@ void CloudTablet::clear_cache() { void CloudTablet::recycle_cached_data(const std::vector& rowsets) { for (const auto& rs : rowsets) { + // rowsets and tablet._rs_version_map each hold a rowset shared_ptr, so at this point, the reference count of the shared_ptr is at least 2. if (rs.use_count() > 2) { LOG(WARNING) << "Rowset " << rs->rowset_id().to_string() << " has " << rs.use_count() << " references. File Cache won't be recycled when query is using it.";