This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 19f4e25fc3b branch-4.0: [Improve](segment) Put Segment footer into
index page cache #56382 (#56460)
19f4e25fc3b is described below
commit 19f4e25fc3b52bdb90c79cde045b0efebcbe555b
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Sep 27 09:53:27 2025 +0800
branch-4.0: [Improve](segment) Put Segment footer into index page cache
#56382 (#56460)
Cherry-picked from #56382
Co-authored-by: lihangyu <[email protected]>
---
be/src/olap/rowset/segment_v2/segment.cpp | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/be/src/olap/rowset/segment_v2/segment.cpp
b/be/src/olap/rowset/segment_v2/segment.cpp
index eadf3abf3d8..9334d75fb16 100644
--- a/be/src/olap/rowset/segment_v2/segment.cpp
+++ b/be/src/olap/rowset/segment_v2/segment.cpp
@@ -197,13 +197,16 @@ Status Segment::_open(OlapReaderStatistics* stats) {
_num_rows = footer_pb_shared->num_rows();
// An estimated memory usage of a segment
- _meta_mem_usage += footer_pb_shared->ByteSizeLong();
+ // Footer is seperated to StoragePageCache so we don't need to add it to
_meta_mem_usage
+ // _meta_mem_usage += footer_pb_shared->ByteSizeLong();
if (_pk_index_meta != nullptr) {
_meta_mem_usage += _pk_index_meta->ByteSizeLong();
}
_meta_mem_usage += sizeof(*this);
- _meta_mem_usage += _tablet_schema->num_columns() *
config::estimated_mem_per_column_reader;
+ _meta_mem_usage +=
std::min(static_cast<int>(_tablet_schema->num_columns()),
+ config::max_segment_partial_column_cache_size)
*
+ config::estimated_mem_per_column_reader;
// 1024 comes from SegmentWriterOptions
_meta_mem_usage += (_num_rows + 1023) / 1024 * (36 + 4);
@@ -1064,11 +1067,16 @@ Status
Segment::_get_segment_footer(std::shared_ptr<SegmentFooterPB>& footer_pb,
PageCacheHandle cache_handle;
+ // Put segment footer into index page cache.
+ // Rationale:
+ // - Footer is metadata (small, parsed with indexes), not data page
payload.
+ // - Using PageTypePB::INDEX_PAGE keeps it under the same eviction
policy/shards
+ // as other index/metadata pages and avoids competing with DATA_PAGE
budget.
if (!segment_footer_cache->lookup(cache_key, &cache_handle,
- segment_v2::PageTypePB::DATA_PAGE)) {
+ segment_v2::PageTypePB::INDEX_PAGE)) {
RETURN_IF_ERROR(_parse_footer(footer_pb_shared, stats));
segment_footer_cache->insert(cache_key, footer_pb_shared,
footer_pb_shared->ByteSizeLong(),
- &cache_handle,
segment_v2::PageTypePB::DATA_PAGE);
+ &cache_handle,
segment_v2::PageTypePB::INDEX_PAGE);
} else {
VLOG_DEBUG << fmt::format("Segment footer of {}:{}:{} is found in
cache",
_file_reader->path().native(),
_file_reader->size(),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]