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