From a5425f637070c3d042c089a1de591b6aa655ad5d Mon Sep 17 00:00:00 2001 From: solid-yang Date: Mon, 25 Mar 2024 14:08:36 +0800 Subject: [PATCH] only reset s when the node turns from slave to master --- storage/tianchi/ha_tse.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/tianchi/ha_tse.cc b/storage/tianchi/ha_tse.cc index 17d8ae7..6819c62 100644 --- a/storage/tianchi/ha_tse.cc +++ b/storage/tianchi/ha_tse.cc @@ -3981,9 +3981,12 @@ int32_t tse_get_cluster_role() { return ctc_cluster_role; } tse_log_system("[Disaster Recovery] is_slave:%d, cantian_cluster_ready:%d", is_slave, cantian_cluster_ready); + // ctc_cluster_role: The character the node was before change + // is_slave: The character the node is now + // Only reset 'read_only's to false when the node turns from slave to master if (is_slave) { tse_set_mysql_read_only(); - } else { + } else if (ctc_cluster_role == (int32_t)dis_cluster_role::STANDBY) { tse_reset_mysql_read_only(); } ctc_cluster_role = is_slave ? (int32_t)dis_cluster_role::STANDBY : (int32_t)dis_cluster_role::PRIMARY; -- Gitee