freemandealer commented on code in PR #64186:
URL: https://github.com/apache/doris/pull/64186#discussion_r3409498264
##########
be/src/io/cache/block_file_cache.cpp:
##########
@@ -1378,23 +1553,34 @@ void BlockFileCache::remove_if_cached(const
UInt128Wrapper& file_key) {
// if in use, cache meta will be deleted after use and the block file is then
deleted asynchronously
void BlockFileCache::remove_if_cached_async(const UInt128Wrapper& file_key) {
std::string reason = "remove_if_cached_async";
- SCOPED_CACHE_LOCK(_mutex, this);
- bool is_ttl_file = remove_if_ttl_file_blocks(file_key, true, cache_lock,
/*sync*/ false);
- if (!is_ttl_file) {
- auto iter = _files.find(file_key);
- std::vector<FileBlockCell*> to_remove;
- if (iter != _files.end()) {
- for (auto& [_, cell] : iter->second) {
- *_gc_evict_bytes_metrics << cell.size();
- *_gc_evict_count_metrics << 1;
- if (cell.releasable()) {
- to_remove.push_back(&cell);
- } else {
- cell.file_block->set_deleting();
+ bool has_unreleasable = false;
+ {
+ SCOPED_CACHE_LOCK(_mutex, this);
+ bool is_ttl_file = remove_if_ttl_file_blocks(file_key, true,
cache_lock, /*sync*/ false,
+ &has_unreleasable);
+ if (!is_ttl_file) {
+ auto iter = _files.find(file_key);
+ std::vector<FileBlockCell*> to_remove;
+ if (iter != _files.end()) {
+ for (auto& [_, cell] : iter->second) {
+ *_gc_evict_bytes_metrics << cell.size();
+ *_gc_evict_count_metrics << 1;
+ if (cell.releasable()) {
+ to_remove.push_back(&cell);
+ } else {
+ has_unreleasable = true;
+ cell.file_block->set_deleting();
+ }
}
}
+ remove_file_blocks(to_remove, cache_lock, false, reason);
}
- remove_file_blocks(to_remove, cache_lock, false, reason);
+ if (has_unreleasable) {
+ _hashes_pending_cleanup.insert(file_key);
+ }
+ }
+ if (!has_unreleasable) {
+ enqueue_hash_for_cleanup(file_key);
}
Review Comment:
will be recovered when read, not necessarily a problem
--
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]