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