Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageStorage: Fix empty page cause TiFlash failed to start (#9283) #9286

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #9283

What problem does this PR solve?

Issue Number: close #9282

Problem Summary:

By dumping the entries from PageStorage WAL, we can locate that two entries cause this issue:

[PageDirectoryFactory.cpp:225] ["{type:VAR_ENT, page_id:0x020102000000009CA4430A08, ori_id:0x.0, version:108969363.0, entry:PageEntry{file: 551, offset: 0x15376, size: 0, checksum: 0x0, tag: 0, field_offsets: [], checkpoint_info: invalid}, being_ref_count:1}"] [thread_id=1]
[PageDirectoryFactory.cpp:225] ["{type:PUT    , page_id:0x020102000000018204A17C03, ori_id:0x.0, version:127726467.0, entry:PageEntry{file: 551, offset: 0x15373, size: 15, checksum: 0x12D46C1C0D5B51FE, tag: 0, field_offsets: [], checkpoint_info: invalid}, being_ref_count:1}"] [thread_id=1]

The first entry is a page with data.size == 0, placed at blob_id=551, offset=0x15376. And later another page is placed at blob_id=551, offset=0x15373 with data.size == 15.
The first page split the free block into smaller pieces free blocks.
The second page will cover the place of the first page. And our code can not handle this situation with "empty page data".

What is changed and how it works?

  • For handling the existing empty pages, we won't let it split the free block into small pieces:
    • when STDMapSpaceMap::markUsedImpl accept a block of length == 0, it will directly return true instead of splitting the free block into smaller pieces.
  • For newly created empty pages, we store them at the front of BlobFile to avoid further issues:
    • BlobStats::BlobStat::getPosFromStat and STDMapSpaceMap::searchInsertOffset accepts a block of length == 0, it will return insert_offset == 0, which we can "store the empty pages" at the front of the BlobFile for newly created empty pages.
  • In BlobStore::read(...), we ensure that reading empty pages won't cause NPE or other unexpected exceptions
PageStorage: Fix empty page cause TiFlash failed to start

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Fix an issue that TiFlash write node may fail to restart under disaggregated arch

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR. labels Aug 5, 2024
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 5, 2024
@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Aug 5, 2024
@JaySon-Huang
Copy link
Contributor

/run-all-tests

Copy link
Contributor

ti-chi-bot bot commented Aug 5, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CalvinNeo, JaySon-Huang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [CalvinNeo,JaySon-Huang]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 5, 2024
Copy link
Contributor

ti-chi-bot bot commented Aug 5, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-05 04:37:32.799652816 +0000 UTC m=+240382.666751898: ☑️ agreed by CalvinNeo.
  • 2024-08-05 11:13:14.148633418 +0000 UTC m=+264124.015732507: ☑️ agreed by JaySon-Huang.

@ti-chi-bot ti-chi-bot bot merged commit a344e3d into pingcap:release-7.5 Aug 5, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants