@@ -610,7 +610,6 @@ func (s *StatusSyncer) RoCheckStatus(ctx context.Context, cli client.Client, pod
610610 host := fmt .Sprintf ("%s.%s.%s" , podName , s .GetNameForResource (utils .ReadOnlyHeadlessSVC ), s .Namespace )
611611 index := s .getRoStatusIndex (host )
612612 node := & s .Status .Nodes [index ]
613- node .Message = ""
614613
615614 isInitial , isReadonly , isCloseSemi , isReplicating := corev1 .ConditionUnknown , corev1 .ConditionUnknown , corev1 .ConditionUnknown , corev1 .ConditionUnknown
616615 isSupperReadOnly := corev1 .ConditionUnknown
@@ -661,7 +660,21 @@ func (s *StatusSyncer) RoCheckStatus(ctx context.Context, cli client.Client, pod
661660 }
662661 // 3. change master
663662 if _ , isReplicating , err = internal .CheckSlaveStatus (sqlRunner , s .Spec .ReplicaLag ); err != nil {
664- node .Message = err .Error ()
663+ parts := strings .Split (node .Message , " " )
664+ now := time .Now ().Unix ()
665+ var last int64
666+ var err2 error
667+ if len (parts [0 ]) == 0 {
668+ node .Message = fmt .Sprintf ("%d unixtime error:" , now ) + err .Error ()
669+ } else if last , err2 = strconv .ParseInt (parts [0 ], 10 , 64 ); err2 != nil {
670+ s .log .Info ("get times from message" , "times" , last )
671+ }
672+ if now - last > 10 {
673+ node .Message = fmt .Sprintf ("%d unixseconds error:" , now ) + err .Error ()
674+ }
675+
676+ } else {
677+ node .Message = ""
665678 }
666679 }
667680 //update node Rostatus
0 commit comments