Skip to content

[Improve](segment) Put Segment footer into index page cache - #56382

Merged
eldenmoon merged 1 commit into
apache:masterfrom
eldenmoon:opt_footer_cache
Sep 25, 2025
Merged

[Improve](segment) Put Segment footer into index page cache#56382
eldenmoon merged 1 commit into
apache:masterfrom
eldenmoon:opt_footer_cache

Conversation

@eldenmoon

Copy link
Copy Markdown
Member

This commit modified the caching logic for the Segment footer.

Previously, the Segment footer was cached in the DATA_PAGE cache. This was incorrect as the footer is metadata, not data. This commit changes it to use the more appropriate INDEX_PAGE cache.

Additionally, the calculation for _meta_mem_usage has been adjusted for better accuracy. The footer size is no longer included in the calculation since it's now managed by the StoragePageCache. The memory estimation for column readers is also updated to use
config::max_segment_partial_column_cache_size for a more realistic value.

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@Thearas

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@eldenmoon

Copy link
Copy Markdown
MemberAuthor

run buildall

Comment threadbe/src/olap/rowset/segment_v2/segment.cpp Outdated
@eldenmoon

Copy link
Copy Markdown
MemberAuthor

run buildall

This commit modified the caching logic for the Segment
footer.
Previously, the Segment footer was cached in the `DATA_PAGE`
cache. This was incorrect as the footer is metadata, not
data. This commit changes it to use the more appropriate
`INDEX_PAGE` cache.
Additionally, the calculation for `_meta_mem_usage` has been
adjusted for better accuracy. The footer size is no longer
included in the calculation since it's now managed by the
`StoragePageCache`. The memory estimation for column readers
is also updated to use
`config::max_segment_partial_column_cache_size` for a more
realistic value.
@eldenmoon

Copy link
Copy Markdown
MemberAuthor

run buildall

@csun5285csun5285 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (5/5) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage52.40% (17648/33677)
Line Coverage37.66% (160372/425883)
Region Coverage32.17% (122094/379533)
Branch Coverage33.53% (53551/159732)

@doris-robot

Copy link
Copy Markdown
ClickBench: Total hot run time: 30.68 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 9c57d4b9627b0b55019ddc7242a8f132d9de4356, data reload: false
query1	0.05	0.05	0.05
query2	0.09	0.05	0.06
query3	0.27	0.09	0.09
query4	1.61	0.12	0.12
query5	0.30	0.26	0.25
query6	1.20	0.67	0.64
query7	0.03	0.02	0.03
query8	0.06	0.05	0.05
query9	0.61	0.52	0.51
query10	0.61	0.57	0.57
query11	0.16	0.11	0.11
query12	0.15	0.11	0.12
query13	0.63	0.63	0.61
query14	1.03	1.04	1.05
query15	0.89	0.86	0.86
query16	0.42	0.40	0.39
query17	1.04	1.07	1.06
query18	0.22	0.20	0.20
query19	2.23	1.98	2.01
query20	0.02	0.01	0.01
query21	15.70	0.95	0.58
query22	0.77	1.06	0.70
query23	15.05	1.36	0.64
query24	6.89	2.05	0.88
query25	0.50	0.25	0.15
query26	0.57	0.16	0.14
query27	0.06	0.06	0.06
query28	10.20	1.36	0.94
query29	12.54	3.91	3.25
query30	0.27	0.13	0.12
query31	2.83	0.61	0.38
query32	3.26	0.56	0.47
query33	3.20	3.03	3.18
query34	16.17	5.50	4.86
query35	4.93	4.89	4.91
query36	0.70	0.53	0.49
query37	0.10	0.08	0.08
query38	0.06	0.04	0.04
query39	0.03	0.02	0.03
query40	0.17	0.15	0.14
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 105.79 s
Total hot run time: 30.68 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (5/5) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.17% (23409/32890)
Line Coverage57.57% (244538/424730)
Region Coverage52.97% (203681/384538)
Branch Coverage54.59% (87544/160363)

@HappenLeeHappenLee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Sep 25, 2025
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@eldenmoon
eldenmoon merged commit 09baadf into apache:masterSep 25, 2025
26 of 29 checks passed
github-actionsBot pushed a commit that referenced this pull request Sep 25, 2025
This commit modified the caching logic for the Segment footer.
Previously, the Segment footer was cached in the `DATA_PAGE` cache. This
was incorrect as the footer is metadata, not data. This commit changes
it to use the more appropriate `INDEX_PAGE` cache.
Additionally, the calculation for `_meta_mem_usage` has been adjusted
for better accuracy. The footer size is no longer included in the
calculation since it's now managed by the `StoragePageCache`. The memory
estimation for column readers is also updated to use
`config::max_segment_partial_column_cache_size` for a more realistic
value.
github-actionsBot pushed a commit that referenced this pull request Sep 25, 2025
This commit modified the caching logic for the Segment footer.
Previously, the Segment footer was cached in the `DATA_PAGE` cache. This
was incorrect as the footer is metadata, not data. This commit changes
it to use the more appropriate `INDEX_PAGE` cache.
Additionally, the calculation for `_meta_mem_usage` has been adjusted
for better accuracy. The footer size is no longer included in the
calculation since it's now managed by the `StoragePageCache`. The memory
estimation for column readers is also updated to use
`config::max_segment_partial_column_cache_size` for a more realistic
value.
yiguolei pushed a commit that referenced this pull request Sep 27, 2025
#56382 (#56460)
Cherry-picked from #56382
Co-authored-by: lihangyu <lihangyu@selectdb.com>
morrySnow pushed a commit that referenced this pull request Sep 28, 2025
#56382 (#56459)
Cherry-picked from #56382
Co-authored-by: lihangyu <lihangyu@selectdb.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.dev/3.1.2-mergeddev/4.0.0-mergedreviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@eldenmoon@Thearas@hello-stephen@doris-robot@HappenLee@csun5285@yiguolei@morrySnow