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: handle ref and full gc after restart #7931

Merged
merged 11 commits into from
Aug 11, 2023

Conversation

JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Aug 11, 2023

What problem does this PR solve?

Issue Number: close #7915

Problem Summary:
In the previous PR #7920, we can not handle the full GC properly. It will ignore all
UPSERT entries that is created by blobstore full gc. Because full gc will use a version=<old_version, old_epoch+1> for the UPSERT entries in WAL log files.

20230811-115816

What is changed and how it works?

As only the REF is not an idempotent operation, when loading edit from disk to restore the PageDirectory, it could re-apply a REF to an non-existing page_id that is already deleted in the dumped snapshot.
All other operation is idempotent operations. So we filter the REF record which is less than or equal to the filter_seq
For example, in the previous case, we will ignore the REF 2->1 record when restoring from disk.

And after #7668, we could apply UPSERT record that the page_id is "deleted" in the dumped snapshot. So we relax the check when a UPSERT record is apply

hint: ignore the commit "Format files": https://github.com/pingcap/tiflash/pull/7931/files/f2167112e883da119e2806e3280f49a01c15e125..01affc15ef42aa43bdcbb5688f73cbe85387f001

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

None

@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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 11, 2023
@JaySon-Huang
Copy link
Contributor Author

/rebuild

Copy link
Contributor

@lidezhu lidezhu left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 11, 2023
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

Signed-off-by: JaySon-Huang <[email protected]>
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/rebuild

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 11, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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 [Lloyd-Pottiger,lidezhu]

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 the lgtm label Aug 11, 2023
@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 11, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 11, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-11 07:22:39.801295237 +0000 UTC m=+270124.350311218: ☑️ agreed by lidezhu.
  • 2023-08-11 08:28:31.024961753 +0000 UTC m=+274075.573977740: ☑️ agreed by Lloyd-Pottiger.

Comment on lines 240 to 241
auto field_begin_in_buf
= cur_field_begin <= buffer_begin_in_page ? 0 : cur_field_begin - buffer_begin_in_page;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
auto field_begin_in_buf
= cur_field_begin <= buffer_begin_in_page ? 0 : cur_field_begin - buffer_begin_in_page;
auto field_begin_in_buf = cur_field_begin <= buffer_begin_in_page
? 0
: cur_field_begin - buffer_begin_in_page;

@JaySon-Huang
Copy link
Contributor Author

/run-integration-test

@JaySon-Huang
Copy link
Contributor Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 11, 2023
@JaySon-Huang
Copy link
Contributor Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 11, 2023
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 11, 2023
@JaySon-Huang
Copy link
Contributor Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 11, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 11, 2023

@JaySon-Huang: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

trigger some heavy tests which will not run always when PR updated.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@JaySon-Huang
Copy link
Contributor Author

/run-unit-test

@ti-chi-bot ti-chi-bot bot merged commit 6f7c647 into pingcap:master Aug 11, 2023
@JaySon-Huang JaySon-Huang deleted the fix-crash-0808 branch August 11, 2023 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TiFlash crash after restart for Trying to add ref to non-exist page
3 participants