Skip to content

Commit

Permalink
fix: spider_slave添加部署备份程序; 调整例行数据修复的逻辑 TencentBlueKing#7440
Browse files Browse the repository at this point in the history
  • Loading branch information
yksitu authored and iSecloud committed Oct 23, 2024
1 parent 77b622e commit c2683ee
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,10 @@ def build_apps_for_spider_sub_flow(
},
)
# 因为同一台机器的只有会有一个spider实例,所以直接根据ip、bk_cloud_id获取对应实例的spider角色,来判断是否安装备份程序
if (
spider_role in [TenDBClusterSpiderRole.SPIDER_MASTER, TenDBClusterSpiderRole.SPIDER_MNT]
and is_install_backup
):
if is_install_backup:
acts_list.append(
{
"act_name": _("spider[{}]安装备份程序".format(spider_ip)),
"act_name": _("{}[{}]安装备份程序".format(spider_role.value, spider_ip)),
"act_component_code": ExecuteDBActuatorScriptComponent.code,
"kwargs": asdict(
ExecActuatorKwargs(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def add_spider_slave_notes(self, sub_flow_context: dict, cluster: Cluster, slave
添加spider-slave节点的子流程流程逻辑
必须集群存在从集群,才能添加
"""
# spider slave 不安装备份程序,只解压
sub_flow_context["untar_only"] = True

sub_pipeline = SubBuilder(root_id=self.root_id, data=copy.deepcopy(sub_flow_context))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def deploy_slave_cluster(self):
sub_flow_context["spider_charset"] = spider_charset
sub_flow_context["spider_version"] = spider_version

# spider slave 不安装备份程序,只解压
sub_flow_context["untar_only"] = True

# 启动子流程
sub_pipeline = SubBuilder(root_id=self.root_id, data=copy.deepcopy(sub_flow_context))

Expand Down
1 change: 1 addition & 0 deletions dbm-ui/backend/flow/utils/mysql/mysql_act_playload.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ def get_install_db_backup_payload(self, **kwargs) -> dict:
"cluster_type": cluster_type,
"exec_user": self.ticket_data["created_by"],
"shard_value": shard_port_map,
"untar_only": self.ticket_data.get("untar_only", False),
},
},
}
Expand Down
5 changes: 2 additions & 3 deletions dbm-ui/backend/ticket/builders/mysql/mysql_data_repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from backend.flow.engine.controller.mysql import MySQLController
from backend.ticket import builders
from backend.ticket.builders.common.constants import MySQLDataRepairTriggerMode
from backend.ticket.builders.common.field import DBTimezoneField
from backend.ticket.builders.mysql.base import BaseMySQLTicketFlowBuilder, MySQLBaseOperateDetailSerializer
from backend.ticket.constants import TicketType

Expand All @@ -31,8 +30,8 @@ class MySQLDataRepairInfoSerializer(serializers.Serializer):
checksum_table = serializers.CharField(help_text=_("校验单据结果表名"))
is_sync_non_innodb = serializers.BooleanField(help_text=_("非innodb表是否修复"), required=False, default=False)
is_ticket_consistent = serializers.BooleanField(help_text=_("校验结果是否一致"), required=False, default=False)
start_time = DBTimezoneField(help_text=_("开始时间"), required=False, default="")
end_time = DBTimezoneField(help_text=_("结束时间"), required=False, default="")
start_time = serializers.CharField(help_text=_("开始时间"), required=False, default="")
end_time = serializers.CharField(help_text=_("结束时间"), required=False, default="")
trigger_type = serializers.ChoiceField(help_text=_("数据修复触发类型"), choices=MySQLDataRepairTriggerMode.get_choices())


Expand Down
6 changes: 3 additions & 3 deletions dbm-ui/backend/ticket/tasks/ticket_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from backend.ticket.exceptions import TicketTaskTriggerException
from backend.ticket.flow_manager.inner import InnerFlow
from backend.ticket.models.ticket import Flow, Ticket, TicketFlowsConfig
from backend.utils.time import datetime2str
from backend.utils.time import date2str, datetime2str

logger = logging.getLogger("root")

Expand Down Expand Up @@ -204,8 +204,8 @@ def auto_create_data_repair_ticket(cls):
"is_ticket_consistent": False,
"checksum_table": MYSQL_CHECKSUM_TABLE,
"trigger_type": MySQLDataRepairTriggerMode.ROUTINE.value,
"start_time": datetime2str(start_time),
"end_time": datetime2str(end_time),
"start_time": date2str(start_time),
"end_time": date2str(end_time),
"infos": [
{
"cluster_id": cluster_id,
Expand Down

0 comments on commit c2683ee

Please sign in to comment.