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/17 01:54:38 UTC

[GitHub] [doris] xinyiZzz commented on a diff in pull request #10921: [feature-wip](unique-key-merge-on-write) Add agg cache for delete bitmap DSIP-018

xinyiZzz commented on code in PR #10921:
URL: https://github.com/apache/doris/pull/10921#discussion_r922758205


##########
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:
   expiration evict policy. maybe it can be added to LRUCache later.



-- 
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