github-actions[bot] commented on code in PR #28940:
URL: https://github.com/apache/doris/pull/28940#discussion_r1437476369
##########
be/src/runtime/memory/lru_cache_policy.h:
##########
@@ -17,6 +17,8 @@
#pragma once
+#include <fmt/format.h>
Review Comment:
warning: 'fmt/format.h' file not found [clang-diagnostic-error]
```cpp
#include <fmt/format.h>
^
```
##########
be/src/olap/lru_cache.cpp:
##########
@@ -667,4 +674,43 @@ void ShardedLRUCache::update_cache_metrics() const {
total_lookup_count == 0 ? 0 : ((double)total_hit_count /
total_lookup_count));
}
+Cache::Handle* DummyLRUCache::insert(const CacheKey& key, void* value, size_t
charge,
+ void (*deleter)(const CacheKey& key,
void* value),
+ CachePriority priority, size_t bytes) {
+ size_t handle_size = sizeof(LRUHandle) - 1 + key.size();
+ auto* e = reinterpret_cast<LRUHandle*>(malloc(handle_size));
+ g_doris_cache_dummy_usage_num << 1;
+ e->value = value;
+ e->deleter = deleter;
+ e->charge = charge;
+ e->key_length = key.size();
+ e->total_size = 0;
+ e->bytes = 0;
+ e->hash = 0;
+ e->refs = 1; // only one for the returned handle
+ e->next = e->prev = nullptr;
+ e->in_cache = false;
+ e->priority = priority;
+ memcpy(e->key_data, key.data(), key.size());
+ return reinterpret_cast<Cache::Handle*>(e);
+}
+
+void DummyLRUCache::release(Cache::Handle* handle) {
+ if (handle == nullptr) {
+ return;
+ }
+ auto* e = reinterpret_cast<LRUHandle*>(handle);
+ e->free();
+ g_doris_cache_dummy_usage_num << -1;
+}
+
+void* DummyLRUCache::value(Handle* handle) {
+ return reinterpret_cast<LRUHandle*>(handle)->value;
+}
+
+Slice DummyLRUCache::value_slice(Handle* handle) {
+ auto* lru_handle = reinterpret_cast<LRUHandle*>(handle);
+ return Slice((char*)lru_handle->value, lru_handle->charge);
Review Comment:
warning: avoid repeating the return type from the declaration; use a braced
initializer list instead [modernize-return-braced-init-list]
```suggestion
return {(char*)lru_handle->value, lru_handle->charge};
```
--
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]