From 44536561fb8ea1ef4f72bb3f3d79f15e9aca128e Mon Sep 17 00:00:00 2001 From: wuxianrong Date: Wed, 19 Mar 2025 11:52:20 +0800 Subject: [PATCH 1/2] Example Repair the subjective and objective offline logic of primary and secondary nodes --- codis/pkg/topom/topom_sentinel.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/codis/pkg/topom/topom_sentinel.go b/codis/pkg/topom/topom_sentinel.go index f43a53fce6..243aa236d0 100644 --- a/codis/pkg/topom/topom_sentinel.go +++ b/codis/pkg/topom/topom_sentinel.go @@ -74,10 +74,17 @@ func (s *Topom) checkAndUpdateGroupServerState(conf *Config, group *models.Group } // Start the election master node - if groupServer.State == models.GroupServerStateOffline && isGroupMaster(state, group) { - *masterOfflineGroups = append(*masterOfflineGroups, group) - } else { - *slaveOfflineGroups = append(*slaveOfflineGroups, group) + // Currently, both primary and secondary nodes have subjective and objective logics. + // If it is subjective, we will not perform any operation. If more than 10 probe counts + // fail, it is defined as objective logics, If it is an objective offline, we will add the + // node to masterOfflineGroups and slaveOfflineGroups respectively, and then notify the Proxy + // to change the meta information + if groupServer.State == models.GroupServerStateOffline { + if isGroupMaster(state, group) { + *masterOfflineGroups = append(*masterOfflineGroups, group) + } else { + *slaveOfflineGroups = append(*slaveOfflineGroups, group) + } } } } else { From d3f3394fca3510ff8a904fffa7ca124e586da026 Mon Sep 17 00:00:00 2001 From: wuxianrong Date: Wed, 19 Mar 2025 14:15:44 +0800 Subject: [PATCH 2/2] fix comment --- codis/pkg/topom/topom_sentinel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codis/pkg/topom/topom_sentinel.go b/codis/pkg/topom/topom_sentinel.go index 243aa236d0..b190b93988 100644 --- a/codis/pkg/topom/topom_sentinel.go +++ b/codis/pkg/topom/topom_sentinel.go @@ -77,7 +77,7 @@ func (s *Topom) checkAndUpdateGroupServerState(conf *Config, group *models.Group // Currently, both primary and secondary nodes have subjective and objective logics. // If it is subjective, we will not perform any operation. If more than 10 probe counts // fail, it is defined as objective logics, If it is an objective offline, we will add the - // node to masterOfflineGroups and slaveOfflineGroups respectively, and then notify the Proxy + // node to masterOfflineGroups or slaveOfflineGroups respectively, and then notify the Proxy // to change the meta information if groupServer.State == models.GroupServerStateOffline { if isGroupMaster(state, group) {