Skip to content

PageStorage: Fix an exception in gc when meet an empty WriteBatch#10406

Merged
ti-chi-bot[bot] merged 2 commits intopingcap:masterfrom
JaySon-Huang:fix_exception_in_gc
Sep 5, 2025
Merged

PageStorage: Fix an exception in gc when meet an empty WriteBatch#10406
ti-chi-bot[bot] merged 2 commits intopingcap:masterfrom
JaySon-Huang:fix_exception_in_gc

Conversation

@JaySon-Huang
Copy link
Copy Markdown
Contributor

@JaySon-Huang JaySon-Huang commented Sep 4, 2025

What problem does this PR solve?

Issue Number: close #10401

Problem Summary:

In the previous code, if the last WriteBatch contains no changes is persisted in the LogFile, then it may lead to exception in getMaxSequenceForRecord as the issue describe.

What is changed and how it works?

PageStorage: Fix an exception in gc when meet an empty WriteBatch
* If the last edit stored in Logfile is empty, then we won't collect that LogFile for compacting WAL in the current GC round
* These remain log_files will be compacted in the following rounds once we found a log_file has larger log_num and its max_seq <= snap_sequence.

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 exception that may block data from being GCed

Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot Bot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Sep 4, 2025
Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot Bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 5, 2025
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented Sep 5, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JinheLin, Lloyd-Pottiger

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [JinheLin,Lloyd-Pottiger]

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 Sep 5, 2025
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented Sep 5, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-09-05 01:52:56.532365903 +0000 UTC m=+144720.515463341: ☑️ agreed by Lloyd-Pottiger.
  • 2025-09-05 02:35:15.052535014 +0000 UTC m=+147259.035632492: ☑️ agreed by JinheLin.

@ti-chi-bot ti-chi-bot Bot merged commit f60daa9 into pingcap:master Sep 5, 2025
7 checks passed
@JaySon-Huang JaySon-Huang deleted the fix_exception_in_gc branch September 5, 2025 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PageStorage GC is blocked by empty record in the WAL file

3 participants