ByteYue commented on code in PR #33281:
URL: https://github.com/apache/doris/pull/33281#discussion_r1554570572
##########
be/src/io/cache/block_file_cache.cpp:
##########
@@ -367,21 +367,34 @@ FileBlocks BlockFileCache::get_impl(const UInt128Wrapper&
hash, const CacheConte
return result;
}
-void BlockFileCache::clear_file_cache_async() {
+std::string BlockFileCache::clear_file_cache_async() {
+ LOG(INFO) << "start clear_file_cache_async, path=" << _cache_base_path;
+ int64_t num_cells_all = 0;
+ int64_t num_cells_to_delete = 0;
+ int64_t num_files_all = 0;
{
std::lock_guard cache_lock(_mutex);
if (!_async_clear_file_cache) {
for (auto& [_, offset_to_cell] : _files) {
+ ++num_files_all;
for (auto& [_, cell] : offset_to_cell) {
+ ++num_cells_all;
if (cell.releasable()) {
cell.is_deleted = true;
+ ++num_cells_to_delete;
}
}
}
_async_clear_file_cache = true;
}
}
TEST_SYNC_POINT_CALLBACK("BlockFileCache::recycle_deleted_blocks");
+ std::stringstream ss;
+ ss << "finish clear_file_cache_async, path=" << _cache_base_path
+ << " num_files_all=" << num_files_all << " num_cells_all=" <<
num_cells_all
+ << " num_cells_to_delete=" << num_cells_to_delete;
+ LOG(INFO) << ss.str();
Review Comment:
Don't call `ss.str()` twice. Since it might occur two copy.
```suggestion
string msg = ss.str();
LOG(INFO) << msg;
return msg;
```
Since `stringstream.str()` would return a copy of the underlying string
object.
--
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]