Skip to content

Commit

Permalink
ignore exporters when check data_dir overlap (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis authored Aug 5, 2021
1 parent ef79639 commit 89ab706
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
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

0 comments on commit 89ab706

Please sign in to comment.