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

br: fix panic during merging files #33797

Merged
merged 5 commits into from
Apr 15, 2022
Merged

Conversation

YuJuncen
Copy link
Contributor

@YuJuncen YuJuncen commented Apr 7, 2022

Signed-off-by: Yu Juncen [email protected]

What problem does this PR solve?

Issue Number: close #33801

Problem Summary:
The merge small files operation may panic because it try to decode the index value, however the region boundary is sometime weird and make TiDB panic.

What is changed and how it works?

This PR use DecodeKeyHead to replace DecodeIndexKey, which won't try to decode the index value.

Check List

Tests

  • Unit test
    A fuzz test shows that this change is probably panic-free:
> go test -fuzz=FuzzMerge br/pkg/restore/merge_fuzz_test.go
fuzz: elapsed: 0s, gathering baseline coverage: 0/81 completed
fuzz: elapsed: 3s, gathering baseline coverage: 81/81 completed, now fuzzing with 17 workers
fuzz: elapsed: 3s, execs: 81 (27/sec), new interesting: 0 (total: 81)
fuzz: elapsed: 6s, execs: 8727 (2883/sec), new interesting: 5 (total: 86)
fuzz: elapsed: 9s, execs: 17959 (3077/sec), new interesting: 12 (total: 93)
fuzz: elapsed: 12s, execs: 47126 (9724/sec), new interesting: 20 (total: 101)
fuzz: elapsed: 15s, execs: 65828 (6234/sec), new interesting: 23 (total: 104)
fuzz: elapsed: 18s, execs: 88492 (7553/sec), new interesting: 25 (total: 106)
fuzz: elapsed: 21s, execs: 105989 (5833/sec), new interesting: 25 (total: 106)
fuzz: elapsed: 24s, execs: 151362 (15123/sec), new interesting: 28 (total: 109)
fuzz: elapsed: 27s, execs: 183271 (10637/sec), new interesting: 29 (total: 110)
fuzz: elapsed: 30s, execs: 216909 (11214/sec), new interesting: 31 (total: 112)
fuzz: elapsed: 33s, execs: 254825 (12636/sec), new interesting: 35 (total: 116)
fuzz: elapsed: 36s, execs: 278409 (7863/sec), new interesting: 35 (total: 116)
fuzz: elapsed: 39s, execs: 325000 (15529/sec), new interesting: 35 (total: 116)
fuzz: elapsed: 42s, execs: 346768 (7255/sec), new interesting: 35 (total: 116)
fuzz: elapsed: 45s, execs: 367738 (6991/sec), new interesting: 35 (total: 116)
fuzz: elapsed: 48s, execs: 406754 (13006/sec), new interesting: 35 (total: 116)
fuzz: elapsed: 51s, execs: 424218 (5819/sec), new interesting: 35 (total: 116)
fuzz: elapsed: 54s, execs: 439857 (5214/sec), new interesting: 35 (total: 116)
fuzz: elapsed: 57s, execs: 459651 (6597/sec), new interesting: 35 (total: 116)
fuzz: elapsed: 1m0s, execs: 480267 (6873/sec), new interesting: 35 (total: 116)
^Cfuzz: elapsed: 1m1s, execs: 485575 (5989/sec), new interesting: 35 (total: 116)
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Fix a bug that caused BR panics sometime when merge small file enabled.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Apr 7, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 3pointer
  • fengou1

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue 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. labels Apr 7, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Apr 7, 2022

@YuJuncen
Copy link
Contributor Author

YuJuncen commented Apr 8, 2022

/run-unit-test

@YuJuncen YuJuncen requested review from kennytm, 3pointer and fengou1 April 8, 2022 03:10
@joccau
Copy link
Member

joccau commented Apr 8, 2022

/run-integration-br-test

@ti-chi-bot ti-chi-bot added needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-6.0 and removed do-not-merge/needs-triage-completed labels Apr 11, 2022
Copy link
Contributor

@3pointer 3pointer left a comment

Choose a reason for hiding this comment

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

LGTM, well done

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 14, 2022
@fengou1
Copy link
Contributor

fengou1 commented Apr 15, 2022

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 15, 2022
@kennytm
Copy link
Contributor

kennytm commented Apr 15, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: b7d457e

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 15, 2022
@ti-chi-bot ti-chi-bot merged commit 5889d4c into pingcap:master Apr 15, 2022
@YuJuncen
Copy link
Contributor Author

/run-integration-br-tests

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 15, 2022
@ti-srebot
Copy link
Contributor

cherry pick to release-5.3 in PR #34017

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 15, 2022
@ti-srebot
Copy link
Contributor

cherry pick to release-5.4 in PR #34019

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 15, 2022
@ti-srebot
Copy link
Contributor

cherry pick to release-6.0 in PR #34020

@sre-bot
Copy link
Contributor

sre-bot commented Apr 15, 2022

TiDB MergeCI notify

🔴 Bad News! [1] CI still failing after this pr merged.
These failed integration tests don't seem to be introduced by the current PR.

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci-tidb/code-coverage 🔴 unit test failed, coverage data was not available 13 min Existing failure
idc-jenkins-ci-tidb/integration-br-test 🟢 all 29 tests passed 42 min Existing passed
idc-jenkins-ci/integration-cdc-test 🟢 all 34 tests passed 41 min Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 23 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 11 tests passed 15 min Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 14 min Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 12 tests passed 14 min Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 14 min Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 13 min Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 12 min Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 5 min 41 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. 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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BR sometimes panics when meet some malformed start key of file
8 participants