Skip to content

Commit

Permalink
fix: 修复主从迁移元数据bug TencentBlueKing#8475
Browse files Browse the repository at this point in the history
  • Loading branch information
zfrendo committed Dec 9, 2024
1 parent 228cd7d commit a0e6ed1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dbm-ui/backend/configuration/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# sqlserver的用户登录admin账号名称
SQLSERVER_ADMIN_USER = "dbm_admin"
# TODO: job超时时间最大为86400,后续考虑让job平台调大限制
MYSQL_DATA_RESTORE_TIME = 259200
MYSQL_DATA_RESTORE_TIME = 86400
MYSQL_USUAL_JOB_TIME = 7200
MYSQL8_VER_PARSE_NUM = 8000000

Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/backend/db_meta/api/cluster/tendbha/storage_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def remove_storage_tuple(master_ip: str, slave_ip: str, bk_cloud_id: int, port_l


@transaction.atomic
def update_storage_tuple(master_ip: str, new_master_ip: str, exclude_ip: list, bk_cloud_id: int, port_list: list):
def update_storage_tuple(master_ip: str, new_master_ip: str, exclude_ips: list, bk_cloud_id: int, port_list: list):
for port in port_list:
master_storage = StorageInstance.objects.get(
machine__ip=master_ip, port=port, machine__bk_cloud_id=bk_cloud_id
Expand All @@ -47,5 +47,5 @@ def update_storage_tuple(master_ip: str, new_master_ip: str, exclude_ip: list, b
machine__ip=new_master_ip, port=port, machine__bk_cloud_id=bk_cloud_id
)
StorageInstanceTuple.objects.filter(ejector=master_storage).exclude(
receiver__machine__ip__in=exclude_ip
receiver__machine__ip__in=exclude_ips
).update(ejector=new_master_storage)
2 changes: 1 addition & 1 deletion dbm-ui/backend/flow/utils/mysql/mysql_db_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def mysql_migrate_cluster_switch_storage(self):
api.cluster.tendbha.storage_tuple.update_storage_tuple(
master_ip=self.cluster["old_master_ip"],
new_master_ip=self.cluster["new_master_ip"],
exclude_ip=[self.cluster["old_master_ip"], self.cluster["old_slave_ip"]],
exclude_ips=[self.cluster["old_master_ip"], self.cluster["old_slave_ip"]],
bk_cloud_id=self.cluster["bk_cloud_id"],
port_list=[self.cluster["mysql_port"]],
)
Expand Down

0 comments on commit a0e6ed1

Please sign in to comment.