TiKVStatus 的 PeerStores 是什么意思?

看 TiDB-Operator 源码,里面 TiKVStatus 有个字段 PeerStores,我看源码里面对它的赋值,是否可以理解为不是 Operator 纳管的内网节点,是接入的外部节点?

你看的那段源码?发一下呢。

应该是tikv的副本存储相关的信息吧

	for _, store := range storesInfo.Stores {
		status := getTiKVStore(store)
		if status == nil {
			continue
		}

		oldStore, exist := previousStores[status.ID]
		if !exist {
			oldStore, exist = previousPeerStores[status.ID]
		}

		status.LastTransitionTime = metav1.Now()
		if exist && status.State == oldStore.State {
			status.LastTransitionTime = oldStore.LastTransitionTime
		}

		// In theory, the external tikv can join the cluster, and the operator would only manage the internal tikv.
		// So we check the store owner to make sure it.
		if store.Store != nil {
			if pattern.Match([]byte(store.Store.Address)) { 
				stores[status.ID] = *status
			} else if util.MatchLabelFromStoreLabels(store.Store.Labels, label.TiKVLabelVal) { 
				peerStores[status.ID] = *status
			}
		}
	}

应该是指其他副本的状态。
默认三副本的数据,每个副本之间互相称为彼此的peer

从代码来看,不是内网域名且lable 为 tikv 的加入 peerStores,感觉像是外部 stores,应该不是 region 的 peer 概念

1 个赞

也不可能是外部的tikv。因为store.Store是从遍历storesInfo.Stores得到的,而storesInfo又是从pd取的。

能从pd取得就一定是集群内的。

所以这个store确定是集群内的,但是可能这个store的store.Store.Address,又不符合

tikvStoreLimitPattern = %s-tikv-\d+\.%s-tikv-peer\.%s\.svc%s\:\d+

类似正则表达式的范围。推测可能是使用了其他的工具(非tidb Operator)扩容的结果。

在 TiDB Operator 的上下文中,TiKVStatus 是一个用于描述 TiKV 实例状态的结构体。它包含了多个字段来表示不同方面的状态信息,其中之一是 PeerStores。