tiup-cluster: support clearing extra data dirs automatically when destroying cluster.
What problem does this PR solve?
For example, if using the following configs:
global_configs:
data-dir: /tikv/data
server_configs:
tikv:
raft-engine.dir: "/data1/raft"
raft-engine.spill-dir: "/data1/spill"
The default data directory is set to use /tikv/data as the root path, while raft logs are stored in a distinct location at /data1/raft. However, this configuration results in the tiup-cluster destroy command failing to remove the raft logs as intended, leading to a leak of raft data that should be cleared.
This pr is introduced to make tiup-cluster clear extra data directories if specified.
What is changed and how it works?
Two parts:
- Records the extra directories by
getExtraDeployDirsand inserts them intoInstance.Dirswhen init. - Clear them when destroying TiKV instances.
Check List
Tests
- Unit test
- Integration test
- Manual test (add detailed scripts or steps below)
- No code
Code changes
- Has exported function/method change
- Has exported variable/fields change
- Has interface methods change
- Has persistent data change
Side effects
- Possible performance regression
- Increased code complexity
- Breaking backward compatibility
Related changes
- Need to cherry-pick to the release branch
- Need to update the documentation
Release notes:
NONE
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign bb7133 for approval. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Welcome @LykxSassinator! It looks like this is your first PR to pingcap/tiup 🎉