Skip to content

Fix the problem that old dmfile is not removed atomically (#1918)#1924

Merged
lidezhu merged 1 commit intopingcap:release-4.0from
ti-srebot:release-4.0-46864eb2e244
May 19, 2021
Merged

Fix the problem that old dmfile is not removed atomically (#1918)#1924
lidezhu merged 1 commit intopingcap:release-4.0from
ti-srebot:release-4.0-46864eb2e244

Conversation

@ti-srebot
Copy link
Collaborator

@ti-srebot ti-srebot commented May 18, 2021

cherry-pick #1918 to release-4.0
You can switch your code base to this Pull Request by using git-extras:

# In tics repo:
git pr https://github.com/pingcap/tics/pull/1924

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/tics.git pr/1924:release-4.0-46864eb2e244

What problem does this PR solve?

Issue Number: close #1138

Problem Summary:
There may be broken dmfile left on disk under a special scenario.

  1. After creating a readable dmfile, if tiflash crash before the corresponding stable is applied, there will be a directory like dmf_100 left on disk.
  2. When restart tiflash again, tiflash will create .tmp.dmf_100 and try to rename it to dmf_100 after writing is finished. So it will try to remove the old dmf_100 directory, but this removal is not atomic. So when tiflash crash again in the middle of the removal, the will be a broken dmfile left on disk. And tiflash will never be able to restart again.

What is changed and how it works?

Rename the dmfile before delete it.

Proposal: xxx

What's Changed:

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch:

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

Release note

  • Fix the problem that old dmfile is not removed atomically

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot ti-srebot added CHERRY-PICK cherry pick status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug. labels May 18, 2021
@ti-srebot ti-srebot added this to the v4.0.13 milestone May 18, 2021
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

@lidezhu
Copy link
Contributor

lidezhu commented May 19, 2021

/run-all-tests

2 similar comments
@JaySon-Huang
Copy link
Contributor

/run-all-tests

@lidezhu
Copy link
Contributor

lidezhu commented May 19, 2021

/run-all-tests

@lidezhu lidezhu merged commit b8731eb into pingcap:release-4.0 May 19, 2021
@lidezhu lidezhu deleted the release-4.0-46864eb2e244 branch May 19, 2021 05:47
@JaySon-Huang JaySon-Huang modified the milestones: v4.0.13, v4.0.14 May 28, 2021
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