Skip to content

Commit

Permalink
fix: slave重建初始化时忽略安装备份 #6879
Browse files Browse the repository at this point in the history
  • Loading branch information
zfrendo committed Sep 12, 2024
1 parent c7c0266 commit e8dcb23
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ def migrate_cluster_flow(self, use_for_upgrade=False):
root_id=self.root_id,
parent_global_data=copy.deepcopy(self.data),
collect_sysinfo=True,
is_install_backup=False,
cluster_type=ClusterType.TenDBHA.value,
db_backup_pkg_type=MysqlVersionToDBBackupForMap[self.data["db_version"]],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ def deploy_restore_slave_flow(self):
root_id=self.root_id,
parent_global_data=copy.deepcopy(self.data),
collect_sysinfo=True,
is_install_backup=False,
cluster_type=ClusterType.TenDBHA.value,
)
)
Expand Down Expand Up @@ -575,7 +576,7 @@ def deploy_restore_local_slave_flow(self):
)

tendb_migrate_pipeline_list.append(
tendb_migrate_pipeline.build_sub_process(_("slave原地重建{}").format(target_slave.machine.ip))
tendb_migrate_pipeline.build_sub_process(_("slave原地重建{}").format(target_slave.ip_port))
)

tendb_migrate_pipeline_all.add_parallel_sub_pipeline(sub_flow_list=tendb_migrate_pipeline_list)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ def tendb_ha_restore_slave_flow(self):
master_ip_list=None,
slave_ip_list=[self.data["new_slave_ip"]],
root_id=self.root_id,
is_install_backup=False,
parent_global_data=copy.deepcopy(self.data),
cluster_type=ClusterType.TenDBHA.value,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ def tendb_remote_slave_recover(self):
old_port=node["slave"]["port"],
new_ip=node["new_slave"]["ip"],
new_port=node["new_slave"]["port"],
server_name=f"SPT_SLAVE{shard_id}",
tdbctl_pass=tdbctl_pass,
)
switch_slave_class.switch_remote_instance_pairs.append(inst_pairs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ def _create_tdbctl_user(self, cluster: Cluster, ctl_primary: str, new_ip: str, n
self.log_info(f"add tdbctl user in instance [f'{new_ip}{IP_PORT_DIVIDER}{new_port}'] success")

def _alter_remote_slave_routing(
self, cluster: Cluster, old_ip: str, old_port: int, new_ip: str, new_port: int, tdbctl_pass: str
self,
cluster: Cluster,
server_name: str,
old_ip: str,
old_port: int,
new_ip: str,
new_port: int,
tdbctl_pass: str,
):
"""
替换实例的路由信息的具体逻辑
Expand All @@ -62,7 +69,7 @@ def _alter_remote_slave_routing(
"addresses": [ctl_primary],
"cmds": [
"set tc_admin=1",
f"select Server_name from mysql.servers where host = '{old_ip}' and port = {old_port}",
f"select Server_name from mysql.servers where Server_name = '{server_name}'",
],
"force": False,
"bk_cloud_id": cluster.bk_cloud_id,
Expand Down Expand Up @@ -116,6 +123,7 @@ def _execute(self, data, parent_data):
old_port=pairs["old_port"],
new_ip=pairs["new_ip"],
new_port=pairs["new_port"],
server_name=pairs["server_name"],
tdbctl_pass=pairs["tdbctl_pass"],
):
return False
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/backend/flow/utils/spider/spider_act_dataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class InstancePairs:
new_ip: str
old_port: int
new_port: int
server_name: str
tdbctl_pass: str


Expand Down

0 comments on commit e8dcb23

Please sign in to comment.