should remove tidb /info key in PD(etcd) after scale-in TiDB
Bug Report
Please answer these questions before submitting your issue. Thanks!
- What did you do?
topo.yaml
pd_servers:
- host: 10.0.1.9
tikv_servers:
- host: 10.0.1.9
tidb_servers:
- host: 10.0.1.9
- Deploy a tidb cluster.
tiup cluster deploy dev nightly topo.yaml
tiup cluster start dev
- After deploy tidb cluster, you can use
etcdctlto find the topology information in PD(etcd).
▶ etcdctl --endpoints=10.0.1.9:2379 get "/topology/tidb" --prefix
/topology/tidb/10.0.1.9:4000/info
{"version":"v5.5.0-alpha","git_hash":"adcaaa5cbe1058da8f363c173521929405d0ecb6","ip":"10.0.1.9","status_port":10080,"deploy_path":"/home/tidb/deploy/tidb-4000/bin","start_timestamp":1644481689,"labels":{}}
/topology/tidb/10.0.1.9:4000/ttl
1644481749835274163
You can see there are 2 keys in PD(etcd), those 2 keys are written into PD(etcd) by TiDB itself.
/topology/tidb/10.0.1.9:4000/info/topology/tidb/10.0.1.9:4000/ttl
- Now, scale-in tidb.
tiup cluster scale-in dev -N 10.0.1.9:4000
- Now, use
etcdctlto find the topology information in PD(etcd) again:
▶ etcdctl --endpoints=10.0.1.9:2379 get "/topology/tidb" --prefix
/topology/tidb/10.0.1.9:4000/info
{"version":"v5.5.0-alpha","git_hash":"adcaaa5cbe1058da8f363c173521929405d0ecb6","ip":"10.0.1.9","status_port":10080,"deploy_path":"/home/tidb/deploy/tidb-4000/bin","start_timestamp":1644481689,"labels":{}}
As you can see, /topology/tidb/10.0.1.9:4000/info is still in PD(etcd), it's unexpected.
/topology/tidb/10.0.1.9:4000/ttl key has been auto delete after ttl timeout.
/topology/tidb/10.0.1.9:4000/info should be deleted after TiDB is been scale-in.
What I expected?
TiUP should remove following keys in PD(etcd) when tidb and ngm were been scale-in.
/topology/xxx/10.0.1.9:4000/info/topology/xxx/10.0.1.9:4000/ttl
Other consideration
Since /topology/tidb/10.0.1.9:4000/info and /topology/tidb/10.0.1.9:4000/ttl are written into PD(etcd) by TiDB itself, so let TiUP to delete those key maybe look weird. Maybe let TiUP to write and delte those keys is better.
- What version of TiUP are you using (
tiup --version)?
▶ tiup --version
1.8.2 tiup
Go Version: go1.17.5
Git Ref: v1.8.2
GitHash: a2912cf0470d651ce724e6c4e79871ec772abe38
@nexustar PTAL