Skip to content

Commit

Permalink
fix(backend): 处理连接检查参数 TencentBlueKing#8048
Browse files Browse the repository at this point in the history
  • Loading branch information
ymakedaq authored and iSecloud committed Nov 21, 2024
1 parent ed153c7 commit e5e9a5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
logger = logging.getLogger("flow")


def master_and_slave_switch(root_id: str, ticket_data: dict, cluster: Cluster, cluster_info: dict):
def master_and_slave_switch(
root_id: str, ticket_data: dict, cluster: Cluster, cluster_info: dict, check_client_conn=True
):
"""
定义成对迁移完成,做成对切换的子流程(子流程是已集群维度做成对切换)
成对切换更多解决一主一从的集群机器裁撤场景;对于一主多从的集群,
Expand Down Expand Up @@ -81,7 +83,7 @@ def master_and_slave_switch(root_id: str, ticket_data: dict, cluster: Cluster, c
uid=ticket_data["uid"],
root_id=root_id,
cluster=cluster,
is_check_client_conn=True,
is_check_client_conn=check_client_conn,
is_verify_checksum=True,
check_client_conn_inst=[
f"{cluster_info['old_master_ip']}{IP_PORT_DIVIDER}{cluster_info['mysql_port']}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def __init__(self, root_id: str, ticket_data: Optional[Dict]):
self.ticket_data = ticket_data
# 仅添加从库。不切换。不复制账号
self.add_slave_only = self.ticket_data.get("add_slave_only", False)
self.check_client_conn = not self.ticket_data.get("force", False)

def __precheck(self):
"""
Expand Down Expand Up @@ -301,6 +302,7 @@ def upgrade_tendbha_cluster(self):
created_by=created_by,
force_uninstall=False,
ticket_type=self.ticket_data["ticket_type"],
check_client_conn=self.check_client_conn,
)
subflows.append(subflow)

Expand All @@ -322,6 +324,7 @@ def tendbha_cluster_upgrade_subflow(
created_by: str,
force_uninstall: bool,
ticket_type: str,
check_client_conn: bool,
):
"""
一主多从,整个集群升级
Expand Down Expand Up @@ -515,6 +518,7 @@ def tendbha_cluster_upgrade_subflow(
new_slave_ip=new_slave_ip,
old_ro_slave_ips=old_ro_slave_ips,
new_ro_slave_ips=new_ro_slave_ips,
check_client_conn=check_client_conn,
)
sub_pipeline.add_parallel_sub_pipeline(sub_flow_list=ms_switch_subflows)
# 清理实例级别周边配置
Expand Down Expand Up @@ -1139,6 +1143,7 @@ def build_ms_pair_switch_sub_pipelines(
new_slave_ip: str,
old_ro_slave_ips: list,
new_ro_slave_ips: list,
check_client_conn: bool,
):
switch_sub_pipeline_list = []
for cluster_id in relation_cluster_ids:
Expand Down Expand Up @@ -1167,6 +1172,7 @@ def build_ms_pair_switch_sub_pipelines(
ticket_data=copy.deepcopy(parent_global_data),
cluster=cluster_model,
cluster_info=copy.deepcopy(cluster_info),
check_client_conn=check_client_conn,
)
)
switch_sub_pipeline.add_act(
Expand Down

0 comments on commit e5e9a5e

Please sign in to comment.