Page MenuHomePhabricator
Paste P8698

topology changes
ActivePublic

Authored by jcrespo on Jul 2 2019, 12:46 PM.
Tags
None
Referenced Files
F29675544: raw.txt
Jul 2 2019, 12:46 PM
Subscribers
None
# python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import WMFMariaDB
>>> import WMFReplication
>>> db1 = WMFMariaDB.WMFMariaDB(host='127.0.0.1')
>>> db2 = WMFMariaDB.WMFMariaDB(host='127.0.0.1', port=3307)
>>> db3 = WMFMariaDB.WMFMariaDB(host='127.0.0.1', port=3308)
>>> db1r = WMFReplication.WMFReplication(db1)
>>> db2r = WMFReplication.WMFReplication(db2)
>>> db3r = WMFReplication.WMFReplication(db3)
>>> db2r.move(db3)
{'success': False, 'errno': -1, 'errmsg': 'The host is already configured as a master of 127.0.0.1:3308'}
>>> db2r.move(db1)
{'success': True}
>>> db1r.slaves()
[<WMFMariaDB.WMFMariaDB object at 0x7f648108b860>, <WMFMariaDB.WMFMariaDB object at 0x7f648108bcc0>]
>>> db2r.move(db3) <---- 5 second wait before stop
/usr/lib/python3/dist-packages/pymysql/cursors.py:170: Warning: (1278, "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart")
result = self._query(query) <---- another 5 second wait to catch up
{'success': True}
>>> db1r.slaves()
[<WMFMariaDB.WMFMariaDB object at 0x7f648108b828>]
>>> db3r.slaves()
[<WMFMariaDB.WMFMariaDB object at 0x7f648107fda0>]
>>> db2r.move(db1) <------ 5 second wait before change
{'success': True}
>>> db1r.slaves()
[<WMFMariaDB.WMFMariaDB object at 0x7f6480f41a20>, <WMFMariaDB.WMFMariaDB object at 0x7f6480f41e10>]
>>> db3r.slaves()
[]

Event Timeline

>>> import WMFMariaDB
>>> import WMFReplication
>>> db1 = WMFMariaDB.WMFMariaDB(host='127.0.0.1')
>>> db2 = WMFMariaDB.WMFMariaDB(host='127.0.0.1', port=3307)
>>> db3 = WMFMariaDB.WMFMariaDB(host='127.0.0.1', port=3308)
>>> db1r = WMFReplication.WMFReplication(db1)
>>> db2r = WMFReplication.WMFReplication(db2)
>>> db3r = WMFReplication.WMFReplication(db3)
>>> db1.name()
'127.0.0.1:3306/(none)'
>>> db2.name()
'127.0.0.1:3307/(none)'
>>> db3.name()
'127.0.0.1:3308/(none)'
>>> db1r.debug()
127.0.0.1:3306/(none)> Not configured as a slave
>>> db2r.debug()
127.0.0.1:3307/(none)> master: 127.0.0.1:3306, io: Yes, sql: Yes, lag: 0, pos: sangai-bin.000003/1683948
>>> db3r.debug()
127.0.0.1:3308/(none)> master: 127.0.0.1:3306, io: Yes, sql: Yes, lag: 0, pos: sangai-bin.000003/1683948
>>> db3r.move(db2)
/usr/lib/python3/dist-packages/pymysql/cursors.py:170: Warning: (1278, "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart")
  result = self._query(query)
{'success': True}
>>> db1r.debug()
127.0.0.1:3306/(none)> Not configured as a slave
>>> db2r.debug()
127.0.0.1:3307/(none)> master: 127.0.0.1:3306, io: Yes, sql: Yes, lag: 0, pos: sangai-bin.000003/1696195
>>> db3r.debug()
127.0.0.1:3308/(none)> master: 127.0.0.1:3307, io: Yes, sql: Yes, lag: 0, pos: sangai-bin.000003/1640009
>>> db2r.move(db3)
{'success': False, 'errno': -1, 'errmsg': 'The topology change cannot be done at the moment- check its relationship, replication status or replication lag'}
>>> db1r.move(db3)
{'success': False, 'errno': -1, 'errmsg': 'The host is not configured as a replica'}
>>> db3r.move(db1)
{'success': True}
>>> db1r.debug()
127.0.0.1:3306/(none)> Not configured as a slave
>>> db2r.debug()
127.0.0.1:3307/(none)> master: 127.0.0.1:3306, io: Yes, sql: Yes, lag: 0, pos: sangai-bin.000003/1721682
>>> db3r.debug()
127.0.0.1:3308/(none)> master: 127.0.0.1:3306, io: Yes, sql: Yes, lag: 0, pos: sangai-bin.000003/1723337