From 5e89a5e9367d269b606958d2f93320164e09f4fa Mon Sep 17 00:00:00 2001 From: qichang Date: Wed, 18 Dec 2024 20:13:45 +0800 Subject: [PATCH] cluster role query --- storage/ctc/ha_ctc.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/storage/ctc/ha_ctc.cc b/storage/ctc/ha_ctc.cc index bad744f..b991223 100644 --- a/storage/ctc/ha_ctc.cc +++ b/storage/ctc/ha_ctc.cc @@ -4392,8 +4392,10 @@ int ha_ctc::records_from_index(ha_rows *num_rows, uint inx) } int32_t ctc_get_cluster_role() { - if (ctc_cluster_role != (int32_t)dis_cluster_role::DEFAULT) { - return ctc_cluster_role; + /* Normally, the cluster type should only be PRIMARY or STANDBY */ + if (ctc_cluster_role == (int32_t)dis_cluster_role::PRIMARY || + ctc_cluster_role == (int32_t)dis_cluster_role::STANDBY) { + return ctc_cluster_role; } lock_guard lock(m_ctc_cluster_role_mutex); bool is_slave = false; -- Gitee