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 the issue that the imported monitor directory may conflict with o… #1386

Merged
merged 1 commit into from
May 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pkg/cluster/spec/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ Please change to use another directory or another host.
return CheckClusterDirOverlap(currentEntries)
}

// CheckClusterDirOverlap checks cluster dir overlaps with data or log
// we don't allow to deploy log under data, and vise versa
// CheckClusterDirOverlap checks cluster dir overlaps with data or log.
// this should only be used across clusters.
// we don't allow to deploy log under data, and vise versa.
// ref https://github.com/pingcap/tiup/issues/1047#issuecomment-761711508
func CheckClusterDirOverlap(entries []DirEntry) error {
ignore := func(d1, d2 DirEntry) bool {
Expand All @@ -223,9 +224,18 @@ func CheckClusterDirOverlap(entries []DirEntry) error {
}

if utils.IsSubDir(d1.dir, d2.dir) || utils.IsSubDir(d2.dir, d1.dir) {
// overlap is allowed in the case both sides are imported
if d1.instance.IsImported() && d2.instance.IsImported() {
continue
}
// overlap is alloed in the case one side is imported and the other is monitor,
// we assume that the monitor is deployed with the first instance in that host,
// it implies that the monitor is imported too.
if (strings.HasPrefix(d1.dirKind, "monitor") && d2.instance.IsImported()) ||
(d1.instance.IsImported() && strings.HasPrefix(d2.dirKind, "monitor")) {
continue
}

properties := map[string]string{
"ThisDirKind": d1.dirKind,
"ThisDir": d1.dir,
Expand Down