Fix replication detach error

TypeError: tuple indices must be integers or slices, not str

this is caused by the new version of the sqlachemy library.

Change-Id: I76166f901f961a18ad4297d04e1a75a59b059e23
This commit is contained in:
wu.chunyang 2024-11-26 14:42:09 +08:00
parent 1da2376f5a
commit f0f186ef9a
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fix a bug where replications failed to detach from the source instance
because of the upgrade of the sqlachemy library.

View File

@ -815,7 +815,7 @@ class BaseMySqlApp(service.BaseDbApp):
replication_user = None
with mysql_util.SqlClient(self.get_engine()) as client:
result = client.execute(text('SHOW SLAVE STATUS'))
replication_user = result.first()['Master_User']
replication_user = result.first()._mapping['Master_User']
client.execute(text('STOP SLAVE'))
client.execute(text('RESET SLAVE ALL'))
self.wait_for_slave_status('OFF', client, 180)