Coverage Report

Created: 2026-05-20 15:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/storage/rowset/rowset_meta.h
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
#ifndef DORIS_BE_SRC_OLAP_ROWSET_ROWSET_META_H
19
#define DORIS_BE_SRC_OLAP_ROWSET_ROWSET_META_H
20
21
#include <gen_cpp/olap_file.pb.h>
22
#include <glog/logging.h>
23
24
#include <atomic>
25
#include <chrono>
26
#include <cstdint>
27
#include <memory>
28
#include <string>
29
#include <vector>
30
31
#include "common/cast_set.h"
32
#include "common/config.h"
33
#include "common/status.h"
34
#include "io/fs/encrypted_fs_factory.h"
35
#include "io/fs/file_system.h"
36
#include "runtime/memory/lru_cache_policy.h"
37
#include "storage/metadata_adder.h"
38
#include "storage/olap_common.h"
39
#include "storage/rowset/rowset_fwd.h"
40
#include "storage/storage_policy.h"
41
#include "storage/tablet/tablet_fwd.h"
42
#include "util/once.h"
43
44
namespace doris {
45
46
class RowsetMeta : public MetadataAdder<RowsetMeta> {
47
public:
48
974k
    RowsetMeta() = default;
49
    ~RowsetMeta();
50
51
    bool init(std::string_view pb_rowset_meta);
52
53
    bool init(const RowsetMeta* rowset_meta);
54
55
    bool init_from_pb(const RowsetMetaPB& rowset_meta_pb);
56
57
    bool init_from_json(const std::string& json_rowset_meta);
58
59
38
    bool serialize(std::string* value) { return _serialize_to_pb(value); }
60
61
    bool json_rowset_meta(std::string* json_rowset_meta);
62
63
    // If the rowset is a local rowset, return the global local file system.
64
    // Otherwise, return the remote file system corresponding to rowset's resource id.
65
    // Note that if the resource id cannot be found for the corresponding remote file system, nullptr will be returned.
66
    MOCK_FUNCTION io::FileSystemSPtr fs();
67
68
    io::FileSystemSPtr physical_fs();
69
70
    Result<const StorageResource*> remote_storage_resource();
71
72
    void set_remote_storage_resource(StorageResource resource);
73
74
34.3k
    const std::string& resource_id() const { return _rowset_meta_pb.resource_id(); }
75
76
1.41k
    void set_resource_id(const std::string& resource_id) {
77
1.41k
        _rowset_meta_pb.set_resource_id(resource_id);
78
1.41k
    }
79
80
50.1M
    bool is_local() const { return !_rowset_meta_pb.has_resource_id(); }
81
82
    bool has_variant_type_in_schema() const;
83
84
38.8M
    RowsetId rowset_id() const { return _rowset_id; }
85
86
249k
    void set_rowset_id(const RowsetId& rowset_id) {
87
        // rowset id is a required field, just set it to 0
88
249k
        _rowset_meta_pb.set_rowset_id(0);
89
249k
        _rowset_id = rowset_id;
90
249k
        _rowset_meta_pb.set_rowset_id_v2(rowset_id.to_string());
91
249k
    }
92
93
11.1M
    int64_t tablet_id() const { return _rowset_meta_pb.tablet_id(); }
94
95
250k
    void set_tablet_id(int64_t tablet_id) { _rowset_meta_pb.set_tablet_id(tablet_id); }
96
97
850
    int64_t db_id() const { return _rowset_meta_pb.db_id(); }
98
99
238k
    void set_db_id(int64_t db_id) { _rowset_meta_pb.set_db_id(db_id); }
100
101
850
    int64_t table_id() const { return _rowset_meta_pb.table_id(); }
102
103
237k
    void set_table_id(int64_t table_id) { _rowset_meta_pb.set_table_id(table_id); }
104
105
    int64_t index_id() const { return _rowset_meta_pb.index_id(); }
106
107
238k
    void set_index_id(int64_t index_id) { _rowset_meta_pb.set_index_id(index_id); }
108
109
96.3k
    TabletUid tablet_uid() const { return _rowset_meta_pb.tablet_uid(); }
110
111
53.1k
    void set_tablet_uid(TabletUid tablet_uid) {
112
53.1k
        *(_rowset_meta_pb.mutable_tablet_uid()) = tablet_uid.to_proto();
113
53.1k
    }
114
115
672k
    int64_t txn_id() const { return _rowset_meta_pb.txn_id(); }
116
117
225k
    void set_txn_id(int64_t txn_id) { _rowset_meta_pb.set_txn_id(txn_id); }
118
119
1.96k
    int32_t tablet_schema_hash() const { return _rowset_meta_pb.tablet_schema_hash(); }
120
121
238k
    void set_tablet_schema_hash(int32_t tablet_schema_hash) {
122
238k
        _rowset_meta_pb.set_tablet_schema_hash(tablet_schema_hash);
123
238k
    }
124
125
14
    void mark_row_binlog() { _rowset_meta_pb.set_is_row_binlog(true); }
126
127
486k
    bool is_row_binlog() const {
128
486k
        return _rowset_meta_pb.has_is_row_binlog() && _rowset_meta_pb.is_row_binlog();
129
486k
    }
130
131
2.02M
    RowsetTypePB rowset_type() const { return _rowset_meta_pb.rowset_type(); }
132
133
239k
    void set_rowset_type(RowsetTypePB rowset_type) { _rowset_meta_pb.set_rowset_type(rowset_type); }
134
135
610k
    RowsetStatePB rowset_state() const { return _rowset_meta_pb.rowset_state(); }
136
137
510k
    void set_rowset_state(RowsetStatePB rowset_state) {
138
510k
        _rowset_meta_pb.set_rowset_state(rowset_state);
139
510k
    }
140
141
58.2M
    Version version() const {
142
58.2M
        return {_rowset_meta_pb.start_version(), _rowset_meta_pb.end_version()};
143
58.2M
    }
144
145
294k
    void set_version(Version version) {
146
294k
        _rowset_meta_pb.set_start_version(version.first);
147
294k
        _rowset_meta_pb.set_end_version(version.second);
148
294k
    }
149
150
1.02M
    bool has_version() const {
151
1.02M
        return _rowset_meta_pb.has_start_version() && _rowset_meta_pb.has_end_version();
152
1.02M
    }
153
154
7.67M
    int64_t start_version() const { return _rowset_meta_pb.start_version(); }
155
156
9.59M
    int64_t end_version() const { return _rowset_meta_pb.end_version(); }
157
158
12.8M
    int64_t num_rows() const { return _rowset_meta_pb.num_rows(); }
159
160
272k
    void set_num_rows(int64_t num_rows) { _rowset_meta_pb.set_num_rows(num_rows); }
161
162
267k
    void set_num_segment_rows(const std::vector<uint32_t>& num_segment_rows) {
163
267k
        _rowset_meta_pb.mutable_num_segment_rows()->Assign(num_segment_rows.cbegin(),
164
267k
                                                           num_segment_rows.cend());
165
267k
    }
166
167
4.21k
    void get_num_segment_rows(std::vector<uint32_t>* num_segment_rows) const {
168
4.21k
        num_segment_rows->assign(_rowset_meta_pb.num_segment_rows().cbegin(),
169
4.21k
                                 _rowset_meta_pb.num_segment_rows().cend());
170
4.21k
    }
171
172
190k
    auto& get_num_segment_rows() const { return _rowset_meta_pb.num_segment_rows(); }
173
174
11.6M
    int64_t total_disk_size() const { return _rowset_meta_pb.total_disk_size(); }
175
176
282k
    void set_total_disk_size(int64_t total_disk_size) {
177
282k
        _rowset_meta_pb.set_total_disk_size(total_disk_size);
178
282k
    }
179
180
8.97M
    int64_t data_disk_size() const { return _rowset_meta_pb.data_disk_size(); }
181
182
271k
    void set_data_disk_size(int64_t data_disk_size) {
183
271k
        _rowset_meta_pb.set_data_disk_size(data_disk_size);
184
271k
    }
185
186
2.40M
    int64_t index_disk_size() const { return _rowset_meta_pb.index_disk_size(); }
187
188
272k
    void set_index_disk_size(int64_t index_disk_size) {
189
272k
        _rowset_meta_pb.set_index_disk_size(index_disk_size);
190
272k
    }
191
192
0
    void zone_maps(std::vector<ZoneMap>* zone_maps) {
193
0
        for (const ZoneMap& zone_map : _rowset_meta_pb.zone_maps()) {
194
0
            zone_maps->push_back(zone_map);
195
0
        }
196
0
    }
197
198
0
    void set_zone_maps(const std::vector<ZoneMap>& zone_maps) {
199
0
        for (const ZoneMap& zone_map : zone_maps) {
200
0
            ZoneMap* new_zone_map = _rowset_meta_pb.add_zone_maps();
201
0
            *new_zone_map = zone_map;
202
0
        }
203
0
    }
204
205
0
    void add_zone_map(const ZoneMap& zone_map) {
206
0
        ZoneMap* new_zone_map = _rowset_meta_pb.add_zone_maps();
207
0
        *new_zone_map = zone_map;
208
0
    }
209
210
7.45M
    bool has_delete_predicate() const { return _rowset_meta_pb.has_delete_predicate(); }
211
212
8.30k
    const DeletePredicatePB& delete_predicate() const { return _rowset_meta_pb.delete_predicate(); }
213
214
22
    DeletePredicatePB* mutable_delete_predicate() {
215
22
        return _rowset_meta_pb.mutable_delete_predicate();
216
22
    }
217
218
3.27k
    void set_delete_predicate(DeletePredicatePB delete_predicate) {
219
3.27k
        DeletePredicatePB* new_delete_condition = _rowset_meta_pb.mutable_delete_predicate();
220
3.27k
        *new_delete_condition = std::move(delete_predicate);
221
3.27k
    }
222
223
10.2k
    bool empty() const { return _rowset_meta_pb.empty(); }
224
225
268k
    void set_empty(bool empty) { _rowset_meta_pb.set_empty(empty); }
226
227
60
    PUniqueId load_id() const { return _rowset_meta_pb.load_id(); }
228
229
206k
    void set_load_id(PUniqueId load_id) {
230
206k
        PUniqueId* new_load_id = _rowset_meta_pb.mutable_load_id();
231
206k
        new_load_id->set_hi(load_id.hi());
232
206k
        new_load_id->set_lo(load_id.lo());
233
206k
    }
234
235
198k
    void set_job_id(const std::string& job_id) { _rowset_meta_pb.set_job_id(job_id); }
236
237
0
    const std::string& job_id() const { return _rowset_meta_pb.job_id(); }
238
239
0
    bool delete_flag() const { return _rowset_meta_pb.delete_flag(); }
240
241
140k
    int64_t creation_time() const { return _rowset_meta_pb.creation_time(); }
242
243
297k
    void set_creation_time(int64_t creation_time) {
244
297k
        return _rowset_meta_pb.set_creation_time(creation_time);
245
297k
    }
246
247
598k
    int64_t stale_at() const {
248
598k
        int64_t stale_time = _stale_at_s.load();
249
598k
        return stale_time > 0 ? stale_time : _rowset_meta_pb.creation_time();
250
598k
    }
251
252
7.42k
    bool has_stale_at() const { return _stale_at_s.load() > 0; }
253
254
87.7k
    void set_stale_at(int64_t stale_at) { _stale_at_s.store(stale_at); }
255
256
11.6k
    int64_t partition_id() const { return _rowset_meta_pb.partition_id(); }
257
258
239k
    void set_partition_id(int64_t partition_id) {
259
239k
        return _rowset_meta_pb.set_partition_id(partition_id);
260
239k
    }
261
262
34.9M
    int64_t num_segments() const { return _rowset_meta_pb.num_segments(); }
263
264
275k
    void set_num_segments(int64_t num_segments) { _rowset_meta_pb.set_num_segments(num_segments); }
265
266
    // Convert to RowsetMetaPB, skip_schema is only used by cloud to separate schema from rowset meta.
267
    void to_rowset_pb(RowsetMetaPB* rs_meta_pb, bool skip_schema = false) const;
268
269
    // Convert to RowsetMetaPB, skip_schema is only used by cloud to separate schema from rowset meta.
270
    RowsetMetaPB get_rowset_pb(bool skip_schema = false) const;
271
272
100
    inline DeletePredicatePB* mutable_delete_pred_pb() {
273
100
        return _rowset_meta_pb.mutable_delete_predicate();
274
100
    }
275
276
1.54k
    bool is_singleton_delta() const {
277
1.54k
        return has_version() && _rowset_meta_pb.start_version() == _rowset_meta_pb.end_version();
278
1.54k
    }
279
280
    // Some time, we may check if this rowset is in rowset meta manager's meta by using RowsetMetaManager::check_rowset_meta.
281
    // But, this check behavior may cost a lot of time when it is frequent.
282
    // If we explicitly remove this rowset from rowset meta manager's meta, we can set _is_removed_from_rowset_meta to true,
283
    // And next time when we want to check if this rowset is in rowset mata manager's meta, we can
284
    // check is_remove_from_rowset_meta() first.
285
41.6k
    void set_remove_from_rowset_meta() { _is_removed_from_rowset_meta = true; }
286
287
43.1k
    bool is_remove_from_rowset_meta() const { return _is_removed_from_rowset_meta; }
288
289
37.3k
    SegmentsOverlapPB segments_overlap() const { return _rowset_meta_pb.segments_overlap_pb(); }
290
291
340k
    void set_segments_overlap(SegmentsOverlapPB segments_overlap) {
292
340k
        _rowset_meta_pb.set_segments_overlap_pb(segments_overlap);
293
340k
    }
294
295
855k
    static bool comparator(const RowsetMetaSharedPtr& left, const RowsetMetaSharedPtr& right) {
296
855k
        return left->end_version() < right->end_version();
297
855k
    }
298
299
    // return true if segments in this rowset has overlapping data.
300
    // this is not same as `segments_overlap()` method.
301
    // `segments_overlap()` only return the value of "segments_overlap" field in rowset meta,
302
    // but "segments_overlap" may be UNKNOWN.
303
    //
304
    // Returns true if all of the following conditions are met
305
    // 1. the rowset contains more than one segment
306
    // 2. the rowset's start version == end version (non-singleton rowset was generated by compaction process
307
    //    which always produces non-overlapped segments)
308
    // 3. segments_overlap() flag is not NONOVERLAPPING (OVERLAP_UNKNOWN and OVERLAPPING are OK)
309
6.13M
    bool is_segments_overlapping() const {
310
6.13M
        return num_segments() > 1 && is_singleton_delta() && segments_overlap() != NONOVERLAPPING;
311
6.13M
    }
312
313
42
    bool produced_by_compaction() const {
314
42
        return has_version() &&
315
42
               (start_version() < end_version() ||
316
42
                (start_version() == end_version() && segments_overlap() == NONOVERLAPPING));
317
42
    }
318
319
    // get the compaction score of this rowset.
320
    // if segments are overlapping, the score equals to the number of segments,
321
    // otherwise, score is 1.
322
2.76M
    uint32_t get_compaction_score() const {
323
2.76M
        uint32_t score = 0;
324
2.76M
        if (!is_segments_overlapping()) {
325
2.76M
            score = 1;
326
2.76M
        } else {
327
323
            auto num_seg = num_segments();
328
323
            DCHECK_GT(num_seg, 0);
329
323
            score = cast_set<uint32_t>(num_seg);
330
323
            CHECK(score > 0);
331
323
        }
332
2.76M
        return score;
333
2.76M
    }
334
335
77.5k
    uint32_t get_merge_way_num() const {
336
77.5k
        uint32_t way_num = 0;
337
77.6k
        if (!is_segments_overlapping()) {
338
77.6k
            if (num_segments() == 0) {
339
42.9k
                way_num = 0;
340
42.9k
            } else {
341
34.6k
                way_num = 1;
342
34.6k
            }
343
18.4E
        } else {
344
18.4E
            auto num_seg = num_segments();
345
18.4E
            DCHECK_GT(num_seg, 0);
346
347
18.4E
            way_num = cast_set<uint32_t>(num_seg);
348
18.4E
            CHECK(way_num > 0);
349
18.4E
        }
350
77.5k
        return way_num;
351
77.5k
    }
352
353
4.12M
    void get_segments_key_bounds(std::vector<KeyBoundsPB>* segments_key_bounds) const {
354
4.12M
        for (const KeyBoundsPB& key_range : _rowset_meta_pb.segments_key_bounds()) {
355
3.94M
            segments_key_bounds->push_back(key_range);
356
3.94M
        }
357
4.12M
    }
358
359
3.66k
    auto& get_segments_key_bounds() const { return _rowset_meta_pb.segments_key_bounds(); }
360
361
5.57M
    bool is_segments_key_bounds_truncated() const {
362
5.57M
        return _rowset_meta_pb.has_segments_key_bounds_truncated() &&
363
5.57M
               _rowset_meta_pb.segments_key_bounds_truncated();
364
5.57M
    }
365
366
271k
    void set_segments_key_bounds_truncated(bool truncated) {
367
271k
        _rowset_meta_pb.set_segments_key_bounds_truncated(truncated);
368
271k
    }
369
370
    // When true, `segments_key_bounds` holds a single aggregated
371
    // [rowset_min, rowset_max] entry instead of per-segment bounds.
372
4.13M
    bool is_segments_key_bounds_aggregated() const {
373
4.13M
        return _rowset_meta_pb.has_segments_key_bounds_aggregated() &&
374
4.13M
               _rowset_meta_pb.segments_key_bounds_aggregated();
375
4.13M
    }
376
377
267k
    void set_segments_key_bounds_aggregated(bool aggregated) {
378
267k
        _rowset_meta_pb.set_segments_key_bounds_aggregated(aggregated);
379
267k
    }
380
381
1.46M
    bool get_first_segment_key_bound(KeyBoundsPB* key_bounds) {
382
        // for compatibility, old version has not segment key bounds
383
1.46M
        if (_rowset_meta_pb.segments_key_bounds_size() == 0) {
384
0
            return false;
385
0
        }
386
1.46M
        *key_bounds = *_rowset_meta_pb.segments_key_bounds().begin();
387
1.46M
        return true;
388
1.46M
    }
389
390
993k
    bool get_last_segment_key_bound(KeyBoundsPB* key_bounds) {
391
993k
        if (_rowset_meta_pb.segments_key_bounds_size() == 0) {
392
0
            return false;
393
0
        }
394
993k
        *key_bounds = *_rowset_meta_pb.segments_key_bounds().rbegin();
395
993k
        return true;
396
993k
    }
397
398
    // If `aggregate_into_single` is true, collapse per-segment bounds into a single
399
    // [rowset_min, rowset_max] entry and mark this rowset as aggregated.
400
    void set_segments_key_bounds(const std::vector<KeyBoundsPB>& segments_key_bounds,
401
                                 bool aggregate_into_single = false);
402
403
20
    void add_segment_key_bounds(KeyBoundsPB segments_key_bounds) {
404
20
        *_rowset_meta_pb.add_segments_key_bounds() = std::move(segments_key_bounds);
405
20
        set_segments_overlap(OVERLAPPING);
406
20
    }
407
408
242k
    void set_newest_write_timestamp(int64_t timestamp) {
409
242k
        _rowset_meta_pb.set_newest_write_timestamp(timestamp);
410
242k
    }
411
412
459k
    int64_t newest_write_timestamp() const { return _rowset_meta_pb.newest_write_timestamp(); }
413
414
    // for cloud only
415
395
    bool has_visible_ts_ms() const { return _rowset_meta_pb.has_visible_ts_ms(); }
416
388
    int64_t visible_ts_ms() const { return _rowset_meta_pb.visible_ts_ms(); }
417
395
    std::chrono::time_point<std::chrono::system_clock> visible_timestamp() const {
418
395
        using namespace std::chrono;
419
395
        if (has_visible_ts_ms()) {
420
388
            return time_point<system_clock>(milliseconds(visible_ts_ms()));
421
388
        }
422
7
        return system_clock::from_time_t(newest_write_timestamp());
423
395
    }
424
173k
    void set_visible_ts_ms(int64_t visible_ts_ms) {
425
173k
        _rowset_meta_pb.set_visible_ts_ms(visible_ts_ms);
426
173k
    }
427
428
    void set_tablet_schema(const TabletSchemaSPtr& tablet_schema);
429
    void set_tablet_schema(const TabletSchemaPB& tablet_schema);
430
431
6.31M
    const TabletSchemaSPtr& tablet_schema() const { return _schema; }
432
433
194k
    void set_txn_expiration(int64_t expiration) { _rowset_meta_pb.set_txn_expiration(expiration); }
434
435
236k
    void set_compaction_level(int64_t compaction_level) {
436
236k
        _rowset_meta_pb.set_compaction_level(compaction_level);
437
236k
    }
438
439
5.31k
    int64_t compaction_level() { return _rowset_meta_pb.compaction_level(); }
440
441
    // `seg_file_size` MUST ordered by segment id
442
    void add_segments_file_size(const std::vector<size_t>& seg_file_size);
443
444
    // Return -1 if segment file size is unknown
445
    int64_t segment_file_size(int seg_id) const;
446
447
3.34k
    const auto& segments_file_size() const { return _rowset_meta_pb.segments_file_size(); }
448
449
    // Used for partial update, when publish, partial update may add a new rowset and we should update rowset meta
450
    void merge_rowset_meta(const RowsetMeta& other);
451
452
    InvertedIndexFileInfo inverted_index_file_info(int seg_id);
453
454
186
    const auto& inverted_index_file_info() const {
455
186
        return _rowset_meta_pb.inverted_index_file_info();
456
186
    }
457
458
    void add_inverted_index_files_info(
459
            const std::vector<const InvertedIndexFileInfo*>& idx_file_info);
460
461
    int64_t get_metadata_size() const override;
462
463
    // Because the member field '_handle' is a raw pointer, use member func 'init' to replace copy ctor
464
    RowsetMeta(const RowsetMeta&) = delete;
465
    RowsetMeta operator=(const RowsetMeta&) = delete;
466
467
    void add_packed_slice_location(const std::string& segment_path,
468
                                   const std::string& packed_file_path, int64_t offset,
469
0
                                   int64_t size, int64_t packed_file_size) {
470
0
        auto* index_map = _rowset_meta_pb.mutable_packed_slice_locations();
471
0
        auto& index_pb = (*index_map)[segment_path];
472
0
        index_pb.set_packed_file_path(packed_file_path);
473
0
        index_pb.set_offset(offset);
474
0
        index_pb.set_size(size);
475
0
        index_pb.set_packed_file_size(packed_file_size);
476
0
    }
477
478
24.8k
    int32_t schema_version() const { return _rowset_meta_pb.schema_version(); }
479
480
0
    std::string debug_string() const { return _rowset_meta_pb.ShortDebugString(); }
481
482
    // Pre-set the encryption algorithm to avoid re-entrant get_tablet calls
483
    // that can cause SingleFlight deadlock during tablet loading.
484
172k
    void set_encryption_algorithm(EncryptionAlgorithmPB algorithm) {
485
172k
        _determine_encryption_once.call(
486
172k
                [algorithm]() -> Result<EncryptionAlgorithmPB> { return algorithm; });
487
172k
    }
488
489
4.07M
    TsoRange commit_tso() const {
490
4.07M
        const auto& commit_tso_pb = _rowset_meta_pb.commit_tso();
491
4.07M
        return {commit_tso_pb.start_tso(), commit_tso_pb.end_tso()};
492
4.07M
    }
493
494
39.5k
    void set_commit_tso(const TsoRange& commit_tso) {
495
39.5k
        auto* commit_tso_pb = _rowset_meta_pb.mutable_commit_tso();
496
39.5k
        commit_tso_pb->set_start_tso(commit_tso.start_tso());
497
39.5k
        commit_tso_pb->set_end_tso(commit_tso.end_tso());
498
39.5k
    }
499
500
29.5k
    void set_commit_tso(int64_t commit_tso) { set_commit_tso({commit_tso, commit_tso}); }
501
502
173k
    void set_cloud_fields_after_visible(int64_t visible_version, int64_t version_update_time_ms) {
503
        // Update rowset meta with correct version and visible_ts
504
        // !!ATTENTION!!: this code should be updated if there are more fields
505
        // in rowset meta which will be modified in meta-service when commit_txn in the future
506
173k
        set_version({visible_version, visible_version});
507
173k
        if (version_update_time_ms > 0) {
508
173k
            set_visible_ts_ms(version_update_time_ms);
509
173k
        }
510
173k
    }
511
512
private:
513
    bool _deserialize_from_pb(std::string_view value);
514
515
    bool _serialize_to_pb(std::string* value);
516
517
    void _init();
518
519
    friend bool operator==(const RowsetMeta& a, const RowsetMeta& b);
520
521
0
    friend bool operator!=(const RowsetMeta& a, const RowsetMeta& b) { return !(a == b); }
522
523
private:
524
    RowsetMetaPB _rowset_meta_pb;
525
    TabletSchemaSPtr _schema;
526
    Cache::Handle* _handle = nullptr;
527
    RowsetId _rowset_id;
528
    StorageResource _storage_resource;
529
    bool _is_removed_from_rowset_meta = false;
530
    DorisCallOnce<Result<EncryptionAlgorithmPB>> _determine_encryption_once;
531
    std::atomic<int64_t> _stale_at_s {0};
532
};
533
534
using RowsetMetaMapContainer = std::unordered_map<Version, RowsetMetaSharedPtr, HashOfVersion>;
535
536
} // namespace doris
537
538
#endif // DORIS_BE_SRC_OLAP_ROWSET_ROWSET_META_H