You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/18 01:59:26 UTC
[GitHub] [doris] compiletheworld commented on a diff in pull request #10921: [feature-wip](unique-key-merge-on-write) Add agg cache for delete bitmap DSIP-018
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org