Skip to content

Commit

Permalink
333
Browse files Browse the repository at this point in the history
  • Loading branch information
ymakedaq committed Oct 22, 2024
1 parent 57ad9d1 commit e28b7e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ def master_and_slave_switch(root_id: str, ticket_data: dict, cluster: Cluster, c
exclude_ips = [cluster_info["old_slave_ip"]]
if cluster_info.get("old_ro_slave_ips"):
exclude_ips.extend(cluster_info["old_ro_slave_ips"])
logger.info(_("exclude_ips ip list {}").format(exclude_ips))
cluster_info["other_slave_info"] = [y.machine.ip for y in mysql_storage_slave.exclude(machine__ip__in=exclude_ips)]
logger.info(_("other_slave_info:{}").format(cluster_info["other_slave_info"]))
if cluster_info.get("new_ro_slave_ips"):
cluster_info["other_slave_info"].extend(cluster_info["new_ro_slave_ips"])
domain_map = get_tendb_ha_entry(cluster.id)
cluster_info["master_domain"] = domain_map["master_domain"]
cluster_info["slave_domain"] = domain_map["slave_domain"]
Expand All @@ -172,7 +176,7 @@ def master_and_slave_switch(root_id: str, ticket_data: dict, cluster: Cluster, c
if cluster_info["other_slave_info"]:
# 如果集群存在其他slave节点,则建立新的你主从关系
acts_list = []
for exec_ip in cluster_info["other_slave_info"]:
for exec_ip in list(set(cluster_info["other_slave_info"])):
cluster_sw_kwargs.exec_ip = exec_ip
cluster_sw_kwargs.get_mysql_payload_func = MysqlActPayload.get_change_master_payload.__name__
acts_list.append(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ def build_ms_pair_switch_sub_pipelines(
"master_port": master_model.port,
"other_slave_info": other_slaves,
"old_ro_slave_ips": old_ro_slave_ips,
"new_ro_slave_ips": old_ro_slave_ips,
}
switch_sub_pipeline.add_sub_pipeline(
sub_flow=master_and_slave_switch(
Expand Down

0 comments on commit e28b7e0

Please sign in to comment.