utils

package
v0.10.3-0...-bec5499 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SegmentCheckerName = "segment_checker"
	ChannelCheckerName = "channel_checker"
	BalanceCheckerName = "balance_checker"
	IndexCheckerName   = "index_checker"
	LeaderCheckerName  = "leader_checker"
	ManualBalanceName  = "manual_balance"
)

Variables

This section is empty.

Functions

func AssignReplica

func AssignReplica(ctx context.Context, m *meta.Meta, resourceGroups []string, replicaNumber int32, checkNodeNum bool) (map[string]int, error)

func CheckCollectionsQueryable

func CheckCollectionsQueryable(ctx context.Context, m *meta.Meta, targetMgr meta.TargetManagerInterface, dist *meta.DistributionManager, nodeMgr *session.NodeManager) error

CheckCollectionsQueryable check all channels are watched and all segments are loaded for this collection

func CheckDelegatorDataReady

func CheckDelegatorDataReady(nodeMgr *session.NodeManager, targetMgr meta.TargetManagerInterface, leader *meta.LeaderView, scope int32) error

In a replica, a shard is available, if and only if: 1. The leader is online 2. All QueryNodes in the distribution are online 3. The last heartbeat response time is within HeartbeatAvailableInterval for all QueryNodes(include leader) in the distribution 4. All segments of the shard in target should be in the distribution

func CheckNodeAvailable

func CheckNodeAvailable(nodeID int64, info *session.NodeInfo) error

func CreateTestChannel

func CreateTestChannel(collection, node, version int64, channel string) *meta.DmChannel

func CreateTestCollection

func CreateTestCollection(collection int64, replica int32) *meta.Collection

func CreateTestLeaderView

func CreateTestLeaderView(id, collection int64, channel string, segments map[int64]int64, growings map[int64]*meta.Segment) *meta.LeaderView

func CreateTestPartition

func CreateTestPartition(collection int64, partitionID int64) *meta.Partition

func CreateTestReplica

func CreateTestReplica(id, collectionID int64, nodes []int64) *meta.Replica

func CreateTestSchema

func CreateTestSchema() *schemapb.CollectionSchema

func CreateTestSegment

func CreateTestSegment(collection, partition, segment, node, version int64, channel string) *meta.Segment

func CreateTestSegmentInfo

func CreateTestSegmentInfo(collection, partition, segment int64, channel string) *datapb.SegmentInfo

func FilterReleased

func FilterReleased[E interface{ GetCollectionID() int64 }](elems []E, collections []int64) []E

func FindMaxVersionSegments

func FindMaxVersionSegments(segments []*meta.Segment) []*meta.Segment

func GetPartitions

func GetPartitions(ctx context.Context, collectionMgr *meta.CollectionManager, collectionID int64) ([]int64, error)

func GetShardLeaders

func GetShardLeaders(ctx context.Context, m *meta.Meta, targetMgr meta.TargetManagerInterface, dist *meta.DistributionManager, nodeMgr *session.NodeManager, collectionID int64) ([]*querypb.ShardLeadersList, error)

func GetShardLeadersWithChannels

func GetShardLeadersWithChannels(ctx context.Context, m *meta.Meta, targetMgr meta.TargetManagerInterface, dist *meta.DistributionManager,
	nodeMgr *session.NodeManager, collectionID int64, channels map[string]*meta.DmChannel,
) ([]*querypb.ShardLeadersList, error)

func GroupNodesByReplica

func GroupNodesByReplica(ctx context.Context, replicaMgr *meta.ReplicaManager, collectionID int64, nodes []int64) map[int64][]int64

GroupNodesByReplica groups nodes by replica, returns ReplicaID -> NodeIDs

func GroupPartitionsByCollection

func GroupPartitionsByCollection(partitions []*meta.Partition) map[int64][]*meta.Partition

GroupPartitionsByCollection groups partitions by collection, returns CollectionID -> Partitions

func GroupSegmentsByReplica

func GroupSegmentsByReplica(ctx context.Context, replicaMgr *meta.ReplicaManager, collectionID int64, segments []*meta.Segment) map[int64][]*meta.Segment

GroupSegmentsByReplica groups segments by replica, returns ReplicaID -> Segments

func MergeDmChannelInfo

func MergeDmChannelInfo(infos []*datapb.VchannelInfo) *meta.DmChannel

func MergeMetaSegmentIntoSegmentInfo

func MergeMetaSegmentIntoSegmentInfo(info *querypb.SegmentInfo, segments ...*meta.Segment)

func PackSegmentLoadInfo

func PackSegmentLoadInfo(segment *datapb.SegmentInfo, channelCheckpoint *msgpb.MsgPosition, indexes []*querypb.FieldIndexInfo) *querypb.SegmentLoadInfo

packSegmentLoadInfo packs SegmentLoadInfo for given segment, packs with index if withIndex is true, this fetch indexes from IndexCoord

func ReassignReplicaToRG

func ReassignReplicaToRG(
	ctx context.Context,
	m *meta.Meta,
	collectionID int64,
	newReplicaNumber int32,
	newResourceGroups []string,
) (map[string]int, map[string][]*meta.Replica, []int64, error)

func RecoverAllCollection

func RecoverAllCollection(m *meta.Meta)

RecoverAllCollectionrecovers all replica of all collection in resource group.

func RecoverReplicaOfCollection

func RecoverReplicaOfCollection(ctx context.Context, m *meta.Meta, collectionID typeutil.UniqueID)

RecoverReplicaOfCollection recovers all replica of collection with latest resource group.

func SpawnReplicasWithRG

func SpawnReplicasWithRG(ctx context.Context, m *meta.Meta, collection int64, resourceGroups []string, replicaNumber int32, channels []string) ([]*meta.Replica, error)

SpawnReplicasWithRG spawns replicas in rgs one by one for given collection.

Types

type CheckerType

type CheckerType int32
const (
	ChannelChecker CheckerType = iota + 1
	SegmentChecker
	BalanceChecker
	IndexChecker
	LeaderChecker
	ManualBalance
)

func (CheckerType) String

func (s CheckerType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL