yiguolei commented on code in PR #19472:
URL: https://github.com/apache/doris/pull/19472#discussion_r1193060843


##########
be/src/olap/page_cache.cpp:
##########
@@ -64,17 +64,22 @@ bool StoragePageCache::lookup(const CacheKey& key, 
PageCacheHandle* handle,
     return true;
 }
 
-void StoragePageCache::insert(const CacheKey& key, const Slice& data, 
PageCacheHandle* handle,
+void StoragePageCache::insert(const CacheKey& key, DataPage<>& data, 
PageCacheHandle* handle,
                               segment_v2::PageTypePB page_type, bool 
in_memory) {
-    auto deleter = [](const doris::CacheKey& key, void* value) { delete[] 
(uint8_t*)value; };
+    auto deleter = [](const doris::CacheKey& key, void* value) {
+        DataPage<>* cache_value = (DataPage<>*)value;
+        delete cache_value;
+    };
 
     CachePriority priority = CachePriority::NORMAL;
     if (in_memory) {
         priority = CachePriority::DURABLE;
     }
 
     auto cache = _get_page_cache(page_type);
-    auto lru_handle = cache->insert(key.encode(), data.data, data.size, 
deleter, priority);
+    DataPage<>* cache_value = new DataPage<>(std::move(data));

Review Comment:
   如果这里使用了move的话,那么67行李的datapage 参数应该显示的为 
&&,告诉调用者,我这里会move;否则在80行我们move了,外部可能不知道,结果出现core。



-- 
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-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to