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