MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / probeNode

Method probeNode

controller/cluster.go:107–123  ·  view source on GitHub ↗
(ctx context.Context, node store.Node)

Source from the content-addressed store, hash-verified

105}
106
107func (c *ClusterChecker) probeNode(ctx context.Context, node store.Node) (int64, error) {
108 clusterInfo, err := node.GetClusterInfo(ctx)
109 if err != nil {
110 // We need to use the string contains to check the error message
111 // since Kvrocks wrongly returns the error message with `ERR` prefix.
112 // And it's fixed in PR: https://github.com/apache/kvrocks/pull/2362,
113 // but we need to be compatible with the old version here.
114 if strings.Contains(err.Error(), ErrRestoringBackUp.Error()) {
115 return -1, ErrRestoringBackUp
116 } else if strings.Contains(err.Error(), ErrClusterNotInitialized.Error()) {
117 return -1, ErrClusterNotInitialized
118 } else {
119 return -1, err
120 }
121 }
122 return clusterInfo.CurrentEpoch, nil
123}
124
125func (c *ClusterChecker) increaseFailureCount(shardIndex int, node store.Node) int64 {
126 id := node.ID()

Callers 1

parallelProbeNodesMethod · 0.95

Calls 3

ErrorMethod · 0.80
GetClusterInfoMethod · 0.65
ContainsMethod · 0.45

Tested by

no test coverage detected