Skip to content

[fix](filecache) reject oversized block size in add_cell#62878

Open
deardeng wants to merge 2 commits intoapache:masterfrom
deardeng:fix-add-cell
Open

[fix](filecache) reject oversized block size in add_cell#62878
deardeng wants to merge 2 commits intoapache:masterfrom
deardeng:fix-add-cell

Conversation

@deardeng
Copy link
Copy Markdown
Collaborator

When directory_entry::file_size(ec) fails, it returns (uintmax_t)-1. load_cache_info_into_memory did not check ec, so UINT64_MAX flowed into add_cell, which only warned and then registered the cell — corrupting _files, LRUQueue::cache_size, _cur_cache_size, and the LRU dump (survives restart).

  • fs_file_cache_storage: check ec after file_size, skip on error
  • add_cell: turn the >1GiB check into a hard reject (return nullptr)
  • UT: add_cell_rejects_oversized_size

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

When directory_entry::file_size(ec) fails, it returns (uintmax_t)-1.
load_cache_info_into_memory did not check ec, so UINT64_MAX flowed
into add_cell, which only warned and then registered the cell —
corrupting _files, LRUQueue::cache_size, _cur_cache_size, and the
LRU dump (survives restart).

- fs_file_cache_storage: check ec after file_size, skip on error
- add_cell: turn the >1GiB check into a hard reject (return nullptr)
- UT: add_cell_rejects_oversized_size
@hello-stephen
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?

@deardeng
Copy link
Copy Markdown
Collaborator Author

run buildall

@deardeng
Copy link
Copy Markdown
Collaborator Author

run buildall

friend class CacheLRUDumper;
friend class LRUQueueRecorder;
friend struct FileBlockCell;
friend class BlockFileCacheTest;
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.

what is this for?

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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

@github-actions
Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@deardeng
Copy link
Copy Markdown
Collaborator Author

run beut

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 28.57% (2/7) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.34% (20417/38274)
Line Coverage 36.90% (192455/521570)
Region Coverage 33.23% (149789/450789)
Branch Coverage 34.34% (65516/190778)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/3.1.x dev/4.0.x dev/4.1.x reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants