/root/doris/be/src/cloud/pb_convert.cpp
Line | Count | Source |
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 | | #include "cloud/pb_convert.h" |
19 | | |
20 | | #include <common/logging.h> |
21 | | #include <gen_cpp/olap_file.pb.h> |
22 | | |
23 | | #include <utility> |
24 | | |
25 | | namespace doris::cloud { |
26 | | #include "common/compile_check_begin.h" |
27 | | |
28 | 0 | RowsetMetaCloudPB doris_rowset_meta_to_cloud(const RowsetMetaPB& in) { |
29 | 0 | RowsetMetaCloudPB out; |
30 | 0 | doris_rowset_meta_to_cloud(&out, in); |
31 | 0 | return out; |
32 | 0 | } |
33 | | |
34 | 58 | RowsetMetaCloudPB doris_rowset_meta_to_cloud(RowsetMetaPB&& in) { |
35 | 58 | RowsetMetaCloudPB out; |
36 | 58 | doris_rowset_meta_to_cloud(&out, std::move(in)); |
37 | 58 | return out; |
38 | 58 | } |
39 | | |
40 | 4 | void doris_rowset_meta_to_cloud(RowsetMetaCloudPB* out, const RowsetMetaPB& in) { |
41 | | // ATTN: please keep the set order aligned with the definition of proto `TabletSchemaCloudPB`. |
42 | 4 | out->set_rowset_id(in.rowset_id()); |
43 | 4 | out->set_partition_id(in.partition_id()); |
44 | 4 | out->set_tablet_id(in.tablet_id()); |
45 | 4 | out->set_txn_id(in.txn_id()); |
46 | 4 | out->set_tablet_schema_hash(in.tablet_schema_hash()); |
47 | 4 | out->set_rowset_type(in.rowset_type()); |
48 | 4 | out->set_rowset_state(in.rowset_state()); |
49 | 4 | out->set_start_version(in.start_version()); |
50 | 4 | out->set_end_version(in.end_version()); |
51 | 4 | out->set_version_hash(in.version_hash()); |
52 | 4 | out->set_num_rows(in.num_rows()); |
53 | 4 | out->set_total_disk_size(in.total_disk_size()); |
54 | 4 | out->set_data_disk_size(in.data_disk_size()); |
55 | 4 | out->set_index_disk_size(in.index_disk_size()); |
56 | 4 | out->mutable_zone_maps()->CopyFrom(in.zone_maps()); |
57 | 4 | if (in.has_delete_predicate()) { |
58 | 1 | out->mutable_delete_predicate()->CopyFrom(in.delete_predicate()); |
59 | 1 | } |
60 | 4 | out->set_empty(in.empty()); |
61 | 4 | if (in.has_load_id()) { |
62 | 1 | out->mutable_load_id()->CopyFrom(in.load_id()); |
63 | 1 | } |
64 | 4 | out->set_delete_flag(in.delete_flag()); |
65 | 4 | out->set_creation_time(in.creation_time()); |
66 | 4 | if (in.has_tablet_uid()) { |
67 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
68 | 1 | } |
69 | 4 | out->set_num_segments(in.num_segments()); |
70 | 4 | out->set_rowset_id_v2(in.rowset_id_v2()); |
71 | 4 | out->set_resource_id(in.resource_id()); |
72 | 4 | out->set_newest_write_timestamp(in.newest_write_timestamp()); |
73 | 4 | out->mutable_segments_key_bounds()->CopyFrom(in.segments_key_bounds()); |
74 | 4 | if (in.has_tablet_schema()) { |
75 | 1 | doris_tablet_schema_to_cloud(out->mutable_tablet_schema(), in.tablet_schema()); |
76 | 1 | } |
77 | 4 | if (in.has_schema_dict_key_list()) { |
78 | 1 | out->mutable_schema_dict_key_list()->CopyFrom(in.schema_dict_key_list()); |
79 | 1 | } |
80 | 4 | out->set_txn_expiration(in.txn_expiration()); |
81 | 4 | out->set_segments_overlap_pb(in.segments_overlap_pb()); |
82 | 4 | out->set_segments_key_bounds_truncated(in.segments_key_bounds_truncated()); |
83 | 4 | out->mutable_segments_file_size()->CopyFrom(in.segments_file_size()); |
84 | 4 | out->set_index_id(in.index_id()); |
85 | 4 | if (in.has_schema_version()) { |
86 | | // See cloud/src/meta-service/meta_service_schema.cpp for details. |
87 | 1 | out->set_schema_version(in.schema_version()); |
88 | 1 | } |
89 | 4 | out->set_enable_segments_file_size(in.enable_segments_file_size()); |
90 | 4 | out->set_has_variant_type_in_schema(in.has_variant_type_in_schema()); |
91 | 4 | out->set_enable_inverted_index_file_info(in.enable_inverted_index_file_info()); |
92 | 4 | out->set_compaction_level(in.compaction_level()); |
93 | 4 | out->mutable_inverted_index_file_info()->CopyFrom(in.inverted_index_file_info()); |
94 | 4 | out->set_source_rowset_id(in.source_rowset_id()); |
95 | 4 | out->set_source_tablet_id(in.source_tablet_id()); |
96 | 4 | if (in.has___split_schema()) { |
97 | 1 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
98 | 1 | } |
99 | 4 | if (in.has_visible_ts_ms()) { |
100 | 1 | out->set_visible_ts_ms(in.visible_ts_ms()); |
101 | 1 | } |
102 | 4 | if (in.has_reference_instance_id()) { |
103 | 1 | out->set_reference_instance_id(in.reference_instance_id()); |
104 | 1 | } |
105 | 4 | auto* slice_locations = out->mutable_packed_slice_locations(); |
106 | 4 | slice_locations->clear(); |
107 | 4 | slice_locations->insert(in.packed_slice_locations().begin(), in.packed_slice_locations().end()); |
108 | 4 | } |
109 | | |
110 | 61 | void doris_rowset_meta_to_cloud(RowsetMetaCloudPB* out, RowsetMetaPB&& in) { |
111 | | // ATTN: please keep the set order aligned with the definition of proto `TabletSchemaCloudPB`. |
112 | 61 | out->set_rowset_id(in.rowset_id()); |
113 | 61 | out->set_partition_id(in.partition_id()); |
114 | 61 | out->set_tablet_id(in.tablet_id()); |
115 | 61 | out->set_txn_id(in.txn_id()); |
116 | 61 | out->set_tablet_schema_hash(in.tablet_schema_hash()); |
117 | 61 | out->set_rowset_type(in.rowset_type()); |
118 | 61 | out->set_rowset_state(in.rowset_state()); |
119 | 61 | out->set_start_version(in.start_version()); |
120 | 61 | out->set_end_version(in.end_version()); |
121 | 61 | out->set_version_hash(in.version_hash()); |
122 | 61 | out->set_num_rows(in.num_rows()); |
123 | 61 | out->set_total_disk_size(in.total_disk_size()); |
124 | 61 | out->set_data_disk_size(in.data_disk_size()); |
125 | 61 | out->set_index_disk_size(in.index_disk_size()); |
126 | 61 | out->mutable_zone_maps()->Swap(in.mutable_zone_maps()); |
127 | 61 | if (in.has_delete_predicate()) { |
128 | 2 | out->mutable_delete_predicate()->Swap(in.mutable_delete_predicate()); |
129 | 2 | } |
130 | 61 | out->set_empty(in.empty()); |
131 | 61 | if (in.has_load_id()) { |
132 | 4 | out->mutable_load_id()->CopyFrom(in.load_id()); |
133 | 4 | } |
134 | 61 | out->set_delete_flag(in.delete_flag()); |
135 | 61 | out->set_creation_time(in.creation_time()); |
136 | 61 | if (in.has_tablet_uid()) { |
137 | 2 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
138 | 2 | } |
139 | 61 | out->set_num_segments(in.num_segments()); |
140 | 61 | out->set_rowset_id_v2(in.rowset_id_v2()); |
141 | 61 | out->set_resource_id(in.resource_id()); |
142 | 61 | out->set_newest_write_timestamp(in.newest_write_timestamp()); |
143 | 61 | out->mutable_segments_key_bounds()->Swap(in.mutable_segments_key_bounds()); |
144 | 61 | if (in.has_tablet_schema()) { |
145 | 2 | doris_tablet_schema_to_cloud(out->mutable_tablet_schema(), |
146 | 2 | std::move(*in.mutable_tablet_schema())); |
147 | 2 | } |
148 | 61 | if (in.has_schema_dict_key_list()) { |
149 | 2 | out->mutable_schema_dict_key_list()->Swap(in.mutable_schema_dict_key_list()); |
150 | 2 | } |
151 | 61 | out->set_txn_expiration(in.txn_expiration()); |
152 | 61 | out->set_segments_overlap_pb(in.segments_overlap_pb()); |
153 | 61 | out->set_segments_key_bounds_truncated(in.segments_key_bounds_truncated()); |
154 | 61 | out->mutable_segments_file_size()->Swap(in.mutable_segments_file_size()); |
155 | 61 | out->set_index_id(in.index_id()); |
156 | 61 | if (in.has_schema_version()) { |
157 | | // See cloud/src/meta-service/meta_service_schema.cpp for details. |
158 | 2 | out->set_schema_version(in.schema_version()); |
159 | 2 | } |
160 | 61 | out->set_enable_segments_file_size(in.enable_segments_file_size()); |
161 | 61 | out->set_has_variant_type_in_schema(in.has_variant_type_in_schema()); |
162 | 61 | out->set_enable_inverted_index_file_info(in.enable_inverted_index_file_info()); |
163 | 61 | out->set_compaction_level(in.compaction_level()); |
164 | 61 | out->mutable_inverted_index_file_info()->Swap(in.mutable_inverted_index_file_info()); |
165 | 61 | out->set_source_rowset_id(in.source_rowset_id()); |
166 | 61 | out->set_source_tablet_id(in.source_tablet_id()); |
167 | | |
168 | 61 | if (in.has___split_schema()) { |
169 | 2 | out->mutable___split_schema()->Swap(in.mutable___split_schema()); |
170 | 2 | } |
171 | 61 | if (in.has_visible_ts_ms()) { |
172 | 2 | out->set_visible_ts_ms(in.visible_ts_ms()); |
173 | 2 | } |
174 | 61 | if (in.has_reference_instance_id()) { |
175 | 2 | out->set_reference_instance_id(in.reference_instance_id()); |
176 | 2 | } |
177 | 61 | auto* slice_locations = out->mutable_packed_slice_locations(); |
178 | 61 | slice_locations->clear(); |
179 | 61 | slice_locations->insert(in.packed_slice_locations().begin(), in.packed_slice_locations().end()); |
180 | 61 | } |
181 | | |
182 | 0 | RowsetMetaPB cloud_rowset_meta_to_doris(const RowsetMetaCloudPB& in) { |
183 | 0 | RowsetMetaPB out; |
184 | 0 | cloud_rowset_meta_to_doris(&out, in); |
185 | 0 | return out; |
186 | 0 | } |
187 | | |
188 | 2 | RowsetMetaPB cloud_rowset_meta_to_doris(RowsetMetaCloudPB&& in) { |
189 | 2 | RowsetMetaPB out; |
190 | 2 | cloud_rowset_meta_to_doris(&out, std::move(in)); |
191 | 2 | return out; |
192 | 2 | } |
193 | | |
194 | 4 | void cloud_rowset_meta_to_doris(RowsetMetaPB* out, const RowsetMetaCloudPB& in) { |
195 | | // ATTN: please keep the set order aligned with the definition of proto `TabletSchemaCloudPB`. |
196 | 4 | out->set_rowset_id(in.rowset_id()); |
197 | 4 | out->set_partition_id(in.partition_id()); |
198 | 4 | out->set_tablet_id(in.tablet_id()); |
199 | 4 | out->set_txn_id(in.txn_id()); |
200 | 4 | out->set_tablet_schema_hash(in.tablet_schema_hash()); |
201 | 4 | out->set_rowset_type(in.rowset_type()); |
202 | 4 | out->set_rowset_state(in.rowset_state()); |
203 | 4 | out->set_start_version(in.start_version()); |
204 | 4 | out->set_end_version(in.end_version()); |
205 | 4 | out->set_version_hash(in.version_hash()); |
206 | 4 | out->set_num_rows(in.num_rows()); |
207 | 4 | out->set_total_disk_size(in.total_disk_size()); |
208 | 4 | out->set_data_disk_size(in.data_disk_size()); |
209 | 4 | out->set_index_disk_size(in.index_disk_size()); |
210 | 4 | out->mutable_zone_maps()->CopyFrom(in.zone_maps()); |
211 | 4 | if (in.has_delete_predicate()) { |
212 | 1 | out->mutable_delete_predicate()->CopyFrom(in.delete_predicate()); |
213 | 1 | } |
214 | 4 | out->set_empty(in.empty()); |
215 | 4 | if (in.has_load_id()) { |
216 | 1 | out->mutable_load_id()->CopyFrom(in.load_id()); |
217 | 1 | } |
218 | 4 | out->set_delete_flag(in.delete_flag()); |
219 | 4 | out->set_creation_time(in.creation_time()); |
220 | 4 | if (in.has_tablet_uid()) { |
221 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
222 | 1 | } |
223 | 4 | out->set_num_segments(in.num_segments()); |
224 | 4 | out->set_rowset_id_v2(in.rowset_id_v2()); |
225 | 4 | out->set_resource_id(in.resource_id()); |
226 | 4 | out->set_newest_write_timestamp(in.newest_write_timestamp()); |
227 | 4 | out->mutable_segments_key_bounds()->CopyFrom(in.segments_key_bounds()); |
228 | 4 | if (in.has_tablet_schema()) { |
229 | 1 | cloud_tablet_schema_to_doris(out->mutable_tablet_schema(), in.tablet_schema()); |
230 | 1 | } |
231 | 4 | if (in.has_schema_dict_key_list()) { |
232 | 1 | out->mutable_schema_dict_key_list()->CopyFrom(in.schema_dict_key_list()); |
233 | 1 | } |
234 | 4 | out->set_txn_expiration(in.txn_expiration()); |
235 | 4 | out->set_segments_overlap_pb(in.segments_overlap_pb()); |
236 | 4 | out->set_segments_key_bounds_truncated(in.segments_key_bounds_truncated()); |
237 | 4 | out->mutable_segments_file_size()->CopyFrom(in.segments_file_size()); |
238 | 4 | out->set_index_id(in.index_id()); |
239 | 4 | if (in.has_schema_version()) { |
240 | | // See cloud/src/meta-service/meta_service_schema.cpp for details. |
241 | 1 | out->set_schema_version(in.schema_version()); |
242 | 1 | } |
243 | 4 | out->set_enable_segments_file_size(in.enable_segments_file_size()); |
244 | 4 | out->set_has_variant_type_in_schema(in.has_variant_type_in_schema()); |
245 | 4 | out->set_enable_inverted_index_file_info(in.enable_inverted_index_file_info()); |
246 | 4 | out->set_compaction_level(in.compaction_level()); |
247 | 4 | out->mutable_inverted_index_file_info()->CopyFrom(in.inverted_index_file_info()); |
248 | 4 | out->set_source_rowset_id(in.source_rowset_id()); |
249 | 4 | out->set_source_tablet_id(in.source_tablet_id()); |
250 | 4 | if (in.has___split_schema()) { |
251 | 1 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
252 | 1 | } |
253 | 4 | if (in.has_visible_ts_ms()) { |
254 | 1 | out->set_visible_ts_ms(in.visible_ts_ms()); |
255 | 1 | } |
256 | 4 | if (in.has_reference_instance_id()) { |
257 | 1 | out->set_reference_instance_id(in.reference_instance_id()); |
258 | 1 | } |
259 | 4 | auto* slice_locations = out->mutable_packed_slice_locations(); |
260 | 4 | slice_locations->clear(); |
261 | 4 | slice_locations->insert(in.packed_slice_locations().begin(), in.packed_slice_locations().end()); |
262 | 4 | } |
263 | | |
264 | 5 | void cloud_rowset_meta_to_doris(RowsetMetaPB* out, RowsetMetaCloudPB&& in) { |
265 | | // ATTN: please keep the set order aligned with the definition of proto `TabletSchemaCloudPB`. |
266 | 5 | out->set_rowset_id(in.rowset_id()); |
267 | 5 | out->set_partition_id(in.partition_id()); |
268 | 5 | out->set_tablet_id(in.tablet_id()); |
269 | 5 | out->set_txn_id(in.txn_id()); |
270 | 5 | out->set_tablet_schema_hash(in.tablet_schema_hash()); |
271 | 5 | out->set_rowset_type(in.rowset_type()); |
272 | 5 | out->set_rowset_state(in.rowset_state()); |
273 | 5 | out->set_start_version(in.start_version()); |
274 | 5 | out->set_end_version(in.end_version()); |
275 | 5 | out->set_version_hash(in.version_hash()); |
276 | 5 | out->set_num_rows(in.num_rows()); |
277 | 5 | out->set_total_disk_size(in.total_disk_size()); |
278 | 5 | out->set_data_disk_size(in.data_disk_size()); |
279 | 5 | out->set_index_disk_size(in.index_disk_size()); |
280 | 5 | out->mutable_zone_maps()->Swap(in.mutable_zone_maps()); |
281 | 5 | if (in.has_delete_predicate()) { |
282 | 2 | out->mutable_delete_predicate()->Swap(in.mutable_delete_predicate()); |
283 | 2 | } |
284 | 5 | out->set_empty(in.empty()); |
285 | 5 | if (in.has_load_id()) { |
286 | 2 | out->mutable_load_id()->CopyFrom(in.load_id()); |
287 | 2 | } |
288 | 5 | out->set_delete_flag(in.delete_flag()); |
289 | 5 | out->set_creation_time(in.creation_time()); |
290 | 5 | if (in.has_tablet_uid()) { |
291 | 2 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
292 | 2 | } |
293 | 5 | out->set_num_segments(in.num_segments()); |
294 | 5 | out->set_rowset_id_v2(in.rowset_id_v2()); |
295 | 5 | out->set_resource_id(in.resource_id()); |
296 | 5 | out->set_newest_write_timestamp(in.newest_write_timestamp()); |
297 | 5 | out->mutable_segments_key_bounds()->Swap(in.mutable_segments_key_bounds()); |
298 | 5 | if (in.has_tablet_schema()) { |
299 | 2 | cloud_tablet_schema_to_doris(out->mutable_tablet_schema(), |
300 | 2 | std::move(*in.mutable_tablet_schema())); |
301 | 2 | } |
302 | 5 | if (in.has_schema_dict_key_list()) { |
303 | 2 | out->mutable_schema_dict_key_list()->Swap(in.mutable_schema_dict_key_list()); |
304 | 2 | } |
305 | 5 | out->set_txn_expiration(in.txn_expiration()); |
306 | 5 | out->set_segments_overlap_pb(in.segments_overlap_pb()); |
307 | 5 | out->set_segments_key_bounds_truncated(in.segments_key_bounds_truncated()); |
308 | 5 | out->mutable_segments_file_size()->Swap(in.mutable_segments_file_size()); |
309 | 5 | out->set_index_id(in.index_id()); |
310 | 5 | if (in.has_schema_version()) { |
311 | | // See cloud/src/meta-service/meta_service_schema.cpp for details. |
312 | 2 | out->set_schema_version(in.schema_version()); |
313 | 2 | } |
314 | 5 | out->set_enable_segments_file_size(in.enable_segments_file_size()); |
315 | 5 | out->set_has_variant_type_in_schema(in.has_variant_type_in_schema()); |
316 | 5 | out->set_enable_inverted_index_file_info(in.enable_inverted_index_file_info()); |
317 | 5 | out->set_compaction_level(in.compaction_level()); |
318 | 5 | out->mutable_inverted_index_file_info()->Swap(in.mutable_inverted_index_file_info()); |
319 | 5 | out->set_source_rowset_id(in.source_rowset_id()); |
320 | 5 | out->set_source_tablet_id(in.source_tablet_id()); |
321 | 5 | if (in.has___split_schema()) { |
322 | 2 | out->mutable___split_schema()->Swap(in.mutable___split_schema()); |
323 | 2 | } |
324 | 5 | if (in.has_visible_ts_ms()) { |
325 | 2 | out->set_visible_ts_ms(in.visible_ts_ms()); |
326 | 2 | } |
327 | 5 | if (in.has_reference_instance_id()) { |
328 | 2 | out->set_reference_instance_id(in.reference_instance_id()); |
329 | 2 | } |
330 | 5 | auto* slice_locations = out->mutable_packed_slice_locations(); |
331 | 5 | slice_locations->clear(); |
332 | 5 | slice_locations->insert(in.packed_slice_locations().begin(), in.packed_slice_locations().end()); |
333 | 5 | } |
334 | | |
335 | 0 | TabletSchemaCloudPB doris_tablet_schema_to_cloud(const TabletSchemaPB& in) { |
336 | 0 | TabletSchemaCloudPB out; |
337 | 0 | doris_tablet_schema_to_cloud(&out, in); |
338 | 0 | return out; |
339 | 0 | } |
340 | | |
341 | 2 | TabletSchemaCloudPB doris_tablet_schema_to_cloud(TabletSchemaPB&& in) { |
342 | | // ATTN: please keep the set order aligned with the definition of proto. |
343 | 2 | TabletSchemaCloudPB out; |
344 | 2 | doris_tablet_schema_to_cloud(&out, std::move(in)); |
345 | 2 | return out; |
346 | 2 | } |
347 | | |
348 | 3 | void doris_tablet_schema_to_cloud(TabletSchemaCloudPB* out, const TabletSchemaPB& in) { |
349 | | // ATTN: please keep the set order aligned with the definition of proto. |
350 | 3 | out->set_keys_type(in.keys_type()); |
351 | 3 | out->mutable_column()->CopyFrom(in.column()); |
352 | 3 | out->set_num_short_key_columns(in.num_short_key_columns()); |
353 | 3 | out->set_num_rows_per_row_block(in.num_rows_per_row_block()); |
354 | 3 | out->set_compress_kind(in.compress_kind()); |
355 | 3 | out->set_bf_fpp(in.bf_fpp()); |
356 | 3 | out->set_next_column_unique_id(in.next_column_unique_id()); |
357 | 3 | out->set_delete_sign_idx(in.delete_sign_idx()); |
358 | 3 | out->set_sequence_col_idx(in.sequence_col_idx()); |
359 | 3 | out->set_sort_type(in.sort_type()); |
360 | 3 | out->set_sort_col_num(in.sort_col_num()); |
361 | 3 | out->set_compression_type(in.compression_type()); |
362 | 3 | out->set_schema_version(in.schema_version()); |
363 | 3 | out->set_disable_auto_compaction(in.disable_auto_compaction()); |
364 | 3 | out->mutable_index()->CopyFrom(in.index()); |
365 | 3 | out->set_version_col_idx(in.version_col_idx()); |
366 | 3 | out->set_store_row_column(in.store_row_column()); |
367 | 3 | out->set_enable_single_replica_compaction(in.enable_single_replica_compaction()); |
368 | 3 | out->set_skip_write_index_on_load(in.skip_write_index_on_load()); |
369 | 3 | out->mutable_cluster_key_uids()->CopyFrom(in.cluster_key_uids()); |
370 | 3 | out->set_is_dynamic_schema(in.is_dynamic_schema()); |
371 | 3 | out->set_is_external_segment_column_meta_used(in.is_external_segment_column_meta_used()); |
372 | 3 | out->mutable_row_store_column_unique_ids()->CopyFrom(in.row_store_column_unique_ids()); |
373 | 3 | out->set_inverted_index_storage_format(in.inverted_index_storage_format()); |
374 | 3 | out->set_enable_variant_flatten_nested(in.enable_variant_flatten_nested()); |
375 | 3 | out->set_skip_bitmap_col_idx(in.skip_bitmap_col_idx()); |
376 | 3 | out->set_storage_page_size(in.storage_page_size()); |
377 | 3 | out->set_storage_dict_page_size(in.storage_dict_page_size()); |
378 | 3 | out->set_is_in_memory(in.is_in_memory()); |
379 | 3 | out->set_row_store_page_size(in.row_store_page_size()); |
380 | | |
381 | 3 | if (in.has___split_schema()) { |
382 | 3 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
383 | 3 | } |
384 | 3 | } |
385 | | |
386 | 5 | void doris_tablet_schema_to_cloud(TabletSchemaCloudPB* out, TabletSchemaPB&& in) { |
387 | 5 | out->set_keys_type(in.keys_type()); |
388 | 5 | out->mutable_column()->Swap(in.mutable_column()); |
389 | 5 | out->set_num_short_key_columns(in.num_short_key_columns()); |
390 | 5 | out->set_num_rows_per_row_block(in.num_rows_per_row_block()); |
391 | 5 | out->set_compress_kind(in.compress_kind()); |
392 | 5 | out->set_bf_fpp(in.bf_fpp()); |
393 | 5 | out->set_next_column_unique_id(in.next_column_unique_id()); |
394 | 5 | out->set_delete_sign_idx(in.delete_sign_idx()); |
395 | 5 | out->set_sequence_col_idx(in.sequence_col_idx()); |
396 | 5 | out->set_sort_type(in.sort_type()); |
397 | 5 | out->set_sort_col_num(in.sort_col_num()); |
398 | 5 | out->set_compression_type(in.compression_type()); |
399 | 5 | out->set_schema_version(in.schema_version()); |
400 | 5 | out->set_disable_auto_compaction(in.disable_auto_compaction()); |
401 | 5 | out->mutable_index()->Swap(in.mutable_index()); |
402 | 5 | out->set_version_col_idx(in.version_col_idx()); |
403 | 5 | out->set_store_row_column(in.store_row_column()); |
404 | 5 | out->set_enable_single_replica_compaction(in.enable_single_replica_compaction()); |
405 | 5 | out->set_skip_write_index_on_load(in.skip_write_index_on_load()); |
406 | 5 | out->mutable_cluster_key_uids()->Swap(in.mutable_cluster_key_uids()); |
407 | 5 | out->set_is_dynamic_schema(in.is_dynamic_schema()); |
408 | 5 | out->set_is_external_segment_column_meta_used(in.is_external_segment_column_meta_used()); |
409 | 5 | out->mutable_row_store_column_unique_ids()->Swap(in.mutable_row_store_column_unique_ids()); |
410 | 5 | out->set_inverted_index_storage_format(in.inverted_index_storage_format()); |
411 | 5 | out->set_enable_variant_flatten_nested(in.enable_variant_flatten_nested()); |
412 | 5 | out->set_skip_bitmap_col_idx(in.skip_bitmap_col_idx()); |
413 | 5 | out->set_storage_page_size(in.storage_page_size()); |
414 | 5 | out->set_storage_dict_page_size(in.storage_dict_page_size()); |
415 | 5 | out->set_is_in_memory(in.is_in_memory()); |
416 | 5 | out->set_row_store_page_size(in.row_store_page_size()); |
417 | | |
418 | 5 | if (in.has___split_schema()) { |
419 | 5 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
420 | 5 | } |
421 | 5 | } |
422 | | |
423 | 0 | TabletSchemaPB cloud_tablet_schema_to_doris(const TabletSchemaCloudPB& in) { |
424 | 0 | TabletSchemaPB out; |
425 | 0 | cloud_tablet_schema_to_doris(&out, in); |
426 | 0 | return out; |
427 | 0 | } |
428 | | |
429 | 2 | TabletSchemaPB cloud_tablet_schema_to_doris(TabletSchemaCloudPB&& in) { |
430 | 2 | TabletSchemaPB out; |
431 | 2 | cloud_tablet_schema_to_doris(&out, std::move(in)); |
432 | 2 | return out; |
433 | 2 | } |
434 | | |
435 | 3 | void cloud_tablet_schema_to_doris(TabletSchemaPB* out, const TabletSchemaCloudPB& in) { |
436 | | // ATTN: please keep the set order aligned with the definition of proto. |
437 | 3 | out->set_keys_type(in.keys_type()); |
438 | 3 | out->mutable_column()->CopyFrom(in.column()); |
439 | 3 | out->set_num_short_key_columns(in.num_short_key_columns()); |
440 | 3 | out->set_num_rows_per_row_block(in.num_rows_per_row_block()); |
441 | 3 | out->set_compress_kind(in.compress_kind()); |
442 | 3 | out->set_bf_fpp(in.bf_fpp()); |
443 | 3 | out->set_next_column_unique_id(in.next_column_unique_id()); |
444 | 3 | out->set_delete_sign_idx(in.delete_sign_idx()); |
445 | 3 | out->set_sequence_col_idx(in.sequence_col_idx()); |
446 | 3 | out->set_sort_type(in.sort_type()); |
447 | 3 | out->set_sort_col_num(in.sort_col_num()); |
448 | 3 | out->set_compression_type(in.compression_type()); |
449 | 3 | out->set_schema_version(in.schema_version()); |
450 | 3 | out->set_disable_auto_compaction(in.disable_auto_compaction()); |
451 | 3 | out->mutable_index()->CopyFrom(in.index()); |
452 | 3 | out->set_version_col_idx(in.version_col_idx()); |
453 | 3 | out->set_store_row_column(in.store_row_column()); |
454 | 3 | out->set_enable_single_replica_compaction(in.enable_single_replica_compaction()); |
455 | 3 | out->set_skip_write_index_on_load(in.skip_write_index_on_load()); |
456 | 3 | out->mutable_cluster_key_uids()->CopyFrom(in.cluster_key_uids()); |
457 | 3 | out->set_is_dynamic_schema(in.is_dynamic_schema()); |
458 | 3 | out->set_is_external_segment_column_meta_used(in.is_external_segment_column_meta_used()); |
459 | 3 | out->mutable_row_store_column_unique_ids()->CopyFrom(in.row_store_column_unique_ids()); |
460 | 3 | out->set_inverted_index_storage_format(in.inverted_index_storage_format()); |
461 | 3 | out->set_enable_variant_flatten_nested(in.enable_variant_flatten_nested()); |
462 | 3 | out->set_skip_bitmap_col_idx(in.skip_bitmap_col_idx()); |
463 | 3 | out->set_storage_page_size(in.storage_page_size()); |
464 | 3 | out->set_storage_dict_page_size(in.storage_dict_page_size()); |
465 | 3 | out->set_is_in_memory(in.is_in_memory()); |
466 | 3 | out->set_row_store_page_size(in.row_store_page_size()); |
467 | | |
468 | 3 | if (in.has___split_schema()) { |
469 | 3 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
470 | 3 | } |
471 | 3 | } |
472 | | |
473 | 5 | void cloud_tablet_schema_to_doris(TabletSchemaPB* out, TabletSchemaCloudPB&& in) { |
474 | | // ATTN: please keep the set order aligned with the definition of proto. |
475 | 5 | out->set_keys_type(in.keys_type()); |
476 | 5 | out->mutable_column()->Swap(in.mutable_column()); |
477 | 5 | out->set_num_short_key_columns(in.num_short_key_columns()); |
478 | 5 | out->set_num_rows_per_row_block(in.num_rows_per_row_block()); |
479 | 5 | out->set_compress_kind(in.compress_kind()); |
480 | 5 | out->set_bf_fpp(in.bf_fpp()); |
481 | 5 | out->set_next_column_unique_id(in.next_column_unique_id()); |
482 | 5 | out->set_delete_sign_idx(in.delete_sign_idx()); |
483 | 5 | out->set_sequence_col_idx(in.sequence_col_idx()); |
484 | 5 | out->set_sort_type(in.sort_type()); |
485 | 5 | out->set_sort_col_num(in.sort_col_num()); |
486 | 5 | out->set_compression_type(in.compression_type()); |
487 | 5 | out->set_schema_version(in.schema_version()); |
488 | 5 | out->set_disable_auto_compaction(in.disable_auto_compaction()); |
489 | 5 | out->mutable_index()->Swap(in.mutable_index()); |
490 | 5 | out->set_version_col_idx(in.version_col_idx()); |
491 | 5 | out->set_store_row_column(in.store_row_column()); |
492 | 5 | out->set_enable_single_replica_compaction(in.enable_single_replica_compaction()); |
493 | 5 | out->set_skip_write_index_on_load(in.skip_write_index_on_load()); |
494 | 5 | out->mutable_cluster_key_uids()->Swap(in.mutable_cluster_key_uids()); |
495 | 5 | out->set_is_dynamic_schema(in.is_dynamic_schema()); |
496 | 5 | out->set_is_external_segment_column_meta_used(in.is_external_segment_column_meta_used()); |
497 | 5 | out->mutable_row_store_column_unique_ids()->Swap(in.mutable_row_store_column_unique_ids()); |
498 | 5 | out->set_inverted_index_storage_format(in.inverted_index_storage_format()); |
499 | 5 | out->set_enable_variant_flatten_nested(in.enable_variant_flatten_nested()); |
500 | 5 | out->set_skip_bitmap_col_idx(in.skip_bitmap_col_idx()); |
501 | 5 | out->set_storage_page_size(in.storage_page_size()); |
502 | 5 | out->set_storage_dict_page_size(in.storage_dict_page_size()); |
503 | 5 | out->set_is_in_memory(in.is_in_memory()); |
504 | 5 | out->set_row_store_page_size(in.row_store_page_size()); |
505 | | |
506 | 5 | if (in.has___split_schema()) { |
507 | 5 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
508 | 5 | } |
509 | 5 | } |
510 | | |
511 | 0 | TabletMetaCloudPB doris_tablet_meta_to_cloud(const TabletMetaPB& in) { |
512 | 0 | TabletMetaCloudPB out; |
513 | 0 | doris_tablet_meta_to_cloud(&out, in); |
514 | 0 | return out; |
515 | 0 | } |
516 | | |
517 | 1 | TabletMetaCloudPB doris_tablet_meta_to_cloud(TabletMetaPB&& in) { |
518 | 1 | TabletMetaCloudPB out; |
519 | 1 | doris_tablet_meta_to_cloud(&out, std::move(in)); |
520 | 1 | return out; |
521 | 1 | } |
522 | | |
523 | 1 | void doris_tablet_meta_to_cloud(TabletMetaCloudPB* out, const TabletMetaPB& in) { |
524 | | // ATTN: please keep the set order aligned with the definition of proto. |
525 | 1 | out->set_table_id(in.table_id()); |
526 | 1 | out->set_partition_id(in.partition_id()); |
527 | 1 | out->set_tablet_id(in.tablet_id()); |
528 | 1 | out->set_schema_hash(in.schema_hash()); |
529 | 1 | out->set_shard_id(in.shard_id()); |
530 | 1 | out->set_creation_time(in.creation_time()); |
531 | 1 | out->set_cumulative_layer_point(in.cumulative_layer_point()); |
532 | 1 | out->set_tablet_state(in.tablet_state()); |
533 | 1 | if (in.has_schema()) { |
534 | 1 | doris_tablet_schema_to_cloud(out->mutable_schema(), in.schema()); |
535 | 1 | } |
536 | 1 | if (in.rs_metas_size()) { |
537 | 1 | out->mutable_rs_metas()->Reserve(in.rs_metas_size()); |
538 | 1 | for (const auto& rs_meta : in.rs_metas()) { |
539 | 1 | doris_rowset_meta_to_cloud(out->add_rs_metas(), rs_meta); |
540 | 1 | } |
541 | 1 | } |
542 | | // ATTN: inc_rs_metas are deprecated, here is for conversion check |
543 | 1 | if (in.inc_rs_metas_size()) { |
544 | 1 | out->mutable_inc_rs_metas()->Reserve(in.inc_rs_metas_size()); |
545 | 1 | for (const auto& rs_meta : in.inc_rs_metas()) { |
546 | 1 | doris_rowset_meta_to_cloud(out->add_inc_rs_metas(), rs_meta); |
547 | 1 | } |
548 | 1 | } |
549 | 1 | if (in.has_alter_task()) { |
550 | 1 | out->mutable_alter_task()->CopyFrom(in.alter_task()); |
551 | 1 | } |
552 | 1 | out->set_in_restore_mode(in.in_restore_mode()); |
553 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
554 | 1 | out->set_end_rowset_id(in.end_rowset_id()); |
555 | 1 | out->set_preferred_rowset_type(in.preferred_rowset_type()); |
556 | 1 | out->set_tablet_type(in.tablet_type()); |
557 | 1 | if (in.stale_rs_metas_size()) { |
558 | 1 | out->mutable_stale_rs_metas()->Reserve(in.stale_rs_metas_size()); |
559 | 1 | for (const auto& rs_meta : in.stale_rs_metas()) { |
560 | 1 | doris_rowset_meta_to_cloud(out->add_stale_rs_metas(), rs_meta); |
561 | 1 | } |
562 | 1 | } |
563 | 1 | out->set_replica_id(in.replica_id()); |
564 | 1 | if (in.has_delete_bitmap()) { |
565 | 1 | out->mutable_delete_bitmap()->CopyFrom(in.delete_bitmap()); |
566 | 1 | } |
567 | 1 | out->set_enable_unique_key_merge_on_write(in.enable_unique_key_merge_on_write()); |
568 | 1 | out->set_storage_policy_id(in.storage_policy_id()); |
569 | 1 | out->mutable_cooldown_meta_id()->CopyFrom(in.cooldown_meta_id()); |
570 | 1 | if (in.has_binlog_config()) { |
571 | 1 | out->mutable_binlog_config()->CopyFrom(in.binlog_config()); |
572 | 1 | } |
573 | 1 | out->set_compaction_policy(in.compaction_policy()); |
574 | 1 | out->set_time_series_compaction_goal_size_mbytes(in.time_series_compaction_goal_size_mbytes()); |
575 | 1 | out->set_time_series_compaction_file_count_threshold( |
576 | 1 | in.time_series_compaction_file_count_threshold()); |
577 | 1 | out->set_time_series_compaction_time_threshold_seconds( |
578 | 1 | in.time_series_compaction_time_threshold_seconds()); |
579 | 1 | out->set_time_series_compaction_empty_rowsets_threshold( |
580 | 1 | in.time_series_compaction_empty_rowsets_threshold()); |
581 | 1 | out->set_time_series_compaction_level_threshold(in.time_series_compaction_level_threshold()); |
582 | 1 | out->set_index_id(in.index_id()); |
583 | 1 | out->set_is_in_memory(in.is_in_memory()); |
584 | 1 | out->set_is_persistent(in.is_persistent()); |
585 | 1 | out->set_table_name(in.table_name()); |
586 | 1 | out->set_ttl_seconds(in.ttl_seconds()); |
587 | 1 | if (in.has_schema_version()) { |
588 | 1 | out->set_schema_version(in.schema_version()); |
589 | 1 | } |
590 | 1 | if (in.has_encryption_algorithm()) { |
591 | 1 | out->set_encryption_algorithm(in.encryption_algorithm()); |
592 | 1 | } |
593 | 1 | } |
594 | | |
595 | 1 | void doris_tablet_meta_to_cloud(TabletMetaCloudPB* out, TabletMetaPB&& in) { |
596 | | // ATTN: please keep the set order aligned with the definition of proto. |
597 | 1 | out->set_table_id(in.table_id()); |
598 | 1 | out->set_partition_id(in.partition_id()); |
599 | 1 | out->set_tablet_id(in.tablet_id()); |
600 | 1 | out->set_schema_hash(in.schema_hash()); |
601 | 1 | out->set_shard_id(in.shard_id()); |
602 | 1 | out->set_creation_time(in.creation_time()); |
603 | 1 | out->set_cumulative_layer_point(in.cumulative_layer_point()); |
604 | 1 | out->set_tablet_state(in.tablet_state()); |
605 | 1 | if (in.has_schema()) { |
606 | 1 | doris_tablet_schema_to_cloud(out->mutable_schema(), std::move(*in.mutable_schema())); |
607 | 1 | } |
608 | 1 | if (in.rs_metas_size()) { |
609 | 1 | int32_t rs_metas_size = in.rs_metas_size(); |
610 | 1 | out->mutable_rs_metas()->Reserve(rs_metas_size); |
611 | 2 | for (int i = 0; i < rs_metas_size; ++i) { |
612 | 1 | doris_rowset_meta_to_cloud(out->add_rs_metas(), std::move(*in.mutable_rs_metas(i))); |
613 | 1 | } |
614 | 1 | } |
615 | | // ATTN: inc_rs_metas are deprecated, here is for conversion check |
616 | 1 | if (in.inc_rs_metas_size()) { |
617 | 1 | int rs_metas_size = in.inc_rs_metas_size(); |
618 | 1 | out->mutable_inc_rs_metas()->Reserve(rs_metas_size); |
619 | 2 | for (int i = 0; i < rs_metas_size; ++i) { |
620 | 1 | doris_rowset_meta_to_cloud(out->add_inc_rs_metas(), |
621 | 1 | std::move(*in.mutable_inc_rs_metas(i))); |
622 | 1 | } |
623 | 1 | } |
624 | 1 | if (in.has_alter_task()) { |
625 | 1 | out->mutable_alter_task()->Swap(in.mutable_alter_task()); |
626 | 1 | } |
627 | 1 | out->set_in_restore_mode(in.in_restore_mode()); |
628 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
629 | 1 | out->set_end_rowset_id(in.end_rowset_id()); |
630 | 1 | out->set_preferred_rowset_type(in.preferred_rowset_type()); |
631 | 1 | out->set_tablet_type(in.tablet_type()); |
632 | 1 | if (in.stale_rs_metas_size()) { |
633 | 1 | int rs_metas_size = in.stale_rs_metas_size(); |
634 | 1 | out->mutable_stale_rs_metas()->Reserve(rs_metas_size); |
635 | 2 | for (int i = 0; i < rs_metas_size; i++) { |
636 | 1 | doris_rowset_meta_to_cloud(out->add_stale_rs_metas(), |
637 | 1 | std::move(*in.mutable_stale_rs_metas(i))); |
638 | 1 | } |
639 | 1 | } |
640 | 1 | out->set_replica_id(in.replica_id()); |
641 | 1 | if (in.has_delete_bitmap()) { |
642 | 1 | out->mutable_delete_bitmap()->Swap(in.mutable_delete_bitmap()); |
643 | 1 | } |
644 | 1 | out->set_enable_unique_key_merge_on_write(in.enable_unique_key_merge_on_write()); |
645 | 1 | out->set_storage_policy_id(in.storage_policy_id()); |
646 | 1 | out->mutable_cooldown_meta_id()->CopyFrom(in.cooldown_meta_id()); |
647 | 1 | if (in.has_binlog_config()) { |
648 | 1 | out->mutable_binlog_config()->Swap(in.mutable_binlog_config()); |
649 | 1 | } |
650 | 1 | out->set_compaction_policy(in.compaction_policy()); |
651 | 1 | out->set_time_series_compaction_goal_size_mbytes(in.time_series_compaction_goal_size_mbytes()); |
652 | 1 | out->set_time_series_compaction_file_count_threshold( |
653 | 1 | in.time_series_compaction_file_count_threshold()); |
654 | 1 | out->set_time_series_compaction_time_threshold_seconds( |
655 | 1 | in.time_series_compaction_time_threshold_seconds()); |
656 | 1 | out->set_time_series_compaction_empty_rowsets_threshold( |
657 | 1 | in.time_series_compaction_empty_rowsets_threshold()); |
658 | 1 | out->set_time_series_compaction_level_threshold(in.time_series_compaction_level_threshold()); |
659 | 1 | out->set_index_id(in.index_id()); |
660 | 1 | out->set_is_in_memory(in.is_in_memory()); |
661 | 1 | out->set_is_persistent(in.is_persistent()); |
662 | 1 | out->set_table_name(in.table_name()); |
663 | 1 | out->set_ttl_seconds(in.ttl_seconds()); |
664 | 1 | if (in.has_schema_version()) { |
665 | 1 | out->set_schema_version(in.schema_version()); |
666 | 1 | } |
667 | 1 | if (in.has_encryption_algorithm()) { |
668 | 1 | out->set_encryption_algorithm(in.encryption_algorithm()); |
669 | 1 | } |
670 | 1 | } |
671 | | |
672 | 0 | TabletMetaPB cloud_tablet_meta_to_doris(const TabletMetaCloudPB& in) { |
673 | 0 | TabletMetaPB out; |
674 | 0 | cloud_tablet_meta_to_doris(&out, in); |
675 | 0 | return out; |
676 | 0 | } |
677 | | |
678 | 1 | TabletMetaPB cloud_tablet_meta_to_doris(TabletMetaCloudPB&& in) { |
679 | 1 | TabletMetaPB out; |
680 | 1 | cloud_tablet_meta_to_doris(&out, std::move(in)); |
681 | 1 | return out; |
682 | 1 | } |
683 | | |
684 | 1 | void cloud_tablet_meta_to_doris(TabletMetaPB* out, const TabletMetaCloudPB& in) { |
685 | | // ATTN: please keep the set order aligned with the definition of proto. |
686 | 1 | out->set_table_id(in.table_id()); |
687 | 1 | out->set_partition_id(in.partition_id()); |
688 | 1 | out->set_tablet_id(in.tablet_id()); |
689 | 1 | out->set_schema_hash(in.schema_hash()); |
690 | 1 | out->set_shard_id(in.shard_id()); |
691 | 1 | out->set_creation_time(in.creation_time()); |
692 | 1 | out->set_cumulative_layer_point(in.cumulative_layer_point()); |
693 | 1 | out->set_tablet_state(in.tablet_state()); |
694 | 1 | if (in.has_schema()) { |
695 | 1 | cloud_tablet_schema_to_doris(out->mutable_schema(), in.schema()); |
696 | 1 | } |
697 | 1 | if (in.rs_metas_size()) { |
698 | 1 | out->mutable_rs_metas()->Reserve(in.rs_metas_size()); |
699 | 1 | for (const auto& rs_meta : in.rs_metas()) { |
700 | 1 | cloud_rowset_meta_to_doris(out->add_rs_metas(), rs_meta); |
701 | 1 | } |
702 | 1 | } |
703 | | // ATTN: inc_rs_metas are deprecated, here is for conversion check |
704 | 1 | if (in.inc_rs_metas_size()) { |
705 | 1 | out->mutable_inc_rs_metas()->Reserve(in.inc_rs_metas_size()); |
706 | 1 | for (const auto& rs_meta : in.inc_rs_metas()) { |
707 | 1 | cloud_rowset_meta_to_doris(out->add_inc_rs_metas(), rs_meta); |
708 | 1 | } |
709 | 1 | } |
710 | 1 | if (in.has_alter_task()) { |
711 | 1 | out->mutable_alter_task()->CopyFrom(in.alter_task()); |
712 | 1 | } |
713 | 1 | out->set_in_restore_mode(in.in_restore_mode()); |
714 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
715 | 1 | out->set_end_rowset_id(in.end_rowset_id()); |
716 | 1 | out->set_preferred_rowset_type(in.preferred_rowset_type()); |
717 | 1 | out->set_tablet_type(in.tablet_type()); |
718 | 1 | if (in.stale_rs_metas_size()) { |
719 | 1 | out->mutable_stale_rs_metas()->Reserve(in.stale_rs_metas_size()); |
720 | 1 | for (const auto& rs_meta : in.stale_rs_metas()) { |
721 | 1 | cloud_rowset_meta_to_doris(out->add_stale_rs_metas(), rs_meta); |
722 | 1 | } |
723 | 1 | } |
724 | 1 | out->set_replica_id(in.replica_id()); |
725 | 1 | if (in.has_delete_bitmap()) { |
726 | 1 | out->mutable_delete_bitmap()->CopyFrom(in.delete_bitmap()); |
727 | 1 | } |
728 | 1 | out->set_enable_unique_key_merge_on_write(in.enable_unique_key_merge_on_write()); |
729 | 1 | out->set_storage_policy_id(in.storage_policy_id()); |
730 | 1 | out->mutable_cooldown_meta_id()->CopyFrom(in.cooldown_meta_id()); |
731 | 1 | if (in.has_binlog_config()) { |
732 | 1 | out->mutable_binlog_config()->CopyFrom(in.binlog_config()); |
733 | 1 | } |
734 | 1 | out->set_compaction_policy(in.compaction_policy()); |
735 | 1 | out->set_time_series_compaction_goal_size_mbytes(in.time_series_compaction_goal_size_mbytes()); |
736 | 1 | out->set_time_series_compaction_file_count_threshold( |
737 | 1 | in.time_series_compaction_file_count_threshold()); |
738 | 1 | out->set_time_series_compaction_time_threshold_seconds( |
739 | 1 | in.time_series_compaction_time_threshold_seconds()); |
740 | 1 | out->set_time_series_compaction_empty_rowsets_threshold( |
741 | 1 | in.time_series_compaction_empty_rowsets_threshold()); |
742 | 1 | out->set_time_series_compaction_level_threshold(in.time_series_compaction_level_threshold()); |
743 | 1 | out->set_index_id(in.index_id()); |
744 | 1 | out->set_is_in_memory(in.is_in_memory()); |
745 | 1 | out->set_is_persistent(in.is_persistent()); |
746 | 1 | out->set_table_name(in.table_name()); |
747 | 1 | out->set_ttl_seconds(in.ttl_seconds()); |
748 | 1 | if (in.has_schema_version()) { |
749 | 1 | out->set_schema_version(in.schema_version()); |
750 | 1 | } |
751 | 1 | if (in.has_encryption_algorithm()) { |
752 | 1 | out->set_encryption_algorithm(in.encryption_algorithm()); |
753 | 1 | } |
754 | 1 | } |
755 | | |
756 | 1 | void cloud_tablet_meta_to_doris(TabletMetaPB* out, TabletMetaCloudPB&& in) { |
757 | | // ATTN: please keep the set order aligned with the definition of proto. |
758 | 1 | out->set_table_id(in.table_id()); |
759 | 1 | out->set_partition_id(in.partition_id()); |
760 | 1 | out->set_tablet_id(in.tablet_id()); |
761 | 1 | out->set_schema_hash(in.schema_hash()); |
762 | 1 | out->set_shard_id(in.shard_id()); |
763 | 1 | out->set_creation_time(in.creation_time()); |
764 | 1 | out->set_cumulative_layer_point(in.cumulative_layer_point()); |
765 | 1 | out->set_tablet_state(in.tablet_state()); |
766 | 1 | if (in.has_schema()) { |
767 | 1 | cloud_tablet_schema_to_doris(out->mutable_schema(), std::move(*in.mutable_schema())); |
768 | 1 | } |
769 | 1 | if (in.rs_metas_size()) { |
770 | 1 | int rs_metas_size = in.rs_metas_size(); |
771 | 1 | out->mutable_rs_metas()->Reserve(rs_metas_size); |
772 | 2 | for (int i = 0; i < rs_metas_size; ++i) { |
773 | 1 | cloud_rowset_meta_to_doris(out->add_rs_metas(), std::move(*in.mutable_rs_metas(i))); |
774 | 1 | } |
775 | 1 | } |
776 | | // ATTN: inc_rs_metas are deprecated, here is for conversion check |
777 | 1 | if (in.inc_rs_metas_size()) { |
778 | 1 | int rs_metas_size = in.inc_rs_metas_size(); |
779 | 1 | out->mutable_inc_rs_metas()->Reserve(rs_metas_size); |
780 | 2 | for (int i = 0; i < rs_metas_size; i++) { |
781 | 1 | cloud_rowset_meta_to_doris(out->add_inc_rs_metas(), |
782 | 1 | std::move(*in.mutable_inc_rs_metas(i))); |
783 | 1 | } |
784 | 1 | } |
785 | 1 | if (in.has_alter_task()) { |
786 | 1 | out->mutable_alter_task()->Swap(in.mutable_alter_task()); |
787 | 1 | } |
788 | 1 | out->set_in_restore_mode(in.in_restore_mode()); |
789 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
790 | 1 | out->set_end_rowset_id(in.end_rowset_id()); |
791 | 1 | out->set_preferred_rowset_type(in.preferred_rowset_type()); |
792 | 1 | out->set_tablet_type(in.tablet_type()); |
793 | 1 | if (in.stale_rs_metas_size()) { |
794 | 1 | int rs_metas_size = in.stale_rs_metas_size(); |
795 | 1 | out->mutable_stale_rs_metas()->Reserve(rs_metas_size); |
796 | 2 | for (int i = 0; i < rs_metas_size; i++) { |
797 | 1 | cloud_rowset_meta_to_doris(out->add_stale_rs_metas(), |
798 | 1 | std::move(*in.mutable_stale_rs_metas(i))); |
799 | 1 | } |
800 | 1 | } |
801 | 1 | out->set_replica_id(in.replica_id()); |
802 | 1 | if (in.has_delete_bitmap()) { |
803 | 1 | out->mutable_delete_bitmap()->Swap(in.mutable_delete_bitmap()); |
804 | 1 | } |
805 | 1 | out->set_enable_unique_key_merge_on_write(in.enable_unique_key_merge_on_write()); |
806 | 1 | out->set_storage_policy_id(in.storage_policy_id()); |
807 | 1 | out->mutable_cooldown_meta_id()->CopyFrom(in.cooldown_meta_id()); |
808 | 1 | if (in.has_binlog_config()) { |
809 | 1 | out->mutable_binlog_config()->Swap(in.mutable_binlog_config()); |
810 | 1 | } |
811 | 1 | out->set_compaction_policy(in.compaction_policy()); |
812 | 1 | out->set_time_series_compaction_goal_size_mbytes(in.time_series_compaction_goal_size_mbytes()); |
813 | 1 | out->set_time_series_compaction_file_count_threshold( |
814 | 1 | in.time_series_compaction_file_count_threshold()); |
815 | 1 | out->set_time_series_compaction_time_threshold_seconds( |
816 | 1 | in.time_series_compaction_time_threshold_seconds()); |
817 | 1 | out->set_time_series_compaction_empty_rowsets_threshold( |
818 | 1 | in.time_series_compaction_empty_rowsets_threshold()); |
819 | 1 | out->set_time_series_compaction_level_threshold(in.time_series_compaction_level_threshold()); |
820 | 1 | out->set_index_id(in.index_id()); |
821 | 1 | out->set_is_in_memory(in.is_in_memory()); |
822 | 1 | out->set_is_persistent(in.is_persistent()); |
823 | 1 | out->set_table_name(in.table_name()); |
824 | 1 | out->set_ttl_seconds(in.ttl_seconds()); |
825 | 1 | if (in.has_schema_version()) { |
826 | 1 | out->set_schema_version(in.schema_version()); |
827 | 1 | } |
828 | 1 | if (in.has_encryption_algorithm()) { |
829 | 1 | out->set_encryption_algorithm(in.encryption_algorithm()); |
830 | 1 | } |
831 | 1 | } |
832 | | #include "common/compile_check_end.h" |
833 | | |
834 | | } // namespace doris::cloud |