github-actions[bot] commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1456806413
##########
be/src/olap/storage_engine.cpp:
##########
@@ -1343,4 +1383,29 @@ void
StorageEngine::_decrease_low_priority_task_nums(DataDir* dir) {
}
}
+int CreateTabletIdxCache::get_index(const std::string& key) {
+ auto lru_handle = cache()->lookup(key);
+ if (lru_handle) {
+ Defer release([cache = cache(), lru_handle] {
cache->release(lru_handle); });
+ auto value = (CacheValue*)cache()->value(lru_handle);
+ value->last_visit_time = UnixMillis();
+ VLOG_DEBUG << "use create tablet idx cache key=" << key << " value="
<< value->idx;
+ return value->idx;
+ }
+ return -1;
+}
+
+void CreateTabletIdxCache::set_index(const std::string& key, int next_idx) {
+ assert(next_idx >= 0);
+ CacheValue* value = new CacheValue;
Review Comment:
warning: use auto when initializing with new to avoid duplicating the type
name [modernize-use-auto]
```suggestion
assert(next_idx >= 0);auto
```
##########
be/src/olap/storage_engine.cpp:
##########
@@ -1343,4 +1383,29 @@
}
}
+int CreateTabletIdxCache::get_index(const std::string& key) {
+ auto lru_handle = cache()->lookup(key);
+ if (lru_handle) {
+ Defer release([cache = cache(), lru_handle] {
cache->release(lru_handle); });
+ auto value = (CacheValue*)cache()->value(lru_handle);
+ value->last_visit_time = UnixMillis();
+ VLOG_DEBUG << "use create tablet idx cache key=" << key << " value="
<< value->idx;
+ return value->idx;
+ }
+ return -1;
+}
+
+void CreateTabletIdxCache::set_index(const std::string& key, int next_idx) {
+ assert(next_idx >= 0);
+ CacheValue* value = new CacheValue;
+ value->last_visit_time = UnixMillis();
+ value->idx = next_idx;
+ auto deleter = [](const doris::CacheKey& key, void* value) {
+ CacheValue* cache_value = (CacheValue*)value;
Review Comment:
warning: use auto when initializing with a cast to avoid duplicating the
type name [modernize-use-auto]
```suggestion
ey& key, void* value) {auto
```
--
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]