tidb icon indicating copy to clipboard operation
tidb copied to clipboard

rolling update faild while check current PD leader

Open calmzealA opened this issue 8 years ago • 5 comments

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? I am updating tidb using ansible. from V1.0.6,to v2.0.4 Following this guide: https://www.pingcap.com/docs-cn/op-guide/tidb-v2-upgrade-guide/

ansible-playbook rolling_update.yml

  1. What did you expect to see? Update success. We have success update tidb from 1.0.6 to v2.0.3 in the TEST ENV before。

  2. What did you see instead? we have 3 pds, the 1st and 2nd update with no error. the 3rd pd report error:

Ansible FAILED! => playbook: rolling_update.yml; TASK: check current PD leader; message: {"msg": "The conditional check 'pd_leader_info.json.name is defined and pd_leader_info.json.name != pd_name' failed. The error was: error while evaluating conditional (pd_leader_info.json.name is defined and pd_leader_info.json.name != pd_name): 'dict object' has no attribute 'json'"}

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)? v1.0.6-1

ps: When check the rolling_update.yml: https://github.com/pingcap/tidb-ansible/blob/master/rolling_update.yml

curl http://xxxxxx.139:2379/pd/api/v1/leader

{ "name": "pd3", "member_id": 6795350017215450226, "peer_urls": [ "http://xxxxx.139:2380" ], "client_urls": [ "http://xxxxx.139:2379" ] }

I make a post as the rolling_update.yml does.

[root]# curl -X POST http://xxxxx.139:2379/pd/api/v1/leader/resign null [root]# curl -X POST http://xxxx.139::2379/pd/api/v1/leader/resign no leader

then i check it

[root]# curl http://1xxx.139:2379/pd/api/v1/leader no leader [root]# curl http://1xxxx.139:2379/pd/api/v1/leader no leader [root]# curl http://1xxxx.139:2379/pd/api/v1/leader { "name": "pd3", "member_id": 6795350017215450226, "peer_urls": [ "http://xxxxx.139:2380" ], "client_urls": [ "http://xxx.139:2379" ] }

calmzealA avatar Jun 22 '18 07:06 calmzealA

It seems PD3 can not transfer to another PD server

calmzealA avatar Jun 22 '18 07:06 calmzealA

pdctl member leader transfer pd2

and got log at pd2:

2018/06/22 09:21:29.241 leader.go:95: [info] leader is name:"pd3" member_id:6795350017215450226 peer_urls:"http://10.155.111.139:2380" client_urls:"http://10.155.111.139:2379" , watch it 2018/06/22 09:24:15.675 leader.go:312: [info] leader is deleted 2018/06/22 09:24:15.675 leader.go:97: [info] leader changed, try to campaign leader 2018/06/22 09:24:15.675 leader.go:103: [info] pd2 is not etcd leader, skip campaign leader and check later 2018/06/22 09:24:15.876 leader.go:103: [info] pd2 is not etcd leader, skip campaign leader and check later 2018/06/22 09:24:16.077 leader.go:103: [info] pd2 is not etcd leader, skip campaign leader and check later 2018/06/22 09:24:16.278 leader.go:103: [info] pd2 is not etcd leader, skip campaign leader and check later 2018/06/22 09:24:26.325 leader.go:95: [info] leader is name:"pd3" member_id:6795350017215450226 peer_urls:"http://10.155.111.139:2380" client_urls:"http://10.155.111.139:2379" , watch it

calmzealA avatar Jun 22 '18 09:06 calmzealA

@calmzealA Please provide more log information for PD3.

ciscoxll avatar Jun 22 '18 14:06 ciscoxll

@ciscoxll 谢谢 已经处理好了。

主要的问题在于每次选举leader都是pd3,可能跟pd1,pd2已经升级到2.0.4,pd3还是1.0.6有关。 然后我们采用下面的方法绕过了:

  1. 手动停掉 pd3。 这时候leader能切换到pd1。
  2. 修改inventory.ini,在PD list 配置里面,将PD3 放在第一个。(否则,再次执行rolling update,还是会从pd1,pd2开始升级,这样会将leader再切到pd3.)
  3. 执行升级。

calmzealA avatar Jun 25 '18 02:06 calmzealA

Related issue: https://github.com/pingcap/tidb/issues/11240

lonng avatar Jul 13 '19 13:07 lonng