Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mysql): mysql元数据检查部分项丢失实例信息 #8818 #8819

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
_cluster_slave_as_receiver,
)
from backend.db_periodic_task.local_tasks.db_meta.db_meta_check.mysql_cluster_topo.tendbha.status import (
_cluster_instance_status,
_cluster_master_entry_count,
_cluster_master_status,
_cluster_one_master,
Expand Down Expand Up @@ -70,19 +71,23 @@ def health_check(cluster_id: int) -> List[CheckResponse]:
cluster_obj = qs.get(id=cluster_id)

res = []

res.extend(_cluster_status(cluster_obj))
# unique_cluster.py
res.extend(_cluster_instance_unique_cluster(cluster_obj))
# status.py
res.extend(_cluster_status(cluster_obj))
res.extend(_cluster_instance_status(cluster_obj))
res.extend(_cluster_master_entry_count(cluster_obj))
res.extend(_cluster_proxy_count(cluster_obj))
res.extend(_cluster_one_master(cluster_obj))
res.extend(_cluster_master_status(cluster_obj))
res.extend(_cluster_one_standby_slave(cluster_obj))
res.extend(_cluster_standby_slave_status(cluster_obj))
# entry_bind.py
res.extend(_cluster_master_entry_on_proxy(cluster_obj))
res.extend(_cluster_master_entry_on_storage(cluster_obj))
res.extend(_cluster_entry_real_bind(cluster_obj))
res.extend(_cluster_proxy_access_master(cluster_obj))
# replicate.py
res.extend(_cluster_master_as_ejector(cluster_obj))
res.extend(_cluster_slave_as_receiver(cluster_obj))
res.extend(_cluster_replicate_out(cluster_obj))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from typing import List

from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from backend.db_meta.enums import ClusterEntryRole, ClusterStatus, InstanceInnerRole, InstancePhase, InstanceStatus
from backend.db_meta.models import Cluster
Expand Down Expand Up @@ -153,9 +153,7 @@ def _cluster_one_standby_slave(


@checker_wrapper
def _cluster_standby_slave_status(
c: Cluster,
) -> List[CheckResponse]:
def _cluster_standby_slave_status(c: Cluster) -> List[CheckResponse]:
"""
standby slave 必须正常
"""
Expand All @@ -164,12 +162,12 @@ def _cluster_standby_slave_status(
if (si.instance_inner_role == InstanceInnerRole.SLAVE and si.is_stand_by is True) and (
si.status != InstanceStatus.RUNNING or si.phase != InstancePhase.ONLINE
):
bad.append(si)

if bad:
return [
CheckResponse(
msg=_("standby slave 状态异常: {}".format(",".join([ele.ip_port for ele in bad]))),
check_subtype=MetaCheckSubType.ClusterTopo,
bad.append(
CheckResponse(
msg=_("standby slave {} 状态异常: {}, {}".format(si.ip_port, si.status, si.phase)),
check_subtype=MetaCheckSubType.ClusterTopo,
instance=si,
)
)
]

return bad
Loading