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

cluster: fix port conflict check for tiflash instances #1805

Merged
merged 1 commit into from
Mar 23, 2022
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
3 changes: 3 additions & 0 deletions pkg/cluster/spec/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,9 @@ func (s *Specification) portConflictsDetect() error {
"WebPort",
"TCPPort",
"HTTPPort",
"FlashServicePort",
"FlashProxyPort",
"FlashProxyStatusPort",
"ClusterPort",
"NgPort",
}
Expand Down
52 changes: 52 additions & 0 deletions pkg/cluster/spec/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,58 @@ tikv_servers:
c.Assert(err, NotNil)
c.Assert(err.Error(), Equals, "port conflict for '1234' between 'tidb_servers:172.16.5.138.port' and 'tikv_servers:172.16.5.138.status_port'")

topo = Specification{}
err = yaml.Unmarshal([]byte(`
global:
user: "test1"
ssh_port: 220
deploy_dir: "test-deploy"
data_dir: "test-data"
tiflash_servers:
- host: 172.16.5.138
tcp_port: 111
http_port: 222
flash_service_port: 1234
flash_proxy_port: 444
flash_proxy_status_port: 555
metrics_port: 666
- host: 172.16.5.138
tcp_port: 1111
http_port: 1222
flash_service_port: 1333
flash_proxy_port: 1444
flash_proxy_status_port: 1234
metrics_port: 1666
`), &topo)
c.Assert(err, NotNil)
c.Assert(err.Error(), Equals, "port conflict for '1234' between 'tiflash_servers:172.16.5.138.flash_service_port' and 'tiflash_servers:172.16.5.138.flash_proxy_status_port'")

topo = Specification{}
err = yaml.Unmarshal([]byte(`
global:
user: "test1"
ssh_port: 220
deploy_dir: "test-deploy"
data_dir: "test-data"
tiflash_servers:
- host: 172.16.5.138
tcp_port: 111
http_port: 222
flash_service_port: 333
flash_proxy_port: 1234
flash_proxy_status_port: 555
metrics_port: 666
- host: 172.16.5.138
tcp_port: 1111
http_port: 1222
flash_service_port: 1333
flash_proxy_port: 1234
flash_proxy_status_port: 1555
metrics_port: 1666
`), &topo)
c.Assert(err, NotNil)
c.Assert(err.Error(), Equals, "port conflict for '1234' between 'tiflash_servers:172.16.5.138.flash_proxy_port' and 'tiflash_servers:172.16.5.138.flash_proxy_port'")

topo = Specification{}
// tispark_masters has "omitempty" in its tag value
err = yaml.Unmarshal([]byte(`
Expand Down