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