Skip to content

Commit fba39fb

Browse files
committedAug 5, 2021
ignore exporters when check data_dir overlap (#1510)
1 parent 4a40228 commit fba39fb

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed
 

‎pkg/cluster/spec/validate.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,22 @@ func CheckClusterDirOverlap(entries []DirEntry) error {
228228
if d1.instance.IsImported() && d2.instance.IsImported() {
229229
continue
230230
}
231-
// overlap is alloed in the case one side is imported and the other is monitor,
231+
// overlap is allowed in the case one side is imported and the other is monitor,
232232
// we assume that the monitor is deployed with the first instance in that host,
233233
// it implies that the monitor is imported too.
234234
if (strings.HasPrefix(d1.dirKind, "monitor") && d2.instance.IsImported()) ||
235235
(d1.instance.IsImported() && strings.HasPrefix(d2.dirKind, "monitor")) {
236236
continue
237237
}
238238

239+
// overlap is allowed in the case one side is data dir of a monitor instance,
240+
// as the *_exporter don't need data dir, the field is only kept for compatiability
241+
// with legacy tidb-ansible deployments.
242+
if (strings.HasPrefix(d1.dirKind, "monitor data directory")) ||
243+
(strings.HasPrefix(d2.dirKind, "monitor data directory")) {
244+
continue
245+
}
246+
239247
properties := map[string]string{
240248
"ThisDirKind": d1.dirKind,
241249
"ThisDir": d1.dir,

‎pkg/cluster/spec/validate_test.go

+26
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,32 @@ tikv_servers:
10411041
status_port: 32180
10421042
log_dir: "/home/tidb6wu/tidb1-data/tikv-32160-log"
10431043
data_dir: "/home/tidb6wu/tidb1-data/tikv-32160"
1044+
`,
1045+
`
1046+
monitored:
1047+
node_exporter_port: 9100
1048+
blackbox_exporter_port: 9115
1049+
deploy_dir: /data/deploy/monitor-9100
1050+
data_dir: /data/deploy/monitor-9100
1051+
log_dir: /data/deploy/monitor-9100/log
1052+
pd_servers:
1053+
- host: n0
1054+
name: pd0
1055+
imported: true
1056+
deploy_dir: /data/deploy
1057+
data_dir: /data/deploy/data.pd
1058+
log_dir: /data/deploy/log
1059+
- host: n1
1060+
name: pd1
1061+
log_dir: "/data/deploy/pd-2379/log"
1062+
data_dir: "/data/pd-2379"
1063+
deploy_dir: "/data/deploy/pd-2379"
1064+
cdc_servers:
1065+
- host: n1
1066+
port: 8300
1067+
deploy_dir: /data/deploy/ticdc-8300
1068+
data_dir: /data1/ticdc-8300
1069+
log_dir: /data/deploy/ticdc-8300/log
10441070
`,
10451071
}
10461072
for _, s := range goodTopos {

0 commit comments

Comments
 (0)
Please sign in to comment.