Skip to content

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

Merged
JaySon-Huang merged 3 commits intopingcap:release-4.0from
JaySon-Huang:fix_broken_dm_files_4.0
Oct 15, 2020
Merged

Fix broken files may be left on disk after TiFlash crash (#1143)#1155
JaySon-Huang merged 3 commits intopingcap:release-4.0from
JaySon-Huang:fix_broken_dm_files_4.0

Conversation

@JaySon-Huang
Copy link
Contributor

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

cherry-pick of #1143


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

* Fix the issue that process crash may leave some broken DMFiles

Signed-off-by: JaySon-Huang <tshent@qq.com>
@JaySon-Huang JaySon-Huang added CHERRY-PICK cherry pick type/bugfix This PR fixes a bug. labels Oct 15, 2020
@JaySon-Huang JaySon-Huang added this to the v4.0.8 milestone Oct 15, 2020
@JaySon-Huang JaySon-Huang self-assigned this Oct 15, 2020
Signed-off-by: JaySon-Huang <tshent@qq.com>
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 15, 2020
Signed-off-by: JaySon-Huang <tshent@qq.com>
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang JaySon-Huang merged commit f1a9b86 into pingcap:release-4.0 Oct 15, 2020
@JaySon-Huang JaySon-Huang deleted the fix_broken_dm_files_4.0 branch October 15, 2020 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CHERRY-PICK cherry pick 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.

3 participants