Coverage Report

Created: 2026-05-29 19:02

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/storage/tablet/base_tablet.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
#pragma once
19
20
#include <gen_cpp/olap_common.pb.h>
21
22
#include <memory>
23
#include <mutex>
24
#include <shared_mutex>
25
#include <string>
26
27
#include "common/metrics/metrics.h"
28
#include "common/status.h"
29
#include "io/io_common.h"
30
#include "storage/iterators.h"
31
#include "storage/olap_common.h"
32
#include "storage/partial_update_info.h"
33
#include "storage/segment/segment.h"
34
#include "storage/tablet/tablet_fwd.h"
35
#include "storage/tablet/tablet_meta.h"
36
#include "storage/tablet/tablet_schema.h"
37
#include "storage/version_graph.h"
38
39
namespace doris {
40
struct RowSetSplits;
41
struct RowsetWriterContext;
42
class RowsetWriter;
43
class CalcDeleteBitmapToken;
44
class SegmentCacheHandle;
45
class RowIdConversion;
46
struct PartialUpdateInfo;
47
class PartialUpdateReadPlan;
48
struct CaptureRowsetOps;
49
struct CaptureRowsetResult;
50
struct TabletReadSource;
51
class FixedReadPlan;
52
53
struct TabletWithVersion {
54
    BaseTabletSPtr tablet;
55
    int64_t version;
56
};
57
58
enum class CompactionStage { NOT_SCHEDULED, PENDING, EXECUTING };
59
60
// Base class for all tablet classes
61
class BaseTablet : public std::enable_shared_from_this<BaseTablet> {
62
public:
63
    explicit BaseTablet(TabletMetaSharedPtr tablet_meta);
64
    virtual ~BaseTablet();
65
    BaseTablet(const BaseTablet&) = delete;
66
    BaseTablet& operator=(const BaseTablet&) = delete;
67
68
6.92k
    TabletState tablet_state() const { return _tablet_meta->tablet_state(); }
69
    Status set_tablet_state(TabletState state);
70
22
    int64_t table_id() const { return _tablet_meta->table_id(); }
71
0
    size_t row_size() const { return _tablet_meta->tablet_schema()->row_size(); }
72
41
    int64_t index_id() const { return _tablet_meta->index_id(); }
73
1.05k
    int64_t partition_id() const { return _tablet_meta->partition_id(); }
74
20.9k
    int64_t tablet_id() const { return _tablet_meta->tablet_id(); }
75
1.57k
    int32_t schema_hash() const { return _tablet_meta->schema_hash(); }
76
0
    CompressKind compress_kind() const { return _tablet_meta->tablet_schema()->compress_kind(); }
77
729
    KeysType keys_type() const { return _tablet_meta->tablet_schema()->keys_type(); }
78
128
    size_t num_key_columns() const { return _tablet_meta->tablet_schema()->num_key_columns(); }
79
343
    int64_t ttl_seconds() const { return _tablet_meta->ttl_seconds(); }
80
    // currently used by schema change, inverted index building, and cooldown
81
25
    std::timed_mutex& get_schema_change_lock() { return _schema_change_lock; }
82
1.26k
    bool enable_unique_key_merge_on_write() const {
83
1.26k
#ifdef BE_TEST
84
1.26k
        if (_tablet_meta == nullptr) {
85
0
            return false;
86
0
        }
87
1.26k
#endif
88
1.26k
        return _tablet_meta->enable_unique_key_merge_on_write();
89
1.26k
    }
90
91
    // Property encapsulated in TabletMeta
92
3.76k
    const TabletMetaSharedPtr& tablet_meta() const { return _tablet_meta; }
93
94
    int32_t max_version_config();
95
96
    // FIXME(plat1ko): It is not appropriate to expose this lock
97
417
    std::shared_mutex& get_header_lock() { return _meta_lock; }
98
99
    void update_max_version_schema(const TabletSchemaSPtr& tablet_schema);
100
101
11.5k
    TabletSchemaSPtr tablet_schema() const {
102
11.5k
        std::shared_lock rlock(_meta_lock);
103
11.5k
        return _max_version_schema;
104
11.5k
    }
105
106
9
    TabletSchemaSPtr row_binlog_tablet_schema() const {
107
9
        std::shared_lock rlock(_meta_lock);
108
9
        return _tablet_meta->row_binlog_schema();
109
9
    }
110
111
7
    void set_alter_failed(bool alter_failed) { _alter_failed = alter_failed; }
112
0
    bool is_alter_failed() { return _alter_failed; }
113
114
    virtual std::string tablet_path() const = 0;
115
116
    virtual bool exceed_version_limit(int32_t limit) = 0;
117
118
    virtual Result<std::unique_ptr<RowsetWriter>> create_rowset_writer(RowsetWriterContext& context,
119
                                                                       bool vertical) = 0;
120
121
    virtual Status capture_rs_readers(const Version& spec_version,
122
                                      std::vector<RowSetSplits>* rs_splits,
123
                                      const CaptureRowsetOps& opts) = 0;
124
125
    virtual size_t tablet_footprint() = 0;
126
127
    // this method just return the compaction sum on each rowset
128
    // note(tsy): we should unify the compaction score calculation finally
129
    uint32_t get_real_compaction_score() const;
130
131
    // MUST hold shared meta lock
132
    Status capture_rs_readers_unlocked(const Versions& version_path,
133
                                       std::vector<RowSetSplits>* rs_splits) const;
134
135
    // _rs_version_map and _stale_rs_version_map should be protected by _meta_lock
136
    // The caller must call hold _meta_lock when call this three function.
137
    RowsetSharedPtr get_rowset_by_version(const Version& version, bool find_is_stale = false) const;
138
    RowsetSharedPtr get_stale_rowset_by_version(const Version& version) const;
139
    RowsetSharedPtr get_row_binlog_rowset_by_version(const Version& version) const;
140
    RowsetSharedPtr get_rowset_with_max_version() const;
141
142
    Status get_all_rs_id(int64_t max_version, RowsetIdUnorderedSet* rowset_ids) const;
143
    Status get_all_rs_id_unlocked(int64_t max_version, RowsetIdUnorderedSet* rowset_ids) const;
144
145
    // Get the missed versions until the spec_version.
146
    Versions get_missed_versions(int64_t spec_version) const;
147
    Versions get_missed_versions_unlocked(int64_t spec_version,
148
                                          bool capture_row_binlog = false) const;
149
150
    void generate_tablet_meta_copy(TabletMeta& new_tablet_meta, bool cloud_get_rowset_meta) const;
151
    void generate_tablet_meta_copy_unlocked(TabletMeta& new_tablet_meta,
152
                                            bool cloud_get_rowset_meta) const;
153
154
37
    virtual int64_t max_version_unlocked() const { return _tablet_meta->max_version().second; }
155
156
    static TabletSchemaSPtr tablet_schema_with_merged_max_schema_version(
157
            const std::vector<RowsetMetaSharedPtr>& rowset_metas);
158
159
    ////////////////////////////////////////////////////////////////////////////
160
    // begin MoW functions
161
    ////////////////////////////////////////////////////////////////////////////
162
    std::vector<RowsetSharedPtr> get_rowset_by_ids(
163
            const RowsetIdUnorderedSet* specified_rowset_ids);
164
165
    // Lookup a row with TupleDescriptor and fill Block
166
    Status lookup_row_data(const Slice& encoded_key, const RowLocation& row_location,
167
                           RowsetSharedPtr rowset, OlapReaderStatistics& stats, std::string& values,
168
                           bool write_to_cache = false);
169
    // Lookup the row location of `encoded_key`, the function sets `row_location` on success.
170
    // NOTE: the method only works in unique key model with primary key index, you will got a
171
    //       not supported error in other data model.
172
    Status lookup_row_key(const Slice& encoded_key, TabletSchema* latest_schema, bool with_seq_col,
173
                          const std::vector<RowsetSharedPtr>& specified_rowsets,
174
                          RowLocation* row_location, int64_t version,
175
                          std::vector<std::unique_ptr<SegmentCacheHandle>>& segment_caches,
176
                          RowsetSharedPtr* rowset = nullptr, bool with_rowid = true,
177
                          std::string* encoded_seq_value = nullptr,
178
                          OlapReaderStatistics* stats = nullptr,
179
                          DeleteBitmapPtr tablet_delete_bitmap = nullptr);
180
181
    // calc delete bitmap when flush memtable, use a fake version to calc
182
    // For example, cur max version is 5, and we use version 6 to calc but
183
    // finally this rowset publish version with 8, we should make up data
184
    // for rowset 6-7. Also, if a compaction happens between commit_txn and
185
    // publish_txn, we should remove compaction input rowsets' delete_bitmap
186
    // and build newly generated rowset's delete_bitmap
187
    static Status calc_delete_bitmap(const BaseTabletSPtr& tablet, RowsetSharedPtr rowset,
188
                                     const std::vector<segment_v2::SegmentSharedPtr>& segments,
189
                                     const std::vector<RowsetSharedPtr>& specified_rowsets,
190
                                     DeleteBitmapPtr delete_bitmap, int64_t version,
191
                                     CalcDeleteBitmapToken* token,
192
                                     RowsetWriter* rowset_writer = nullptr,
193
                                     DeleteBitmapPtr tablet_delete_bitmap = nullptr);
194
195
    Status calc_segment_delete_bitmap(RowsetSharedPtr rowset,
196
                                      const segment_v2::SegmentSharedPtr& seg,
197
                                      const std::vector<RowsetSharedPtr>& specified_rowsets,
198
                                      DeleteBitmapPtr delete_bitmap, int64_t end_version,
199
                                      RowsetWriter* rowset_writer,
200
                                      DeleteBitmapPtr tablet_delete_bitmap = nullptr);
201
202
    Status calc_delete_bitmap_between_segments(
203
            TabletSchemaSPtr schema, RowsetId rowset_id,
204
            const std::vector<segment_v2::SegmentSharedPtr>& segments,
205
            DeleteBitmapPtr delete_bitmap);
206
207
    static Status commit_phase_update_delete_bitmap(
208
            const BaseTabletSPtr& tablet, const RowsetSharedPtr& rowset,
209
            RowsetIdUnorderedSet& pre_rowset_ids, DeleteBitmapPtr delete_bitmap,
210
            const std::vector<segment_v2::SegmentSharedPtr>& segments, int64_t txn_id,
211
            CalcDeleteBitmapToken* token, RowsetWriter* rowset_writer = nullptr);
212
213
    static void add_sentinel_mark_to_delete_bitmap(DeleteBitmap* delete_bitmap,
214
                                                   const RowsetIdUnorderedSet& rowsetids);
215
216
    Status check_delete_bitmap_correctness(DeleteBitmapPtr delete_bitmap, int64_t max_version,
217
                                           int64_t txn_id, const RowsetIdUnorderedSet& rowset_ids,
218
                                           std::vector<RowsetSharedPtr>* rowsets = nullptr);
219
220
    static const signed char* get_delete_sign_column_data(const Block& block,
221
                                                          size_t rows_at_least = 0);
222
223
    static Status generate_default_value_block(const TabletSchema& schema,
224
                                               const std::vector<uint32_t>& cids,
225
                                               const std::vector<std::string>& default_values,
226
                                               const Block& ref_block, Block& default_value_block);
227
228
    static Status generate_new_block_for_partial_update(
229
            TabletSchemaSPtr rowset_schema, const PartialUpdateInfo* partial_update_info,
230
            const FixedReadPlan& read_plan_ori, const FixedReadPlan& read_plan_update,
231
            const std::map<RowsetId, RowsetSharedPtr>& rsid_to_rowset, Block* output_block);
232
233
    static Status generate_new_block_for_flexible_partial_update(
234
            TabletSchemaSPtr rowset_schema, const PartialUpdateInfo* partial_update_info,
235
            std::set<uint32_t>& rids_be_overwritten, const FixedReadPlan& read_plan_ori,
236
            const FixedReadPlan& read_plan_update,
237
            const std::map<RowsetId, RowsetSharedPtr>& rsid_to_rowset, Block* output_block);
238
239
    // We use the TabletSchema from the caller because the TabletSchema in the rowset'meta
240
    // may be outdated due to schema change. Also note that the the cids should indicate the indexes
241
    // of the columns in the TabletSchema passed in.
242
    static Status fetch_value_through_row_column(RowsetSharedPtr input_rowset,
243
                                                 const TabletSchema& tablet_schema, uint32_t segid,
244
                                                 const std::vector<uint32_t>& rowids,
245
                                                 const std::vector<uint32_t>& cids, Block& block);
246
247
    static Status fetch_value_by_rowids(RowsetSharedPtr input_rowset, uint32_t segid,
248
                                        const std::vector<uint32_t>& rowids,
249
                                        const TabletColumn& tablet_column, MutableColumnPtr& dst);
250
251
    virtual Result<std::unique_ptr<RowsetWriter>> create_transient_rowset_writer(
252
            const Rowset& rowset, std::shared_ptr<PartialUpdateInfo> partial_update_info,
253
            int64_t txn_expiration = 0) = 0;
254
255
    static Status update_delete_bitmap(const BaseTabletSPtr& self, TabletTxnInfo* txn_info,
256
                                       int64_t txn_id, int64_t txn_expiration = 0,
257
                                       DeleteBitmapPtr tablet_delete_bitmap = nullptr);
258
    virtual Status save_delete_bitmap(const TabletTxnInfo* txn_info, int64_t txn_id,
259
                                      DeleteBitmapPtr delete_bitmap, RowsetWriter* rowset_writer,
260
                                      const RowsetIdUnorderedSet& cur_rowset_ids,
261
                                      int64_t lock_id = -1, int64_t next_visible_version = -1) = 0;
262
    virtual CalcDeleteBitmapExecutor* calc_delete_bitmap_executor() = 0;
263
264
    void calc_compaction_output_rowset_delete_bitmap(
265
            const std::vector<RowsetSharedPtr>& input_rowsets,
266
            const RowIdConversion& rowid_conversion, uint64_t start_version, uint64_t end_version,
267
            std::set<RowLocation>* missed_rows,
268
            std::map<RowsetSharedPtr, std::list<std::pair<RowLocation, RowLocation>>>* location_map,
269
            const DeleteBitmap& input_delete_bitmap, DeleteBitmap* output_rowset_delete_bitmap);
270
271
    Status check_rowid_conversion(
272
            RowsetSharedPtr dst_rowset,
273
            const std::map<RowsetSharedPtr, std::list<std::pair<RowLocation, RowLocation>>>&
274
                    location_map);
275
276
    static Status update_delete_bitmap_without_lock(
277
            const BaseTabletSPtr& self, const RowsetSharedPtr& rowset,
278
            const std::vector<RowsetSharedPtr>* specified_base_rowsets = nullptr);
279
280
    using DeleteBitmapKeyRanges =
281
            std::vector<std::tuple<DeleteBitmap::BitmapKey, DeleteBitmap::BitmapKey>>;
282
    void agg_delete_bitmap_for_stale_rowsets(
283
            Version version, DeleteBitmapKeyRanges& remove_delete_bitmap_key_ranges);
284
    void check_agg_delete_bitmap_for_stale_rowsets(int64_t& useless_rowset_count,
285
                                                   int64_t& useless_rowset_version_count);
286
    ////////////////////////////////////////////////////////////////////////////
287
    // end MoW functions
288
    ////////////////////////////////////////////////////////////////////////////
289
290
    RowsetSharedPtr get_rowset(const RowsetId& rowset_id);
291
292
    std::vector<RowsetSharedPtr> get_snapshot_rowset(bool include_stale_rowset = false) const;
293
294
    virtual void clear_cache() = 0;
295
296
    // Find the first consecutive empty rowsets. output->size() >= limit
297
    void calc_consecutive_empty_rowsets(std::vector<RowsetSharedPtr>* empty_rowsets,
298
                                        const std::vector<RowsetSharedPtr>& candidate_rowsets,
299
                                        int64_t limit);
300
301
    void traverse_rowsets(std::function<void(const RowsetSharedPtr&)> visitor,
302
11
                          bool include_stale = false) {
303
11
        std::shared_lock rlock(_meta_lock);
304
11
        traverse_rowsets_unlocked(visitor, include_stale);
305
11
    }
306
307
    void traverse_rowsets_unlocked(std::function<void(const RowsetSharedPtr&)> visitor,
308
16
                                   bool include_stale = false) const {
309
85
        for (auto& [v, rs] : _rs_version_map) {
310
85
            visitor(rs);
311
85
        }
312
16
        if (!include_stale) return;
313
81
        for (auto& [v, rs] : _stale_rs_version_map) {
314
81
            visitor(rs);
315
81
        }
316
15
    }
317
318
    Status calc_file_crc(uint32_t* crc_value, int64_t start_version, int64_t end_version,
319
                         uint32_t* rowset_count, int64_t* file_count);
320
321
    Status show_nested_index_file(std::string* json_meta);
322
323
12.5k
    TabletUid tablet_uid() const { return _tablet_meta->tablet_uid(); }
324
579
    TabletInfo get_tablet_info() const { return TabletInfo(tablet_id(), tablet_uid()); }
325
326
    void get_base_rowset_delete_bitmap_count(
327
            uint64_t* max_base_rowset_delete_bitmap_score,
328
            int64_t* max_base_rowset_delete_bitmap_score_tablet_id);
329
330
3
    virtual Status check_delete_bitmap_cache(int64_t txn_id, DeleteBitmap* expected_delete_bitmap) {
331
3
        return Status::OK();
332
3
    }
333
334
    void prefill_dbm_agg_cache(const RowsetSharedPtr& rowset, int64_t version);
335
    void prefill_dbm_agg_cache_after_compaction(const RowsetSharedPtr& output_rowset);
336
337
    [[nodiscard]] Result<CaptureRowsetResult> capture_consistent_rowsets_unlocked(
338
            const Version& version_range, const CaptureRowsetOps& options) const;
339
340
    [[nodiscard]] virtual Result<std::vector<Version>> capture_consistent_versions_unlocked(
341
            const Version& version_range, const CaptureRowsetOps& options) const;
342
343
    [[nodiscard]] Result<std::vector<RowSetSplits>> capture_rs_readers_unlocked(
344
            const Version& version_range, const CaptureRowsetOps& options) const;
345
346
    [[nodiscard]] Result<TabletReadSource> capture_read_source(const Version& version_range,
347
                                                               const CaptureRowsetOps& options);
348
349
protected:
350
    // Find the missed versions until the spec_version.
351
    //
352
    // for example:
353
    //     [0-4][5-5][8-8][9-9][14-14]
354
    // for cloud, if spec_version = 12, it will return [6-7],[10-12]
355
    // for local, if spec_version = 12, it will return [6, 6], [7, 7], [10, 10], [11, 11], [12, 12]
356
    virtual Versions calc_missed_versions(int64_t spec_version,
357
                                          Versions existing_versions) const = 0;
358
359
    void _print_missed_versions(const Versions& missed_versions) const;
360
    bool _reconstruct_version_tracker_if_necessary();
361
362
    static void _rowset_ids_difference(const RowsetIdUnorderedSet& cur,
363
                                       const RowsetIdUnorderedSet& pre,
364
                                       RowsetIdUnorderedSet* to_add, RowsetIdUnorderedSet* to_del);
365
366
    // We can only know if a key is excluded from the segment
367
    // based on strictly order compare result with segments key bounds
368
    static bool _key_is_not_in_segment(Slice key, const KeyBoundsPB& segment_key_bounds,
369
                                       bool is_segments_key_bounds_truncated);
370
371
    Status sort_block(Block& in_block, Block& output_block);
372
373
    Result<CaptureRowsetResult> _remote_capture_rowsets(const Version& version_range) const;
374
375
    mutable std::shared_mutex _meta_lock;
376
    TimestampedVersionTracker _timestamped_version_tracker;
377
    TimestampedVersionTracker _row_binlog_version_tracker;
378
379
    // After version 0.13, all newly created rowsets are saved in _rs_version_map.
380
    // And if rowset being compacted, the old rowsets will be saved in _stale_rs_version_map;
381
    std::unordered_map<Version, RowsetSharedPtr, HashOfVersion> _rs_version_map;
382
    // This variable _stale_rs_version_map is used to record these rowsets which are be compacted.
383
    // These _stale rowsets are been removed when rowsets' pathVersion is expired,
384
    // this policy is judged and computed by TimestampedVersionTracker.
385
    std::unordered_map<Version, RowsetSharedPtr, HashOfVersion> _stale_rs_version_map;
386
    // for row_binlog
387
    std::unordered_map<Version, RowsetSharedPtr, HashOfVersion> _row_binlog_rs_version_map;
388
    const TabletMetaSharedPtr _tablet_meta;
389
    TabletSchemaSPtr _max_version_schema;
390
391
    // `_alter_failed` is used to indicate whether the tablet failed to perform a schema change
392
    std::atomic<bool> _alter_failed = false;
393
394
    // metrics of this tablet
395
    std::shared_ptr<MetricEntity> _metric_entity;
396
397
protected:
398
    std::timed_mutex _schema_change_lock;
399
400
public:
401
    IntCounter* query_scan_bytes = nullptr;
402
    IntCounter* query_scan_rows = nullptr;
403
    IntCounter* query_scan_count = nullptr;
404
    IntCounter* flush_bytes = nullptr;
405
    IntCounter* flush_finish_count = nullptr;
406
    std::atomic<int64_t> published_count = 0;
407
    std::atomic<int64_t> read_block_count = 0;
408
    std::atomic<int64_t> write_count = 0;
409
    std::atomic<int64_t> compaction_count = 0;
410
411
    CompactionStage compaction_stage = CompactionStage::NOT_SCHEDULED;
412
    // Separate sample_infos for each compaction type to avoid race condition
413
    // when different types of compaction run concurrently on the same tablet
414
    std::mutex cumu_sample_info_lock;
415
    std::mutex base_sample_info_lock;
416
    std::mutex full_sample_info_lock;
417
    std::vector<CompactionSampleInfo> cumu_sample_infos;
418
    std::vector<CompactionSampleInfo> base_sample_infos;
419
    std::vector<CompactionSampleInfo> full_sample_infos;
420
    Status last_compaction_status = Status::OK();
421
422
4.37k
    std::mutex& get_sample_info_lock(ReaderType reader_type) {
423
4.37k
        switch (reader_type) {
424
1.50k
        case ReaderType::READER_CUMULATIVE_COMPACTION:
425
1.50k
            return cumu_sample_info_lock;
426
1.68k
        case ReaderType::READER_BASE_COMPACTION:
427
1.68k
            return base_sample_info_lock;
428
1.50k
        case ReaderType::READER_FULL_COMPACTION:
429
1.50k
            return full_sample_info_lock;
430
0
        default:
431
            // For other compaction types, use base_sample_info_lock as default
432
0
            return base_sample_info_lock;
433
4.37k
        }
434
4.37k
    }
435
436
4.25k
    std::vector<CompactionSampleInfo>& get_sample_infos(ReaderType reader_type) {
437
4.25k
        switch (reader_type) {
438
1.50k
        case ReaderType::READER_CUMULATIVE_COMPACTION:
439
1.50k
            return cumu_sample_infos;
440
1.68k
        case ReaderType::READER_BASE_COMPACTION:
441
1.68k
            return base_sample_infos;
442
1.50k
        case ReaderType::READER_FULL_COMPACTION:
443
1.50k
            return full_sample_infos;
444
3
        default:
445
            // For other compaction types, use base_sample_infos as default
446
3
            return base_sample_infos;
447
4.25k
        }
448
4.25k
    }
449
450
    // Density ratio for sparse optimization (non_null_cells / total_cells)
451
    // Value range: [0.0, 1.0], smaller value means more sparse
452
    // Default 1.0 means no history data, will not enable sparse optimization initially
453
    std::atomic<double> compaction_density {1.0};
454
};
455
456
struct CaptureRowsetOps {
457
    bool skip_missing_versions = false;
458
    bool quiet = false;
459
    bool include_stale_rowsets = true;
460
    bool enable_fetch_rowsets_from_peers = false;
461
    bool capture_row_binlog = false;
462
463
    // ======== only take effect in cloud mode ========
464
465
    // Enable preference for cached/warmed-up rowsets when building version paths.
466
    // When enabled, the capture process will prioritize already cached rowsets
467
    // to avoid cold data reads and improve query performance.
468
    bool enable_prefer_cached_rowset {false};
469
470
    // Query freshness tolerance in milliseconds.
471
    // Defines the time window for considering data as "fresh enough".
472
    // Rowsets that became visible within this time range can be skipped if not warmed up,
473
    // but older rowsets (before current_time - query_freshness_tolerance_ms) that are
474
    // not warmed up will trigger fallback to normal capture.
475
    // Set to -1 to disable freshness tolerance checking.
476
    int64_t query_freshness_tolerance_ms {-1};
477
};
478
479
struct CaptureRowsetResult {
480
    std::vector<RowsetSharedPtr> rowsets;
481
    std::shared_ptr<DeleteBitmap> delete_bitmap;
482
};
483
484
struct TabletReadSource {
485
    std::vector<RowSetSplits> rs_splits;
486
    std::vector<RowsetMetaSharedPtr> delete_predicates;
487
    std::shared_ptr<DeleteBitmap> delete_bitmap;
488
    // Fill delete predicates with `rs_splits`
489
    void fill_delete_predicates();
490
};
491
492
} /* namespace doris */