deardeng commented on code in PR #60480:
URL: https://github.com/apache/doris/pull/60480#discussion_r2758970939
##########
be/src/io/cache/block_file_cache_downloader.cpp:
##########
@@ -181,9 +181,34 @@ void FileCacheBlockDownloader::download_file_cache_block(
<< ", rowset_id=" << meta.rowset_id() << ", segment_id=" <<
meta.segment_id()
<< ", offset=" << meta.offset() << ", size=" << meta.size()
<< ", type=" << meta.cache_type();
+
+ // Helper to decrease inflight count on early return.
+ // NOTE: This lambda captures 'this' pointer. It's safe because:
+ // 1. download_segment_file() calls download_done synchronously
+ // 2. ~FileCacheBlockDownloader() waits for all workers to finish via
_workers->shutdown()
+ // If this assumption changes (e.g., async callback), consider using
shared_from_this pattern.
+ auto decrease_inflight_count = [this, tablet_id = meta.tablet_id()]() {
+ std::lock_guard lock(_inflight_mtx);
+ auto it = _inflight_tablets.find(tablet_id);
+ if (it == _inflight_tablets.end()) {
+ LOG(WARNING) << "inflight ref cnt not exist, tablet id " <<
tablet_id;
+ } else {
+ it->second--;
+ VLOG_DEBUG << "download_file_cache_block: inflight_tablets["
<< tablet_id
+ << "] = " << it->second;
+ if (it->second <= 0) {
+ DCHECK_EQ(it->second, 0) << it->first;
Review Comment:
yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]