compiletheworld commented on code in PR #10921:
URL: https://github.com/apache/doris/pull/10921#discussion_r922931548
##########
be/src/olap/tablet_meta.cpp:
##########
@@ -869,4 +876,55 @@ void DeleteBitmap::merge(const DeleteBitmap& other) {
}
}
+// FIXME: do we need a mutex here to get rid of duplicated initializations
+// of cache entries in some cases?
+std::shared_ptr<roaring::Roaring> DeleteBitmap::get_agg(const BitmapKey& bmk)
const {
+ std::string key_str = AggCache::new_key(bmk);
+ CacheKey key(key_str);
+ Cache::Handle* handle = _agg_cache->lookup(key);
+
+ AggCache::Value* val = handle == nullptr
+ ? nullptr
+ :
reinterpret_cast<AggCache::Value*>(_agg_cache->value(handle));
+ static auto ts_ms = [] {
+ return std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now().time_since_epoch())
+ .count();
+ };
+ // Renew if needed
+ if (val == nullptr || (val->expiration > 0 && val->expiration < ts_ms())) {
Review Comment:
Yes, good point.
There is a chance that the expired cache entry can be added back to the
cache, however, the precondition is that nothing has changed since it has been
added. That is to say, the loop of L907 still needs to be run, which seems
almost the same cost?
--
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]