Skip to content

Commit

Permalink
chore: mongodb is promoted problem (#7281)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5778596)
  • Loading branch information
xuriwuyun committed May 9, 2024
1 parent 059a3c6 commit 9cb44b4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/lorry/engines/mongodb/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,11 +597,15 @@ func (mgr *Manager) IsClusterHealthy(ctx context.Context, cluster *dcs.Cluster)

func (mgr *Manager) IsPromoted(ctx context.Context) bool {
isLeader, err := mgr.IsLeader(ctx, nil)
if err != nil || !isLeader {
if err != nil {
mgr.Logger.Info("Is leader check failed", "error", err.Error())
return false
}

if !isLeader {
return false
}

rsConfig, err := mgr.GetReplSetConfig(ctx)
if rsConfig == nil {
mgr.Logger.Info("Get replSet config failed", "error", err.Error())
Expand Down

0 comments on commit 9cb44b4

Please sign in to comment.