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

Fix panic when region is not found on TiFlash's side in tryFlushData #5603

Merged
merged 7 commits into from
Aug 11, 2022

Conversation

CalvinNeo
Copy link
Member

@CalvinNeo CalvinNeo commented Aug 11, 2022

What problem does this PR solve?

Issue Number: close #5602

Problem Summary:

  1. Region is removed on TiFlash's side, however not on Proxy's side before a restart
  2. Proxy replay log, and ask a flush for a region not exist in TiFlash
  1. TiFlash implementationAdminCmd::ChangePeer::RemoveNode, the persistence is successful after deleting the region.
  2. However, when the proxy persisted meta information to kvdb, the node encountered unexpected downtime.

What is changed and how it works?

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

Signed-off-by: CalvinNeo <[email protected]>
f
Signed-off-by: CalvinNeo <[email protected]>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 11, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JaySon-Huang
  • flowbehappy

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-triage-completed release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-cherry-pick-release-6.2 and removed do-not-merge/needs-triage-completed labels Aug 11, 2022
@CalvinNeo
Copy link
Member Author

/cc @JaySon-Huang @flowbehappy @lidezhu

@CalvinNeo
Copy link
Member Author

/run-build-arm64-release comment=true

@lidezhu
Copy link
Contributor

lidezhu commented Aug 11, 2022

Why this problem just affect v6.2.0?

@CalvinNeo
Copy link
Member Author

Why this problem just affect v6.2.0?

Because in 6.2 we add a tryFlushData to decouple compact log and flushing.

@JaySon-Huang
Copy link
Contributor

Similar to https://kb.pingcap.com/post/articles/92

The root cause of the problem in this kb is that the data dir for proxy has been changed cause by upgrade. But I think this issue is not caused by the data dir change, but could happen after TiFlash restart several times?

@CalvinNeo
Copy link
Member Author

/run-build-arm64-release comment=true

@CalvinNeo
Copy link
Member Author

Similar to https://kb.pingcap.com/post/articles/92

The root cause of the problem in this kb is that the data dir for proxy has been changed cause by upgrade. But I think this issue is not caused by the data dir change, but could happen after TiFlash restart several times?

Like the following

  1. TiFlash implementationAdminCmd::ChangePeer::RemoveNode, the persistence is successful after deleting the region.
  2. However, when the proxy persisted meta information to kvdb, the node encountered unexpected downtime.

@CalvinNeo
Copy link
Member Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Aug 11, 2022

@sre-bot
Copy link
Collaborator

sre-bot commented Aug 11, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
KVStore.cpp                       499                65    86.97%          43                 3    93.02%         685                90    86.86%         188                61    67.55%
tests/gtest_kvstore.cpp           311                43    86.17%          28                 2    92.86%        1309                33    97.48%          28                23    17.86%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             810               108    86.67%          71                 5    92.96%        1994               123    93.83%         216                84    61.11%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
19248      9240             52.00%    218840  93994        57.05%

full coverage report (for internal network access only)

@lidezhu
Copy link
Contributor

lidezhu commented Aug 11, 2022

Seems this line

throw Exception(fmt::format("region not found when trying flush", ErrorCodes::LOGICAL_ERROR));

should be
throw Exception("region not found when trying flush", ErrorCodes::LOGICAL_ERROR);

Signed-off-by: CalvinNeo <[email protected]>
Signed-off-by: CalvinNeo <[email protected]>
f
Signed-off-by: CalvinNeo <[email protected]>
@CalvinNeo
Copy link
Member Author

/run-all-tests

f
Signed-off-by: CalvinNeo <[email protected]>
@sre-bot
Copy link
Collaborator

sre-bot commented Aug 11, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
KVStore.cpp                       499                65    86.97%          43                 3    93.02%         685                90    86.86%         188                61    67.55%
tests/gtest_kvstore.cpp           312                43    86.22%          28                 2    92.86%        1314                33    97.49%          28                23    17.86%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             811               108    86.68%          71                 5    92.96%        1999               123    93.85%         216                84    61.11%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
19248      9240             52.00%    218845  93965        57.06%

full coverage report (for internal network access only)

Copy link
Contributor

@JaySon-Huang JaySon-Huang 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 added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 11, 2022
@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 Aug 11, 2022
@CalvinNeo
Copy link
Member Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor

/run-unit-test

@CalvinNeo
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

@CalvinNeo: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and 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.

If you have any questions about the PR merge process, please refer to pr process.

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.

@ti-chi-bot
Copy link
Member

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

Commit hash: a54fe0c

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 11, 2022
@JaySon-Huang
Copy link
Contributor

/run-unit-test

1 similar comment
@CalvinNeo
Copy link
Member Author

/run-unit-test

@sre-bot
Copy link
Collaborator

sre-bot commented Aug 11, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
KVStore.cpp                       499                66    86.77%          43                 3    93.02%         685                90    86.86%         188                63    66.49%
tests/gtest_kvstore.cpp           312                43    86.22%          28                 2    92.86%        1314                33    97.49%          28                23    17.86%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             811               109    86.56%          71                 5    92.96%        1999               123    93.85%         216                86    60.19%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
19247      9238             52.00%    218812  93950        57.06%

full coverage report (for internal network access only)

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5611.

@sre-bot
Copy link
Collaborator

sre-bot commented Aug 11, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
KVStore.cpp                       499                65    86.97%          43                 3    93.02%         685                90    86.86%         188                61    67.55%
tests/gtest_kvstore.cpp           312                43    86.22%          28                 2    92.86%        1314                33    97.49%          28                23    17.86%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             811               108    86.68%          71                 5    92.96%        1999               123    93.85%         216                84    61.11%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
19247      9236             52.01%    218812  93936        57.07%

full coverage report (for internal network access only)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-6.2 release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 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.

tiflash crash frequently with error of TryFlushData faild
6 participants