Skip to content

Fix broken files may be left on disk after TiFlash crash#1143

Merged
JaySon-Huang merged 5 commits intopingcap:masterfrom
JaySon-Huang:fix_broken_dm_files
Oct 14, 2020
Merged

Fix broken files may be left on disk after TiFlash crash#1143
JaySon-Huang merged 5 commits intopingcap:masterfrom
JaySon-Huang:fix_broken_dm_files

Conversation

@JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Oct 9, 2020

What problem does this PR solve?

Issue Number: close #1138

Problem Summary: There could be a chance that TiFlash crashes when a DMFile is being deleted. For a table with many columns or the disk is busy, the deletion may not be completed and left some broken DMFiles on disk. Those broken DMFiles make trouble for TiFlash to restart normally.

What is changed and how it works?

To remove a DMFile, rename its directory (under directory storage model) with a prefix first. Clean those DMFiles should be deleted when DMFile::listAllInPath is called.
Even if there are broken DMFiles left, we can safely clean them when DMFile::listAllInPath is called.

Related changes

  • Need to cherry-pick to the release branch 4.0

Check List

Tests

  • Unit test

Side effects

  • N/A

Release note

  • Fix the issue that broken files may be left on disk after TiFlash crashed

Signed-off-by: JaySon-Huang <tshent@qq.com>
@JaySon-Huang JaySon-Huang added needs-cherry-pick-release-4.0 PR which needs to be cherry-picked to release-4.0 type/bugfix This PR fixes a bug. labels Oct 9, 2020
@JaySon-Huang JaySon-Huang self-assigned this Oct 9, 2020
@JaySon-Huang JaySon-Huang changed the title Fix broken files may left on disk after TiFlash crash Fix broken files may be left on disk after TiFlash crash Oct 9, 2020
Signed-off-by: JaySon-Huang <tshent@qq.com>
@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-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 10, 2020
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

7 similar comments
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang JaySon-Huang merged commit 6bffa03 into pingcap:master Oct 14, 2020
@JaySon-Huang JaySon-Huang deleted the fix_broken_dm_files branch October 14, 2020 03:09
@ti-srebot
Copy link
Collaborator

cherry pick to release-4.0 failed

JaySon-Huang added a commit to JaySon-Huang/tiflash that referenced this pull request Oct 15, 2020
* Fix the issue that process crash may leave some broken DMFiles

Signed-off-by: JaySon-Huang <tshent@qq.com>
JaySon-Huang added a commit that referenced this pull request Oct 15, 2020
* Fix broken files may be left on disk after TiFlash crash

Signed-off-by: JaySon-Huang <tshent@qq.com>
lidezhu pushed a commit that referenced this pull request Oct 19, 2020
* Fix the issue that process crash may leave some broken DMFiles

Signed-off-by: JaySon-Huang <tshent@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-cherry-pick-release-4.0 PR which needs to be cherry-picked to release-4.0 status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken DMFile makes TiFlash abnormal

3 participants