This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 4f7760a5f4 [bugfix](segment cache) Recycle the fds when drop table (#23081) 4f7760a5f4 is described below commit 4f7760a5f44d404a66c5c09e6d20f58d1bfabde2 Author: Lightman <31928846+lchangli...@users.noreply.github.com> AuthorDate: Fri Aug 18 13:31:34 2023 +0800 [bugfix](segment cache) Recycle the fds when drop table (#23081) --- be/src/olap/rowset/beta_rowset.cpp | 2 ++ be/src/olap/tablet.cpp | 2 -- be/src/olap/tablet_manager.cpp | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/be/src/olap/rowset/beta_rowset.cpp b/be/src/olap/rowset/beta_rowset.cpp index fe74ac6212..4eadce60f5 100644 --- a/be/src/olap/rowset/beta_rowset.cpp +++ b/be/src/olap/rowset/beta_rowset.cpp @@ -175,6 +175,8 @@ Status BetaRowset::remove() { VLOG_NOTICE << "begin to remove files in rowset " << unique_id() << ", version:" << start_version() << "-" << end_version() << ", tabletid:" << _rowset_meta->tablet_id(); + // If the rowset was removed, it need to remove the fds in segment cache directly + SegmentLoader::instance()->erase_segments(SegmentCache::CacheKey(rowset_id())); auto fs = _rowset_meta->fs(); if (!fs) { return Status::Error<INIT_FAILED>("get fs failed"); diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp index 577c9bddb1..485c434bff 100644 --- a/be/src/olap/tablet.cpp +++ b/be/src/olap/tablet.cpp @@ -665,8 +665,6 @@ void Tablet::_delete_stale_rowset_by_version(const Version& version) { return; } _tablet_meta->delete_stale_rs_meta_by_version(version); - // If the stale rowset was deleted, it need to remove the fds directly - SegmentLoader::instance()->erase_segments(SegmentCache::CacheKey(rowset_meta->rowset_id())); VLOG_NOTICE << "delete stale rowset. tablet=" << full_name() << ", version=" << version; } diff --git a/be/src/olap/tablet_manager.cpp b/be/src/olap/tablet_manager.cpp index 50143a6d28..6bc5746d7b 100644 --- a/be/src/olap/tablet_manager.cpp +++ b/be/src/olap/tablet_manager.cpp @@ -549,6 +549,18 @@ Status TabletManager::_drop_tablet_unlocked(TTabletId tablet_id, TReplicaId repl _remove_tablet_from_partition(to_drop_tablet); tablet_map_t& tablet_map = _get_tablet_map(tablet_id); tablet_map.erase(tablet_id); + { + std::shared_lock rlock(to_drop_tablet->get_header_lock()); + static auto recycle_segment_cache = [](const auto& rowset_map) { + for (auto& [_, rowset] : rowset_map) { + // If the tablet was deleted, it need to remove all rowsets fds directly + SegmentLoader::instance()->erase_segments( + SegmentCache::CacheKey(rowset->rowset_id())); + } + }; + recycle_segment_cache(to_drop_tablet->rowset_map()); + recycle_segment_cache(to_drop_tablet->stale_rowset_map()); + } if (!keep_files) { // drop tablet will update tablet meta, should lock std::lock_guard<std::shared_mutex> wrlock(to_drop_tablet->get_header_lock()); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org