Skip to content

Commit

Permalink
fix(cluster,status): Reduce useless log output radondb#508
Browse files Browse the repository at this point in the history
1. status.go: adjust the log level(ERROR->DEBUG)
2. statefulset.go: remove unnecessary output items

fix: radondb#508
  • Loading branch information
runkecheng committed Jun 1, 2022
1 parent 4821e07 commit 012e0c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions mysqlcluster/syncer/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ func (s *StatefulSetSyncer) applyNWait(ctx context.Context, pod *corev1.Pod) err
s.log.Info("pod is already updated", "pod name", pod.Name)
} else {
s.Status.State = apiv1alpha1.ClusterUpdateState
s.log.Info("updating pod", "pod", pod.Name, "key", s.Unwrap())
s.log.Info("updating pod", "pod", pod.Name)
if pod.DeletionTimestamp != nil {
s.log.Info("pod is being deleted", "pod", pod.Name, "key", s.Unwrap())
s.log.Info("pod is being deleted", "pod", pod.Name)
} else {
// If healthy is always `yes`, retry() will exit in advance, which may
// cause excessive nodes are deleted at the same time, details: issue#310.
Expand All @@ -510,7 +510,7 @@ func (s *StatefulSetSyncer) applyNWait(ctx context.Context, pod *corev1.Pod) err
return false, err
}
if ordinal >= int(*s.Spec.Replicas) {
s.log.Info("replicas were changed, should skip", "pod", pod.Name)
s.log.Info("replicas were changed, should skip", "pod", pod.Name)
return true, nil
}

Expand Down
10 changes: 5 additions & 5 deletions mysqlcluster/syncer/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (s *StatusSyncer) updateNodeStatus(ctx context.Context, cli client.Client,
node.Message = ""

if err := s.updateNodeRaftStatus(node); err != nil {
s.log.Error(err, "failed to get/update node raft status", "node", node.Name)
s.log.V(1).Info("failed to get/update node raft status", "node", node.Name, "error", err)
node.Message = err.Error()
}

Expand All @@ -249,18 +249,18 @@ func (s *StatusSyncer) updateNodeStatus(ctx context.Context, cli client.Client,
s.cli, s.MysqlCluster.GetClusterKey(), utils.OperatorUser, host))
defer closeConn()
if err != nil {
s.log.Error(err, "failed to connect the mysql", "node", node.Name)
s.log.V(1).Info("failed to connect the mysql", "node", node.Name, "error", err)
node.Message = err.Error()
} else {
isLagged, isReplicating, err = internal.CheckSlaveStatusWithRetry(sqlRunner, checkNodeStatusRetry)
if err != nil {
s.log.Error(err, "failed to check slave status", "node", node.Name)
s.log.V(1).Info("failed to check slave status", "node", node.Name, "error", err)
node.Message = err.Error()
}

isReadOnly, err = internal.CheckReadOnly(sqlRunner)
if err != nil {
s.log.Error(err, "failed to check read only", "node", node.Name)
s.log.V(1).Info("failed to check read only", "node", node.Name, "error", err)
node.Message = err.Error()
}

Expand All @@ -281,7 +281,7 @@ func (s *StatusSyncer) updateNodeStatus(ctx context.Context, cli client.Client,
s.updateNodeCondition(node, int(apiv1alpha1.IndexReadOnly), isReadOnly)

if err = s.updatePodLabel(ctx, &pod, node); err != nil {
s.log.Error(err, "failed to update labels", "pod", pod.Name, "namespace", pod.Namespace)
s.log.V(1).Info("failed to update labels", "pod", pod.Name, "error", err)
}
}

Expand Down

0 comments on commit 012e0c1

Please sign in to comment.