/root/doris/cloud/src/recycler/util.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | |
20 | | #include <fmt/core.h> |
21 | | #include <gen_cpp/cloud.pb.h> |
22 | | #include <glog/logging.h> |
23 | | |
24 | | #include <string> |
25 | | |
26 | | #include "common/defer.h" |
27 | | |
28 | | namespace doris::cloud { |
29 | | |
30 | | // The time unit is the same with BE: us |
31 | | #define SCOPED_BVAR_LATENCY(bvar_item) \ |
32 | 3 | StopWatch sw; \ |
33 | 3 | DORIS_CLOUD_DEFER { \ |
34 | 3 | bvar_item << sw.elapsed_us(); \ |
35 | 3 | }; Unexecuted instantiation: azure_obj_client.cpp:_ZZZZN5doris5cloud14AzureObjClient10put_objectENS0_20ObjectStoragePathRefESt17basic_string_viewIcSt11char_traitsIcEEENK3$_0clEvENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: azure_obj_client.cpp:_ZZZN5doris5cloud14AzureObjClient11head_objectENS0_20ObjectStoragePathRefEPNS0_10ObjectMetaEENK3$_0clEvENKUlvE_clEv Unexecuted instantiation: _ZZZN5doris5cloud17AzureListIterator8has_nextEvENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: azure_obj_client.cpp:_ZZZZN5doris5cloud14AzureObjClient14delete_objectsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS7_SaIS7_EENS0_16ObjClientOptionsEENK3$_0clEvENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: azure_obj_client.cpp:_ZZZZN5doris5cloud14AzureObjClient13delete_objectENS0_20ObjectStoragePathRefEENK3$_0clEvENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: s3_obj_client.cpp:_ZZZZN5doris5cloud11S3ObjClient14delete_objectsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS7_SaIS7_EENS0_16ObjClientOptionsEENK3$_0clESA_IN3Aws2S35Model16ObjectIdentifierESaISI_EEENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: s3_obj_client.cpp:_ZZZN5doris5cloud11S3ObjClient10put_objectENS0_20ObjectStoragePathRefESt17basic_string_viewIcSt11char_traitsIcEEENK3$_0clEvENKUlvE_clEv s3_obj_client.cpp:_ZZZN5doris5cloud11S3ObjClient11head_objectENS0_20ObjectStoragePathRefEPNS0_10ObjectMetaEENK3$_0clEvENKUlvE_clEv Line | Count | Source | 33 | 1 | DORIS_CLOUD_DEFER { \ | 34 | 1 | bvar_item << sw.elapsed_us(); \ | 35 | 1 | }; |
_ZZZN5doris5cloud17S3ObjListIterator8has_nextEvENKUlvE_clEvENKUlvE_clEv Line | Count | Source | 33 | 2 | DORIS_CLOUD_DEFER { \ | 34 | 2 | bvar_item << sw.elapsed_us(); \ | 35 | 2 | }; |
Unexecuted instantiation: s3_obj_client.cpp:_ZZZN5doris5cloud11S3ObjClient13delete_objectENS0_20ObjectStoragePathRefEENK3$_0clEvENKUlvE_clEv Unexecuted instantiation: hdfs_accessor.cpp:_ZZN5doris5cloud12HdfsAccessor11delete_fileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEENK3$_0clEv Unexecuted instantiation: hdfs_accessor.cpp:_ZZN5doris5cloud12HdfsAccessor8put_fileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_ENK3$_0clEv Unexecuted instantiation: hdfs_accessor.cpp:_ZZZN5doris5cloud12HdfsAccessor8put_fileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_ENK3$_1clEvENKUlvE_clEv Unexecuted instantiation: hdfs_accessor.cpp:_ZZN5doris5cloud12HdfsAccessor8put_fileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_ENK3$_2clEv Unexecuted instantiation: hdfs_accessor.cpp:_ZZN5doris5cloud12HdfsAccessor8put_fileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_ENK3$_3clEv Unexecuted instantiation: _ZZN5doris5cloud16HdfsListIterator14list_directoryEPKcENKUlvE_clEv Unexecuted instantiation: hdfs_accessor.cpp:_ZZN5doris5cloud12HdfsAccessor6existsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEENK3$_0clEv |
36 | | |
37 | | class TxnKv; |
38 | | |
39 | | /** |
40 | | * Get all instances, include DELETED instance |
41 | | * @return 0 for success, otherwise error |
42 | | */ |
43 | | int get_all_instances(TxnKv* txn_kv, std::vector<InstanceInfoPB>& res); |
44 | | |
45 | | /** |
46 | | * |
47 | | * @return 0 for success |
48 | | */ |
49 | | int prepare_instance_recycle_job(TxnKv* txn_kv, std::string_view key, |
50 | | const std::string& instance_id, const std::string& ip_port, |
51 | | int64_t interval_ms); |
52 | | |
53 | | void finish_instance_recycle_job(TxnKv* txn_kv, std::string_view key, |
54 | | const std::string& instance_id, const std::string& ip_port, |
55 | | bool success, int64_t ctime_ms); |
56 | | |
57 | | /** |
58 | | * |
59 | | * @return 0 for success, 1 if job should be aborted, negative for other errors |
60 | | */ |
61 | | int lease_instance_recycle_job(TxnKv* txn_kv, std::string_view key, const std::string& instance_id, |
62 | | const std::string& ip_port); |
63 | | |
64 | | inline std::string segment_path(int64_t tablet_id, const std::string& rowset_id, |
65 | 177k | int64_t segment_id) { |
66 | 177k | return fmt::format("data/{}/{}_{}.dat", tablet_id, rowset_id, segment_id); |
67 | 177k | } |
68 | | |
69 | | inline std::string inverted_index_path_v2(int64_t tablet_id, const std::string& rowset_id, |
70 | 5.00k | int64_t segment_id) { |
71 | 5.00k | return fmt::format("data/{}/{}_{}.idx", tablet_id, rowset_id, segment_id); |
72 | 5.00k | } |
73 | | |
74 | | inline std::string inverted_index_path_v1(int64_t tablet_id, const std::string& rowset_id, |
75 | | int64_t segment_id, int64_t index_id, |
76 | 305k | std::string_view index_path_suffix) { |
77 | 305k | std::string suffix = |
78 | 305k | index_path_suffix.empty() ? "" : std::string {"@"} + index_path_suffix.data(); |
79 | 305k | return fmt::format("data/{}/{}_{}_{}{}.idx", tablet_id, rowset_id, segment_id, index_id, |
80 | 305k | suffix); |
81 | 305k | } |
82 | | |
83 | 2.91k | inline std::string rowset_path_prefix(int64_t tablet_id, const std::string& rowset_id) { |
84 | 2.91k | return fmt::format("data/{}/{}_", tablet_id, rowset_id); |
85 | 2.91k | } |
86 | | |
87 | 739 | inline std::string tablet_path_prefix(int64_t tablet_id) { |
88 | 739 | return fmt::format("data/{}/", tablet_id); |
89 | 739 | } |
90 | | |
91 | | int get_tablet_idx(TxnKv* txn_kv, const std::string& instance_id, int64_t tablet_id, |
92 | | TabletIndexPB& tablet_idx); |
93 | | |
94 | | int get_tablet_meta(TxnKv* txn_kv, const std::string& instance_id, int64_t tablet_id, |
95 | | TabletMetaCloudPB& tablet_meta); |
96 | | } // namespace doris::cloud |