You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "deardeng (via GitHub)" <gi...@apache.org> on 2024/01/10 12:54:26 UTC
[PR] [improvement](create tablet) backend create tablet round robin among … [doris]
deardeng opened a new pull request, #29818:
URL: https://github.com/apache/doris/pull/29818
…disks
## Proposed changes
Issue Number: close #xxx
<!--Describe your changes.-->
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "deardeng (via GitHub)" <gi...@apache.org>.
deardeng commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1895892406
run buildall
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "deardeng (via GitHub)" <gi...@apache.org>.
deardeng commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1897719736
run buildall
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1896016328
<details>
<summary>TPC-H: <b>Total hot run time: 39130 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit b1efa83e31f24276e2df92b99440dae41ead7d2b, data reload: false
------ Round 1 ----------------------------------
q1 17758 5623 5217 5217
q2 2035 143 136 136
q3 10833 1188 1169 1169
q4 10876 793 793 793
q5 9078 3261 3235 3235
q6 206 123 123 123
q7 889 524 505 505
q8 9389 1996 1983 1983
q9 7577 6527 6359 6359
q10 8227 3114 3011 3011
q11 410 201 205 201
q12 355 187 185 185
q13 17997 3393 3365 3365
q14 249 218 208 208
q15 541 509 508 508
q16 449 372 373 372
q17 942 624 528 528
q18 7712 7087 6881 6881
q19 1645 1339 1425 1339
q20 627 296 301 296
q21 2779 2457 2410 2410
q22 356 319 306 306
Total cold run time: 110930 ms
Total hot run time: 39130 ms
----- Round 2, with runtime_filter_mode=off -----
q1 5517 5284 5316 5284
q2 330 215 214 214
q3 3332 3236 3242 3236
q4 2079 2044 2039 2039
q5 6069 5929 5971 5929
q6 201 117 118 117
q7 2319 1897 1944 1897
q8 3256 3378 3384 3378
q9 9030 8856 8731 8731
q10 3970 3858 3889 3858
q11 559 448 464 448
q12 812 650 612 612
q13 16905 3135 3146 3135
q14 280 253 260 253
q15 551 503 503 503
q16 529 493 476 476
q17 1864 1847 1828 1828
q18 9469 18943 9853 9853
q19 24168 1544 1545 1544
q20 4578 1934 1903 1903
q21 14526 5466 5472 5466
q22 958 566 510 510
Total cold run time: 111302 ms
Total hot run time: 61214 ms
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring merged PR #29818:
URL: https://github.com/apache/doris/pull/29818
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1895817249
Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Load test result on commit 0117897080a5afd224af5c639da644aeb9f323e0 with default session variables
Stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
Stream load orc: 58 seconds loaded 1101869774 Bytes, about 18 MB/s
Stream load parquet: 32 seconds loaded 861443392 Bytes, about 25 MB/s
Insert into select: 14.1 seconds inserted 10000000 Rows, about 709K ops/s
```
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1447357079
##########
be/src/olap/storage_engine.cpp:
##########
@@ -448,45 +449,85 @@
return Status::OK();
}
+StorageEngine::Disk_remaining_level get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent >= 0 && disk_usage_percent <= 1);
+ if (disk_usage_percent < 0.7) {
+ return StorageEngine::Disk_remaining_level::LOW;
+ } else if (disk_usage_percent < 0.85) {
+ return StorageEngine::Disk_remaining_level::MID;
+ } else {
+ return StorageEngine::Disk_remaining_level::HIGH;
+ }
+ return StorageEngine::Disk_remaining_level::LOW;
+}
+
std::vector<DataDir*> StorageEngine::get_stores_for_create_tablet(
TStorageMedium::type storage_medium) {
+ struct DirInfo {
+ DataDir* data_dir;
+
+ StorageEngine::Disk_remaining_level available_level;
+
+ bool operator<(const DirInfo& other) {
Review Comment:
warning: method 'operator<' can be made const [readability-make-member-function-const]
```suggestion
bool operator<(const DirInfo& other) const {
```
##########
be/src/olap/storage_engine.cpp:
##########
@@ -18,6 +18,7 @@
#include "olap/storage_engine.h"
// IWYU pragma: no_include <bthread/errno.h>
+#include <assert.h>
Review Comment:
warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
```suggestion
#include <cassert>
```
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "yujun777 (via GitHub)" <gi...@apache.org>.
yujun777 commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1449804495
##########
be/src/olap/storage_engine.cpp:
##########
@@ -448,45 +450,89 @@ Status StorageEngine::set_cluster_id(int32_t cluster_id) {
return Status::OK();
}
+StorageEngine::Disk_remaining_level get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent <= 1);
+ if (disk_usage_percent < 0.7) {
+ return StorageEngine::Disk_remaining_level::LOW;
+ } else if (disk_usage_percent < 0.85) {
+ return StorageEngine::Disk_remaining_level::MID;
+ }
+ return StorageEngine::Disk_remaining_level::HIGH;
+}
+
std::vector<DataDir*> StorageEngine::get_stores_for_create_tablet(
- TStorageMedium::type storage_medium) {
+ int64 partition_id, TStorageMedium::type storage_medium) {
+ struct DirInfo {
+ DataDir* data_dir;
+
+ StorageEngine::Disk_remaining_level available_level;
+
+ bool operator<(const DirInfo& other) const {
+ if (available_level != other.available_level) {
+ return available_level < other.available_level;
+ }
+ return data_dir->path_hash() < other.data_dir->path_hash();
+ }
+ };
+
+ std::vector<DirInfo> dir_infos;
+ int curr_index = 0;
+
std::vector<DataDir*> stores;
{
std::lock_guard<std::mutex> l(_store_lock);
+
+ auto key = CreateTabletIdxCache::get_key(partition_id, storage_medium);
+ curr_index = _create_tablet_idx_lru_cache->get_index(key);
+ // -1, lru can't find key
+ if (curr_index == -1) {
+ auto init_num = rand() % 100;
+ curr_index = init_num;
+ _create_tablet_idx_lru_cache->set_index(key, init_num);
+ } else {
+ int64_t next_index = curr_index + 1;
+ // int64 overflow
+ if (next_index < 0) {
+ curr_index = 0;
+ }
+ _create_tablet_idx_lru_cache->set_index(key, next_index);
+ }
+
Review Comment:
```
curr_index = _create_tablet_idx_lru_cache->get_index(key);
// -1, lru can't find key
if (curr_index == -1) {
curr_index = std::max(0, _last_use_index[medium] + 1);
}
_last_use_index[medium] = curr_index;
_create_tablet_idx_lru_cache->set_index(key, std::max(0, curr_index + 1));
```
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
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: 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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1897798724
<details>
<summary>ClickBench: <b>Total hot run time: 30.97 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit d2b1498bd198451f5fd324ee1e17fc2721401f34, data reload: false
query1 0.03 0.03 0.03
query2 0.06 0.03 0.03
query3 0.22 0.04 0.05
query4 1.70 0.06 0.07
query5 0.53 0.52 0.52
query6 1.33 0.63 0.61
query7 0.02 0.01 0.01
query8 0.03 0.02 0.02
query9 0.54 0.51 0.50
query10 0.56 0.55 0.54
query11 0.13 0.09 0.09
query12 0.11 0.09 0.09
query13 0.60 0.60 0.60
query14 0.78 0.79 0.81
query15 0.80 0.78 0.78
query16 0.39 0.40 0.38
query17 1.02 0.98 1.01
query18 0.21 0.27 0.24
query19 1.83 1.83 1.82
query20 0.02 0.01 0.01
query21 15.42 0.60 0.59
query22 2.65 2.31 1.89
query23 17.34 0.76 0.83
query24 2.48 1.20 1.16
query25 0.40 0.18 0.15
query26 0.64 0.14 0.13
query27 0.06 0.06 0.05
query28 11.09 0.78 0.75
query29 12.54 3.16 3.15
query30 0.52 0.52 0.48
query31 2.79 0.33 0.35
query32 3.42 0.48 0.48
query33 3.22 3.24 3.26
query34 15.81 4.16 4.23
query35 4.29 4.26 4.19
query36 1.11 1.06 1.07
query37 0.06 0.05 0.05
query38 0.04 0.02 0.02
query39 0.02 0.02 0.02
query40 0.15 0.12 0.12
query41 0.07 0.02 0.02
query42 0.03 0.01 0.02
query43 0.02 0.02 0.02
Total cold run time: 105.08 s
Total hot run time: 30.97 s
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1452903952
##########
be/src/olap/storage_engine.cpp:
##########
@@ -129,7 +130,10 @@ StorageEngine::StorageEngine(const EngineOptions& options)
_memtable_flush_executor(nullptr),
_calc_delete_bitmap_executor(nullptr),
_default_rowset_type(BETA_ROWSET),
- _stream_load_recorder(nullptr) {
+ _heartbeat_flags(nullptr),
Review Comment:
warning: member initializer for '_heartbeat_flags' is redundant [modernize-use-default-member-init]
```suggestion
,
```
##########
be/src/olap/storage_engine.h:
##########
@@ -488,6 +492,60 @@ class StorageEngine {
bool _clear_segment_cache = false;
std::atomic<bool> _need_clean_trash {false};
+
+ // next index for create tablet
+ std::map<TStorageMedium::type, int> _last_use_index;
+
+ std::unique_ptr<CreateTabletIdxCache> _create_tablet_idx_lru_cache;
+
+ DISALLOW_COPY_AND_ASSIGN(StorageEngine);
Review Comment:
warning: prefer deleting copy constructor and assignment operator over using macro 'DISALLOW_COPY_AND_ASSIGN' [modernize-replace-disallow-copy-and-assign-macro]
```suggestion
StorageEngine(const StorageEngine &) = delete;
const StorageEngine &operator=(const StorageEngine &) = delete;
```
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "deardeng (via GitHub)" <gi...@apache.org>.
deardeng commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1455373565
##########
be/src/olap/storage_engine.cpp:
##########
@@ -448,45 +450,89 @@ Status StorageEngine::set_cluster_id(int32_t cluster_id) {
return Status::OK();
}
+StorageEngine::Disk_remaining_level get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent <= 1);
+ if (disk_usage_percent < 0.7) {
+ return StorageEngine::Disk_remaining_level::LOW;
+ } else if (disk_usage_percent < 0.85) {
+ return StorageEngine::Disk_remaining_level::MID;
+ }
+ return StorageEngine::Disk_remaining_level::HIGH;
+}
+
std::vector<DataDir*> StorageEngine::get_stores_for_create_tablet(
- TStorageMedium::type storage_medium) {
+ int64 partition_id, TStorageMedium::type storage_medium) {
+ struct DirInfo {
Review Comment:
fixed
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1895811097
<details>
<summary>ClickBench: <b>Total hot run time: 29.77 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 0117897080a5afd224af5c639da644aeb9f323e0, data reload: false
query1 0.03 0.02 0.02
query2 0.06 0.02 0.02
query3 0.23 0.05 0.05
query4 1.69 0.11 0.10
query5 0.53 0.53 0.52
query6 1.28 0.64 0.62
query7 0.02 0.01 0.01
query8 0.03 0.02 0.02
query9 0.56 0.50 0.49
query10 0.56 0.55 0.55
query11 0.13 0.09 0.09
query12 0.11 0.10 0.09
query13 0.59 0.60 0.59
query14 0.77 0.79 0.78
query15 0.80 0.77 0.77
query16 0.37 0.38 0.37
query17 1.02 1.03 0.99
query18 0.24 0.24 0.26
query19 1.78 1.81 1.78
query20 0.01 0.01 0.01
query21 15.39 0.57 0.56
query22 2.82 2.17 1.16
query23 16.90 0.75 0.74
query24 2.74 0.71 1.07
query25 0.42 0.21 0.14
query26 0.41 0.14 0.13
query27 0.06 0.05 0.05
query28 11.62 0.76 0.76
query29 12.49 3.15 3.11
query30 0.52 0.48 0.47
query31 2.78 0.33 0.35
query32 3.38 0.48 0.49
query33 3.23 3.26 3.22
query34 15.96 4.24 4.21
query35 4.29 4.25 4.25
query36 1.11 1.08 1.09
query37 0.07 0.05 0.05
query38 0.04 0.03 0.03
query39 0.02 0.02 0.02
query40 0.16 0.13 0.13
query41 0.08 0.01 0.01
query42 0.02 0.01 0.02
query43 0.03 0.01 0.02
Total cold run time: 105.35 s
Total hot run time: 29.77 s
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "yujun777 (via GitHub)" <gi...@apache.org>.
yujun777 commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1447360734
##########
be/src/olap/storage_engine.cpp:
##########
@@ -448,45 +449,85 @@ Status StorageEngine::set_cluster_id(int32_t cluster_id) {
return Status::OK();
}
+StorageEngine::Disk_remaining_level get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent >= 0 && disk_usage_percent <= 1);
+ if (disk_usage_percent < 0.7) {
+ return StorageEngine::Disk_remaining_level::LOW;
+ } else if (disk_usage_percent < 0.85) {
+ return StorageEngine::Disk_remaining_level::MID;
+ } else {
+ return StorageEngine::Disk_remaining_level::HIGH;
+ }
+ return StorageEngine::Disk_remaining_level::LOW;
Review Comment:
delete unreachable code ?
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "yujun777 (via GitHub)" <gi...@apache.org>.
yujun777 commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1447367554
##########
be/src/olap/storage_engine.cpp:
##########
@@ -448,45 +449,85 @@ Status StorageEngine::set_cluster_id(int32_t cluster_id) {
return Status::OK();
}
+StorageEngine::Disk_remaining_level get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent >= 0 && disk_usage_percent <= 1);
+ if (disk_usage_percent < 0.7) {
+ return StorageEngine::Disk_remaining_level::LOW;
+ } else if (disk_usage_percent < 0.85) {
+ return StorageEngine::Disk_remaining_level::MID;
+ } else {
+ return StorageEngine::Disk_remaining_level::HIGH;
+ }
+ return StorageEngine::Disk_remaining_level::LOW;
+}
+
std::vector<DataDir*> StorageEngine::get_stores_for_create_tablet(
TStorageMedium::type storage_medium) {
+ struct DirInfo {
+ DataDir* data_dir;
+
+ StorageEngine::Disk_remaining_level available_level;
+
+ bool operator<(const DirInfo& other) {
+ if (available_level != other.available_level) {
+ return available_level < other.available_level;
+ }
+ return data_dir->path_hash() < other.data_dir->path_hash();
+ }
+ };
+
+ std::vector<DirInfo> dir_infos;
+ int next_index = 0;
+
std::vector<DataDir*> stores;
{
std::lock_guard<std::mutex> l(_store_lock);
+ if (_store_next_index.find(storage_medium) == _store_next_index.end()) {
+ _store_next_index[storage_medium] = rand() % 100;
+ }
+
+ next_index = _store_next_index[storage_medium]++;
+ if (next_index < 0) {
+ next_index = 0;
+ _store_next_index[storage_medium] = next_index + 1;
+ }
+
for (auto& it : _store_map) {
- if (it.second->is_used()) {
+ DataDir* data_dir = it.second;
+ if (data_dir->is_used()) {
if ((_available_storage_medium_type_count == 1 ||
- it.second->storage_medium() == storage_medium) &&
- !it.second->reach_capacity_limit(0)) {
- stores.push_back(it.second);
+ data_dir->storage_medium() == storage_medium) &&
+ !data_dir->reach_capacity_limit(0)) {
+ size_t disk_available = data_dir->disk_available();
+ DirInfo dir_info;
+ dir_info.data_dir = data_dir;
+ dir_info.available_level = get_available_level(disk_available);
Review Comment:
disk_available is the free capacity in bytes in range [0, +00). but get_available_level's input arg is disk usage in [0, 1]
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "yujun777 (via GitHub)" <gi...@apache.org>.
yujun777 commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1447365520
##########
be/src/olap/storage_engine.cpp:
##########
@@ -448,45 +449,85 @@ Status StorageEngine::set_cluster_id(int32_t cluster_id) {
return Status::OK();
}
+StorageEngine::Disk_remaining_level get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent >= 0 && disk_usage_percent <= 1);
Review Comment:
when be restart, and fe send create rpc to be, will disk_usage_percent < 0 ?
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1896039681
<details>
<summary>TPC-DS: <b>Total hot run time: 176999 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit b1efa83e31f24276e2df92b99440dae41ead7d2b, data reload: false
query1 938 335 333 333
query2 6551 2039 1857 1857
query3 6693 201 203 201
query4 33151 22276 22298 22276
query5 6897 528 522 522
query6 260 179 177 177
query7 4619 268 260 260
query8 226 173 179 173
query9 8348 2599 2590 2590
query10 415 227 226 226
query11 17135 15639 15485 15485
query12 121 68 70 68
query13 1710 377 374 374
query14 10456 6855 6844 6844
query15 211 183 188 183
query16 4601 237 224 224
query17 997 493 464 464
query18 1798 259 258 258
query19 175 134 138 134
query20 76 80 70 70
query21 195 122 132 122
query22 4995 4870 4744 4744
query23 31924 31038 30750 30750
query24 12737 2778 2799 2778
query25 568 312 307 307
query26 1796 140 153 140
query27 3435 265 270 265
query28 7555 1844 1847 1844
query29 2168 616 623 616
query30 278 141 138 138
query31 944 735 751 735
query32 73 59 50 50
query33 709 213 222 213
query34 1315 446 452 446
query35 889 770 772 770
query36 1289 1188 1089 1089
query37 177 58 61 58
query38 3355 3244 3260 3244
query39 1311 1274 1259 1259
query40 346 85 84 84
query41 37 36 35 35
query42 91 84 84 84
query43 514 473 486 473
query44 1082 698 723 698
query45 204 181 178 178
query46 1090 636 635 635
query47 1637 1570 1536 1536
query48 412 318 315 315
query49 1218 289 287 287
query50 667 322 308 308
query51 5279 5152 5174 5152
query52 96 72 72 72
query53 327 261 256 256
query54 889 438 457 438
query55 82 79 80 79
query56 183 167 175 167
query57 974 942 964 942
query58 185 164 177 164
query59 2951 2678 2752 2678
query60 209 180 185 180
query61 85 82 89 82
query62 630 366 351 351
query63 284 263 268 263
query64 6096 1766 1729 1729
query65 3332 3243 3257 3243
query66 1426 325 306 306
query67 15715 15375 15190 15190
query68 9910 517 543 517
query69 586 320 300 300
query70 1719 1485 1499 1485
query71 512 211 202 202
query72 4285 2776 2828 2776
query73 2001 310 304 304
query74 7007 6413 6462 6413
query75 4494 2353 2310 2310
query76 5899 1052 1039 1039
query77 627 232 247 232
query78 8991 8834 8706 8706
query79 999 497 490 490
query80 711 324 306 306
query81 460 220 205 205
query82 224 83 80 80
query83 173 124 117 117
query84 280 69 70 69
query85 1082 336 303 303
query86 389 390 377 377
query87 3542 3356 3331 3331
query88 3129 2165 2173 2165
query89 410 345 345 345
query90 2031 186 183 183
query91 156 127 130 127
query92 53 47 45 45
query93 1424 437 442 437
query94 1148 162 158 158
query95 507 458 447 447
query96 609 306 303 303
query97 4254 4157 4121 4121
query98 206 191 202 191
query99 1074 712 703 703
Total cold run time: 296024 ms
Total hot run time: 176999 ms
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "deardeng (via GitHub)" <gi...@apache.org>.
deardeng commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1895661180
run buildall
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1897801307
Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Load test result on commit d2b1498bd198451f5fd324ee1e17fc2721401f34 with default session variables
Stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
Stream load orc: 58 seconds loaded 1101869774 Bytes, about 18 MB/s
Stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
Insert into select: 14.8 seconds inserted 10000000 Rows, about 675K ops/s
```
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "yujun777 (via GitHub)" <gi...@apache.org>.
yujun777 commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1449804495
##########
be/src/olap/storage_engine.cpp:
##########
@@ -448,45 +450,89 @@ Status StorageEngine::set_cluster_id(int32_t cluster_id) {
return Status::OK();
}
+StorageEngine::Disk_remaining_level get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent <= 1);
+ if (disk_usage_percent < 0.7) {
+ return StorageEngine::Disk_remaining_level::LOW;
+ } else if (disk_usage_percent < 0.85) {
+ return StorageEngine::Disk_remaining_level::MID;
+ }
+ return StorageEngine::Disk_remaining_level::HIGH;
+}
+
std::vector<DataDir*> StorageEngine::get_stores_for_create_tablet(
- TStorageMedium::type storage_medium) {
+ int64 partition_id, TStorageMedium::type storage_medium) {
+ struct DirInfo {
+ DataDir* data_dir;
+
+ StorageEngine::Disk_remaining_level available_level;
+
+ bool operator<(const DirInfo& other) const {
+ if (available_level != other.available_level) {
+ return available_level < other.available_level;
+ }
+ return data_dir->path_hash() < other.data_dir->path_hash();
+ }
+ };
+
+ std::vector<DirInfo> dir_infos;
+ int curr_index = 0;
+
std::vector<DataDir*> stores;
{
std::lock_guard<std::mutex> l(_store_lock);
+
+ auto key = CreateTabletIdxCache::get_key(partition_id, storage_medium);
+ curr_index = _create_tablet_idx_lru_cache->get_index(key);
+ // -1, lru can't find key
+ if (curr_index == -1) {
+ auto init_num = rand() % 100;
+ curr_index = init_num;
+ _create_tablet_idx_lru_cache->set_index(key, init_num);
+ } else {
+ int64_t next_index = curr_index + 1;
+ // int64 overflow
+ if (next_index < 0) {
+ curr_index = 0;
+ }
+ _create_tablet_idx_lru_cache->set_index(key, next_index);
+ }
+
Review Comment:
```
curr_index = _create_tablet_idx_lru_cache->get_index(key);
// -1, lru can't find key
if (curr_index == -1) {
curr_index = std::max(0, _last_use_index[medium] + 1);
}
_last_use_index[medium] = curr_index;
_create_tablet_idx_lru_cache->set_index(key, std::max(0, curr_index + 1));
```
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1895781180
<details>
<summary>TPC-H: <b>Total hot run time: 39149 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 0117897080a5afd224af5c639da644aeb9f323e0, data reload: false
------ Round 1 ----------------------------------
q1 17655 5431 5334 5334
q2 2042 145 134 134
q3 10783 1175 1149 1149
q4 10392 766 817 766
q5 7797 3187 3159 3159
q6 196 120 120 120
q7 853 498 490 490
q8 9242 1967 1980 1967
q9 7306 6425 6366 6366
q10 8224 3077 3075 3075
q11 413 204 212 204
q12 352 192 193 192
q13 18005 3365 3369 3365
q14 248 215 218 215
q15 548 515 506 506
q16 429 379 368 368
q17 942 535 508 508
q18 7432 6930 6890 6890
q19 2622 1335 1409 1335
q20 611 283 290 283
q21 2774 2407 2423 2407
q22 358 316 316 316
Total cold run time: 109224 ms
Total hot run time: 39149 ms
----- Round 2, with runtime_filter_mode=off -----
q1 5496 5310 5278 5278
q2 335 225 220 220
q3 3350 3240 3263 3240
q4 2100 2031 2040 2031
q5 6024 5964 5816 5816
q6 208 118 115 115
q7 2347 1926 1924 1924
q8 3231 3372 3412 3372
q9 8921 8946 8798 8798
q10 3923 3841 3869 3841
q11 565 434 445 434
q12 826 630 638 630
q13 16923 3147 3124 3124
q14 290 271 267 267
q15 553 503 495 495
q16 516 460 481 460
q17 1920 1846 1823 1823
q18 9576 9360 9074 9074
q19 22725 1566 1516 1516
q20 4580 1937 1936 1936
q21 14075 5384 5377 5377
q22 937 517 551 517
Total cold run time: 109421 ms
Total hot run time: 60288 ms
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1897784609
<details>
<summary>TPC-H: <b>Total hot run time: 38874 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit d2b1498bd198451f5fd324ee1e17fc2721401f34, data reload: false
------ Round 1 ----------------------------------
q1 17795 5516 5251 5251
q2 2048 141 133 133
q3 10783 1154 1175 1154
q4 10379 764 835 764
q5 7773 3225 3166 3166
q6 202 120 121 120
q7 882 491 488 488
q8 9235 1979 1990 1979
q9 7704 6394 6348 6348
q10 8209 3144 3075 3075
q11 413 216 210 210
q12 355 192 196 192
q13 17994 3370 3375 3370
q14 249 211 212 211
q15 549 516 504 504
q16 432 371 368 368
q17 945 576 526 526
q18 7751 6993 6636 6636
q19 1546 1368 1376 1368
q20 568 297 297 297
q21 2773 2420 2453 2420
q22 375 303 294 294
Total cold run time: 108960 ms
Total hot run time: 38874 ms
----- Round 2, with runtime_filter_mode=off -----
q1 5377 5265 5125 5125
q2 332 220 214 214
q3 3375 3244 3237 3237
q4 2128 2108 2064 2064
q5 6083 6004 5952 5952
q6 195 117 117 117
q7 2236 1917 1920 1917
q8 3245 3374 3385 3374
q9 9008 8950 8922 8922
q10 3933 3863 3894 3863
q11 564 462 459 459
q12 859 636 613 613
q13 16911 3178 3145 3145
q14 292 264 269 264
q15 550 509 504 504
q16 514 470 470 470
q17 2046 1785 1842 1785
q18 9719 16740 9845 9845
q19 23099 1594 1532 1532
q20 4561 1945 1947 1945
q21 14484 5545 5419 5419
q22 973 510 528 510
Total cold run time: 110484 ms
Total hot run time: 61276 ms
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1897788196
TeamCity be ut coverage result:
Function Coverage: 36.69% (8658/23598)
Line Coverage: 28.75% (70690/245882)
Region Coverage: 27.64% (36465/131944)
Branch Coverage: 24.35% (18655/76614)
Coverage Report: http://coverage.selectdb-in.cc/coverage/d2b1498bd198451f5fd324ee1e17fc2721401f34_d2b1498bd198451f5fd324ee1e17fc2721401f34/report/index.html
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1896051184
<details>
<summary>ClickBench: <b>Total hot run time: 30.6 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit b1efa83e31f24276e2df92b99440dae41ead7d2b, data reload: false
query1 0.03 0.03 0.03
query2 0.05 0.02 0.02
query3 0.22 0.04 0.05
query4 1.72 0.07 0.08
query5 0.53 0.52 0.52
query6 1.26 0.64 0.63
query7 0.01 0.01 0.01
query8 0.04 0.03 0.02
query9 0.55 0.51 0.48
query10 0.56 0.57 0.57
query11 0.11 0.09 0.09
query12 0.12 0.09 0.09
query13 0.60 0.61 0.59
query14 0.78 0.78 0.78
query15 0.79 0.77 0.77
query16 0.38 0.38 0.38
query17 0.99 1.00 1.01
query18 0.22 0.26 0.25
query19 1.85 1.79 1.77
query20 0.01 0.01 0.02
query21 15.43 0.60 0.58
query22 2.54 2.65 1.71
query23 17.25 0.77 0.84
query24 2.42 0.79 1.30
query25 0.37 0.17 0.24
query26 0.53 0.14 0.13
query27 0.04 0.06 0.05
query28 11.57 0.76 0.76
query29 12.55 3.25 3.26
query30 0.57 0.50 0.49
query31 2.78 0.35 0.35
query32 3.38 0.48 0.49
query33 3.29 3.25 3.24
query34 16.00 4.27 4.17
query35 4.33 4.21 4.26
query36 1.11 1.06 1.08
query37 0.06 0.05 0.05
query38 0.03 0.03 0.03
query39 0.02 0.02 0.02
query40 0.16 0.13 0.14
query41 0.07 0.01 0.02
query42 0.02 0.01 0.01
query43 0.03 0.02 0.02
Total cold run time: 105.37 s
Total hot run time: 30.6 s
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1450059347
##########
be/src/olap/data_dir.cpp:
##########
@@ -891,6 +891,10 @@ void DataDir::update_remote_data_size(int64_t size) {
disks_remote_used_capacity->set_value(size);
}
+size_t DataDir::disk_available() const {
+ return _available_bytes;
+}
Review Comment:
available_bytes() is a better name.
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1450089374
##########
be/src/olap/storage_engine.cpp:
##########
@@ -448,45 +450,89 @@ Status StorageEngine::set_cluster_id(int32_t cluster_id) {
return Status::OK();
}
+StorageEngine::Disk_remaining_level get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent <= 1);
+ if (disk_usage_percent < 0.7) {
+ return StorageEngine::Disk_remaining_level::LOW;
+ } else if (disk_usage_percent < 0.85) {
+ return StorageEngine::Disk_remaining_level::MID;
+ }
+ return StorageEngine::Disk_remaining_level::HIGH;
+}
+
std::vector<DataDir*> StorageEngine::get_stores_for_create_tablet(
- TStorageMedium::type storage_medium) {
+ int64 partition_id, TStorageMedium::type storage_medium) {
+ struct DirInfo {
Review Comment:
A too long function.
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1897896982
PR approved by anyone and no changes requested.
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1896054035
TeamCity be ut coverage result:
Function Coverage: 36.68% (8656/23596)
Line Coverage: 28.74% (70664/245890)
Region Coverage: 27.62% (36447/131945)
Branch Coverage: 24.33% (18643/76612)
Coverage Report: http://coverage.selectdb-in.cc/coverage/b1efa83e31f24276e2df92b99440dae41ead7d2b_b1efa83e31f24276e2df92b99440dae41ead7d2b/report/index.html
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1455604782
##########
be/src/olap/storage_engine.cpp:
##########
@@ -430,46 +435,80 @@ Status StorageEngine::set_cluster_id(int32_t cluster_id) {
return Status::OK();
}
+StorageEngine::DiskRemainingLevel get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent <= 1);
+ if (disk_usage_percent < 0.7) {
+ return StorageEngine::DiskRemainingLevel::LOW;
+ } else if (disk_usage_percent < 0.85) {
+ return StorageEngine::DiskRemainingLevel::MID;
+ }
+ return StorageEngine::DiskRemainingLevel::HIGH;
+}
+
+int StorageEngine::_get_and_set_next_disk_index(int64 partition_id,
Review Comment:
warning: method '_get_and_set_next_disk_index' can be made static [readability-convert-member-functions-to-static]
```suggestion
static int StorageEngine::_get_and_set_next_disk_index(int64 partition_id,
```
##########
be/src/olap/storage_engine.h:
##########
@@ -328,36 +334,12 @@ class StorageEngine {
void _decrease_low_priority_task_nums(DataDir* dir);
-private:
- struct CompactionCandidate {
- CompactionCandidate(uint32_t nicumulative_compaction_, int64_t tablet_id_, uint32_t index_)
- : nice(nicumulative_compaction_), tablet_id(tablet_id_), disk_index(index_) {}
- uint32_t nice; // priority
- int64_t tablet_id;
- uint32_t disk_index = -1;
- };
-
- // In descending order
- struct CompactionCandidateComparator {
- bool operator()(const CompactionCandidate& a, const CompactionCandidate& b) {
- return a.nice > b.nice;
- }
- };
+ void _get_candidate_stores(TStorageMedium::type storage_medium,
+ std::vector<DirInfo>& dir_infos);
- struct CompactionDiskStat {
- CompactionDiskStat(std::string path, uint32_t index, bool used)
- : storage_path(path),
- disk_index(index),
- task_running(0),
- task_remaining(0),
- is_used(used) {}
- const std::string storage_path;
- const uint32_t disk_index;
- uint32_t task_running;
- uint32_t task_remaining;
- bool is_used;
- };
+ int _get_and_set_next_disk_index(int64 partition_id, TStorageMedium::type storage_medium);
+private:
Review Comment:
warning: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]
```suggestion
```
<details>
<summary>Additional context</summary>
**be/src/olap/storage_engine.h:231:** previously declared here
```cpp
private:
^
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "yujun777 (via GitHub)" <gi...@apache.org>.
yujun777 commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1447374343
##########
be/src/olap/storage_engine.cpp:
##########
@@ -448,45 +449,85 @@
return Status::OK();
}
+StorageEngine::Disk_remaining_level get_available_level(double disk_usage_percent) {
+ assert(disk_usage_percent >= 0 && disk_usage_percent <= 1);
+ if (disk_usage_percent < 0.7) {
+ return StorageEngine::Disk_remaining_level::LOW;
+ } else if (disk_usage_percent < 0.85) {
+ return StorageEngine::Disk_remaining_level::MID;
+ } else {
+ return StorageEngine::Disk_remaining_level::HIGH;
+ }
+ return StorageEngine::Disk_remaining_level::LOW;
+}
+
std::vector<DataDir*> StorageEngine::get_stores_for_create_tablet(
TStorageMedium::type storage_medium) {
+ struct DirInfo {
+ DataDir* data_dir;
+
+ StorageEngine::Disk_remaining_level available_level;
+
+ bool operator<(const DirInfo& other) {
Review Comment:
use ‘bool operator<(const DirInfo& other) const’.
if missing the last const, clang will compile failed
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "cambyzju (via GitHub)" <gi...@apache.org>.
cambyzju commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1449760593
##########
be/src/olap/storage_engine.h:
##########
@@ -492,7 +496,65 @@ class StorageEngine {
std::atomic<bool> _need_clean_trash {false};
+ std::unique_ptr<CreateTabletIdxCache> _create_tablet_idx_lru_cache;
+
DISALLOW_COPY_AND_ASSIGN(StorageEngine);
};
+// lru cache for create tabelt round robin in disks
+// key: partitionId_medium
+// value: index
+class CreateTabletIdxCache : public LRUCachePolicy {
+public:
+ // get key, delimiter with DELIMITER '-'
+ static std::string get_key(int64_t partition_id, TStorageMedium::type medium) {
+ return fmt::format("{}-{}", partition_id, medium);
+ }
+
+ // -1 not found key in lru
+ int64 get_index(const std::string& key) {
+ if (key.empty()) {
+ return {};
+ }
+ 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 set_index(const std::string& key, int next_idx) {
+ assert(next_idx >= 0);
+ if (key.empty()) {
+ return;
+ }
+ 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;
+ delete cache_value;
+ };
+ auto lru_handle =
+ cache()->insert(key, value, 1, deleter, CachePriority::NORMAL, sizeof(int64));
+ cache()->release(lru_handle);
+ }
+
+ struct CacheValue : public LRUCacheValueBase {
+ int64 idx = 0;
+ };
+
+ CreateTabletIdxCache(size_t capacity)
+ : LRUCachePolicy(CachePolicy::CacheType::CREATE_TABLET_RR_IDX_CACHE, capacity,
+ LRUCacheType::NUMBER,
+ /*stale_sweep_time_s*/ 30 * 60) {}
+
+private:
+ static constexpr char DELIMITER = '-';
Review Comment:
unused variable `DELIMITER`
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1895801536
<details>
<summary>TPC-DS: <b>Total hot run time: 176330 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 0117897080a5afd224af5c639da644aeb9f323e0, data reload: false
query1 928 336 327 327
query2 6574 1913 1954 1913
query3 6703 200 199 199
query4 31279 22044 22020 22020
query5 6857 605 595 595
query6 256 177 164 164
query7 4594 258 258 258
query8 225 173 179 173
query9 8373 2588 2565 2565
query10 427 239 234 234
query11 16662 15585 15440 15440
query12 123 66 67 66
query13 1699 386 371 371
query14 10477 6821 6864 6821
query15 205 175 181 175
query16 4597 232 225 225
query17 996 473 472 472
query18 1779 262 251 251
query19 170 140 135 135
query20 72 71 64 64
query21 191 130 137 130
query22 4976 4894 4587 4587
query23 31596 30736 30893 30736
query24 12431 2861 2795 2795
query25 569 304 304 304
query26 1766 141 138 138
query27 3223 267 267 267
query28 7289 1804 1811 1804
query29 1767 648 632 632
query30 279 139 139 139
query31 938 745 752 745
query32 74 50 49 49
query33 696 205 205 205
query34 1160 460 455 455
query35 918 766 730 730
query36 1353 1257 1162 1162
query37 91 57 59 57
query38 3351 3242 3251 3242
query39 1317 1268 1263 1263
query40 343 86 81 81
query41 37 34 34 34
query42 89 81 83 81
query43 518 479 494 479
query44 1127 690 686 686
query45 197 182 184 182
query46 1075 655 636 636
query47 1672 1554 1510 1510
query48 396 306 311 306
query49 1168 280 277 277
query50 688 322 316 316
query51 5390 5213 5203 5203
query52 84 82 79 79
query53 323 251 254 251
query54 883 431 446 431
query55 78 80 69 69
query56 170 164 155 155
query57 1003 952 930 930
query58 199 159 160 159
query59 2958 2672 2687 2672
query60 221 191 186 186
query61 85 84 90 84
query62 667 388 393 388
query63 282 260 253 253
query64 6115 1779 1762 1762
query65 3364 3260 3234 3234
query66 1255 320 315 315
query67 15595 15196 14906 14906
query68 13188 521 494 494
query69 622 294 293 293
query70 1972 1507 1575 1507
query71 557 207 216 207
query72 4873 2783 2803 2783
query73 3317 313 310 310
query74 7348 6334 6389 6334
query75 5179 2364 2321 2321
query76 6146 1076 1121 1076
query77 718 235 232 232
query78 9368 8808 8665 8665
query79 2435 480 492 480
query80 541 322 317 317
query81 445 199 204 199
query82 205 79 81 79
query83 168 124 115 115
query84 271 68 68 68
query85 1097 324 314 314
query86 389 395 383 383
query87 3579 3345 3325 3325
query88 3093 2156 2157 2156
query89 427 352 341 341
query90 2095 184 183 183
query91 157 125 133 125
query92 55 43 42 42
query93 1350 425 415 415
query94 1281 162 161 161
query95 499 461 463 461
query96 616 307 315 307
query97 4268 4155 4151 4151
query98 212 197 184 184
query99 1059 729 732 729
Total cold run time: 300493 ms
Total hot run time: 176330 ms
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1895812767
TeamCity be ut coverage result:
Function Coverage: 36.69% (8656/23593)
Line Coverage: 28.75% (70680/245866)
Region Coverage: 27.63% (36453/131931)
Branch Coverage: 24.35% (18654/76604)
Coverage Report: http://coverage.selectdb-in.cc/coverage/0117897080a5afd224af5c639da644aeb9f323e0_0117897080a5afd224af5c639da644aeb9f323e0/report/index.html
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1896057754
Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
```
Load test result on commit b1efa83e31f24276e2df92b99440dae41ead7d2b with default session variables
Stream load json: 19 seconds loaded 2358488459 Bytes, about 118 MB/s
Stream load orc: 58 seconds loaded 1101869774 Bytes, about 18 MB/s
Stream load parquet: 31 seconds loaded 861443392 Bytes, about 26 MB/s
Insert into select: 14.1 seconds inserted 10000000 Rows, about 709K ops/s
```
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1897793012
<details>
<summary>TPC-DS: <b>Total hot run time: 176873 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit d2b1498bd198451f5fd324ee1e17fc2721401f34, data reload: false
query1 934 333 329 329
query2 6573 2008 1916 1916
query3 6697 196 197 196
query4 32366 22119 22137 22119
query5 6870 525 522 522
query6 254 168 171 168
query7 4600 258 267 258
query8 226 174 189 174
query9 8400 2579 2556 2556
query10 423 217 212 212
query11 16692 15434 15505 15434
query12 120 67 65 65
query13 1675 384 395 384
query14 10509 7005 6904 6904
query15 208 184 186 184
query16 4600 233 223 223
query17 999 474 478 474
query18 1781 255 264 255
query19 168 140 131 131
query20 70 71 65 65
query21 188 130 129 129
query22 4916 4842 4743 4743
query23 31463 30959 30999 30959
query24 11579 2803 2821 2803
query25 574 306 306 306
query26 1657 143 145 143
query27 3219 268 266 266
query28 7239 1853 1861 1853
query29 1706 625 608 608
query30 284 138 141 138
query31 913 732 741 732
query32 81 57 51 51
query33 703 215 214 214
query34 1146 446 463 446
query35 856 777 762 762
query36 1372 1256 1221 1221
query37 93 63 59 59
query38 3322 3228 3198 3198
query39 1319 1279 1275 1275
query40 339 89 88 88
query41 37 35 34 34
query42 87 79 86 79
query43 534 467 473 467
query44 1048 679 695 679
query45 195 176 173 173
query46 1075 634 656 634
query47 1659 1525 1600 1525
query48 400 308 320 308
query49 1199 288 286 286
query50 692 309 297 297
query51 5295 5176 5105 5105
query52 94 75 75 75
query53 325 256 265 256
query54 893 434 444 434
query55 79 78 78 78
query56 177 166 165 165
query57 1010 932 919 919
query58 184 167 156 156
query59 3029 2678 2732 2678
query60 212 193 180 180
query61 84 81 82 81
query62 632 364 358 358
query63 290 255 263 255
query64 5968 1764 1719 1719
query65 3346 3266 3246 3246
query66 1231 319 312 312
query67 15600 15286 15079 15079
query68 10008 522 524 522
query69 604 318 304 304
query70 1692 1542 1566 1542
query71 533 213 206 206
query72 4660 2831 2825 2825
query73 1955 311 323 311
query74 7026 6405 6397 6397
query75 4625 2341 2287 2287
query76 6134 1039 966 966
query77 654 234 242 234
query78 9074 8953 8605 8605
query79 1002 490 498 490
query80 551 327 313 313
query81 449 202 206 202
query82 208 82 77 77
query83 140 117 119 117
query84 278 71 73 71
query85 1035 315 315 315
query86 389 387 377 377
query87 3474 3330 3354 3330
query88 3361 2165 2165 2165
query89 395 350 360 350
query90 1984 192 182 182
query91 151 121 131 121
query92 50 44 44 44
query93 2024 437 448 437
query94 1165 162 157 157
query95 491 455 453 453
query96 622 309 316 309
query97 4272 4133 4138 4133
query98 199 203 187 187
query99 1100 718 703 703
Total cold run time: 292814 ms
Total hot run time: 176873 ms
```
</details>
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #29818:
URL: https://github.com/apache/doris/pull/29818#issuecomment-1897896943
PR approved by at least one committer and no changes requested.
--
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
Re: [PR] [improvement](create tablet) backend create tablet round robin among … [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #29818:
URL: https://github.com/apache/doris/pull/29818#discussion_r1448957872
##########
be/src/olap/storage_engine.h:
##########
@@ -492,7 +496,65 @@ class StorageEngine {
std::atomic<bool> _need_clean_trash {false};
+ std::unique_ptr<CreateTabletIdxCache> _create_tablet_idx_lru_cache;
+
DISALLOW_COPY_AND_ASSIGN(StorageEngine);
};
+// lru cache for create tabelt round robin in disks
+// key: partitionId_medium
+// value: index
+class CreateTabletIdxCache : public LRUCachePolicy {
+public:
+ // get key, delimiter with DELIMITER '-'
+ static std::string get_key(int64_t partition_id, TStorageMedium::type medium) {
+ return fmt::format("{}-{}", partition_id, medium);
+ }
+
+ // -1 not found key in lru
+ int64 get_index(const std::string& key) {
+ if (key.empty()) {
+ return {};
+ }
+ 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 set_index(const std::string& key, int next_idx) {
+ assert(next_idx >= 0);
+ if (key.empty()) {
+ return;
+ }
+ CacheValue* value = new CacheValue;
Review Comment:
warning: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto]
```suggestion
auto* value = new CacheValue;
```
##########
be/src/olap/storage_engine.h:
##########
@@ -492,7 +496,65 @@
std::atomic<bool> _need_clean_trash {false};
+ std::unique_ptr<CreateTabletIdxCache> _create_tablet_idx_lru_cache;
+
DISALLOW_COPY_AND_ASSIGN(StorageEngine);
};
+// lru cache for create tabelt round robin in disks
+// key: partitionId_medium
+// value: index
+class CreateTabletIdxCache : public LRUCachePolicy {
+public:
+ // get key, delimiter with DELIMITER '-'
+ static std::string get_key(int64_t partition_id, TStorageMedium::type medium) {
+ return fmt::format("{}-{}", partition_id, medium);
+ }
+
+ // -1 not found key in lru
+ int64 get_index(const std::string& key) {
+ if (key.empty()) {
+ return {};
+ }
+ 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 set_index(const std::string& key, int next_idx) {
+ assert(next_idx >= 0);
+ if (key.empty()) {
+ return;
+ }
+ 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
auto* cache_value = (CacheValue*)value;
```
--
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