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

ignore exporters when check data_dir overlap #1510

Merged
merged 1 commit into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion pkg/cluster/spec/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,22 @@ func CheckClusterDirOverlap(entries []DirEntry) error {
if d1.instance.IsImported() && d2.instance.IsImported() {
continue
}
// overlap is alloed in the case one side is imported and the other is monitor,
// overlap is allowed 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
}

// overlap is allowed in the case one side is data dir of a monitor instance,
// as the *_exporter don't need data dir, the field is only kept for compatiability
// with legacy tidb-ansible deployments.
if (strings.HasPrefix(d1.dirKind, "monitor data directory")) ||
(strings.HasPrefix(d2.dirKind, "monitor data directory")) {
continue
}

properties := map[string]string{
"ThisDirKind": d1.dirKind,
"ThisDir": d1.dir,
Expand Down
26 changes: 26 additions & 0 deletions pkg/cluster/spec/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,32 @@ tikv_servers:
status_port: 32180
log_dir: "/home/tidb6wu/tidb1-data/tikv-32160-log"
data_dir: "/home/tidb6wu/tidb1-data/tikv-32160"
`,
`
monitored:
node_exporter_port: 9100
blackbox_exporter_port: 9115
deploy_dir: /data/deploy/monitor-9100
data_dir: /data/deploy/monitor-9100
log_dir: /data/deploy/monitor-9100/log
pd_servers:
- host: n0
name: pd0
imported: true
deploy_dir: /data/deploy
data_dir: /data/deploy/data.pd
log_dir: /data/deploy/log
- host: n1
name: pd1
log_dir: "/data/deploy/pd-2379/log"
data_dir: "/data/pd-2379"
deploy_dir: "/data/deploy/pd-2379"
cdc_servers:
- host: n1
port: 8300
deploy_dir: /data/deploy/ticdc-8300
data_dir: /data1/ticdc-8300
log_dir: /data/deploy/ticdc-8300/log
`,
}
for _, s := range goodTopos {
Expand Down