Skip to content

Commit

Permalink
fix(sqlserver): 补充流重试对禁用、迁移集群跟迁移记录的互斥判断 #6604
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 17100
  • Loading branch information
ygcyao authored and iSecloud committed Sep 2, 2024
1 parent 6ef1d85 commit 11cc3de
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dbm-ui/backend/db_services/taskflow/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@

from backend.db_meta.exceptions import ClusterExclusiveOperateException
from backend.db_meta.models import Cluster
from backend.db_meta.models.sqlserver_dts import SqlserverDtsInfo
from backend.db_services.taskflow.constants import MAX_AUTO_RETRY_TIMES, RETRY_INTERVAL
from backend.db_services.taskflow.exceptions import RetryNodeException
from backend.flow.consts import StateType
from backend.flow.engine.bamboo.engine import BambooEngine
from backend.flow.models import FlowNode, FlowTree
from backend.flow.plugins.components.collections.common.base_service import BaseService
from backend.ticket.builders.common.base import fetch_cluster_ids
from backend.ticket.constants import FlowRetryType
from backend.ticket.constants import FlowRetryType, TicketType
from backend.ticket.models import Flow, Ticket

logger = logging.getLogger("flow")
Expand Down Expand Up @@ -78,6 +79,13 @@ def send_flow_state(state, _root_id, _node_id, _version_id):
# 判断重试任务关联单据是否存在执行互斥
try:
ticket = Ticket.objects.get(id=flow_node.uid)
ticket_type = ticket.ticket_type
if ticket_type == TicketType.SQLSERVER_DISABLE.value or ticket_type in [
TicketType.SQLSERVER_INCR_MIGRATE,
TicketType.SQLSERVER_FULL_MIGRATE,
]:
# 判断sqlserver禁用、迁移集群跟迁移记录是否互斥
SqlserverDtsInfo.dts_info_clusive(ticket_id=ticket.id, ticket_type=ticket_type, details=ticket.details)
cluster_ids = fetch_cluster_ids(ticket.details)
Cluster.handle_exclusive_operations(cluster_ids, ticket.ticket_type, exclude_ticket_ids=[ticket.id])
except ClusterExclusiveOperateException as e:
Expand Down

0 comments on commit 11cc3de

Please sign in to comment.