Documentation ¶
Index ¶
- Constants
- func CreateChannelTasksFromPlans(ctx context.Context, source task.Source, timeout time.Duration, ...) []task.Task
- func CreateSegmentTasksFromPlans(ctx context.Context, source task.Source, timeout time.Duration, ...) []task.Task
- func PrintCurrentReplicaDist(replica *meta.Replica, stoppingNodesSegments map[int64][]*meta.Segment, ...)
- func PrintNewBalancePlans(collectionID int64, replicaID int64, segmentPlans []SegmentAssignPlan, ...)
- type Balance
- type ChannelAssignPlan
- type ChannelLevelScoreBalancer
- type MockBalancer
- func (_m *MockBalancer) AssignChannel(channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan
- func (_m *MockBalancer) AssignSegment(collectionID int64, segments []*meta.Segment, nodes []int64, ...) []SegmentAssignPlan
- func (_m *MockBalancer) BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
- func (_m *MockBalancer) EXPECT() *MockBalancer_Expecter
- type MockBalancer_AssignChannel_Call
- func (_c *MockBalancer_AssignChannel_Call) Return(_a0 []ChannelAssignPlan) *MockBalancer_AssignChannel_Call
- func (_c *MockBalancer_AssignChannel_Call) Run(run func(channels []*meta.DmChannel, nodes []int64, manualBalance bool)) *MockBalancer_AssignChannel_Call
- func (_c *MockBalancer_AssignChannel_Call) RunAndReturn(run func([]*meta.DmChannel, []int64, bool) []ChannelAssignPlan) *MockBalancer_AssignChannel_Call
- type MockBalancer_AssignSegment_Call
- func (_c *MockBalancer_AssignSegment_Call) Return(_a0 []SegmentAssignPlan) *MockBalancer_AssignSegment_Call
- func (_c *MockBalancer_AssignSegment_Call) Run(run func(collectionID int64, segments []*meta.Segment, nodes []int64, ...)) *MockBalancer_AssignSegment_Call
- func (_c *MockBalancer_AssignSegment_Call) RunAndReturn(run func(int64, []*meta.Segment, []int64, bool) []SegmentAssignPlan) *MockBalancer_AssignSegment_Call
- type MockBalancer_BalanceReplica_Call
- func (_c *MockBalancer_BalanceReplica_Call) Return(_a0 []SegmentAssignPlan, _a1 []ChannelAssignPlan) *MockBalancer_BalanceReplica_Call
- func (_c *MockBalancer_BalanceReplica_Call) Run(run func(replica *meta.Replica)) *MockBalancer_BalanceReplica_Call
- func (_c *MockBalancer_BalanceReplica_Call) RunAndReturn(run func(*meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)) *MockBalancer_BalanceReplica_Call
- type MockBalancer_Expecter
- func (_e *MockBalancer_Expecter) AssignChannel(channels interface{}, nodes interface{}, manualBalance interface{}) *MockBalancer_AssignChannel_Call
- func (_e *MockBalancer_Expecter) AssignSegment(collectionID interface{}, segments interface{}, nodes interface{}, ...) *MockBalancer_AssignSegment_Call
- func (_e *MockBalancer_Expecter) BalanceReplica(replica interface{}) *MockBalancer_BalanceReplica_Call
- type MultiTargetBalancer
- type RoundRobinBalancer
- func (b *RoundRobinBalancer) AssignChannel(channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan
- func (b *RoundRobinBalancer) AssignSegment(collectionID int64, segments []*meta.Segment, nodes []int64, ...) []SegmentAssignPlan
- func (b *RoundRobinBalancer) BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
- type RowCountBasedBalancer
- func (b *RowCountBasedBalancer) AssignChannel(channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan
- func (b *RowCountBasedBalancer) AssignSegment(collectionID int64, segments []*meta.Segment, nodes []int64, ...) []SegmentAssignPlan
- func (b *RowCountBasedBalancer) BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
- type ScoreBasedBalancer
- type SegmentAssignPlan
Constants ¶
const ( PlanInfoPrefix = "Balance-Plans:" DistInfoPrefix = "Balance-Dists:" )
Variables ¶
This section is empty.
Functions ¶
func PrintCurrentReplicaDist ¶
func PrintNewBalancePlans ¶
func PrintNewBalancePlans(collectionID int64, replicaID int64, segmentPlans []SegmentAssignPlan, channelPlans []ChannelAssignPlan, )
Types ¶
type Balance ¶
type Balance interface { AssignSegment(collectionID int64, segments []*meta.Segment, nodes []int64, manualBalance bool) []SegmentAssignPlan AssignChannel(channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan) }
type ChannelAssignPlan ¶
func (*ChannelAssignPlan) ToString ¶
func (chanPlan *ChannelAssignPlan) ToString() string
type ChannelLevelScoreBalancer ¶
type ChannelLevelScoreBalancer struct {
*ScoreBasedBalancer
}
score based segment use (collection_row_count + global_row_count * factor) as node' score and try to make each node has almost same score through balance segment.
func NewChannelLevelScoreBalancer ¶
func NewChannelLevelScoreBalancer(scheduler task.Scheduler, nodeManager *session.NodeManager, dist *meta.DistributionManager, meta *meta.Meta, targetMgr meta.TargetManagerInterface, ) *ChannelLevelScoreBalancer
func (*ChannelLevelScoreBalancer) BalanceReplica ¶
func (b *ChannelLevelScoreBalancer) BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
type MockBalancer ¶
MockBalancer is an autogenerated mock type for the Balance type
func NewMockBalancer ¶
func NewMockBalancer(t interface { mock.TestingT Cleanup(func()) }) *MockBalancer
NewMockBalancer creates a new instance of MockBalancer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockBalancer) AssignChannel ¶
func (_m *MockBalancer) AssignChannel(channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan
AssignChannel provides a mock function with given fields: channels, nodes, manualBalance
func (*MockBalancer) AssignSegment ¶
func (_m *MockBalancer) AssignSegment(collectionID int64, segments []*meta.Segment, nodes []int64, manualBalance bool) []SegmentAssignPlan
AssignSegment provides a mock function with given fields: collectionID, segments, nodes, manualBalance
func (*MockBalancer) BalanceReplica ¶
func (_m *MockBalancer) BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
BalanceReplica provides a mock function with given fields: replica
func (*MockBalancer) EXPECT ¶
func (_m *MockBalancer) EXPECT() *MockBalancer_Expecter
type MockBalancer_AssignChannel_Call ¶
MockBalancer_AssignChannel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AssignChannel'
func (*MockBalancer_AssignChannel_Call) Return ¶
func (_c *MockBalancer_AssignChannel_Call) Return(_a0 []ChannelAssignPlan) *MockBalancer_AssignChannel_Call
func (*MockBalancer_AssignChannel_Call) Run ¶
func (_c *MockBalancer_AssignChannel_Call) Run(run func(channels []*meta.DmChannel, nodes []int64, manualBalance bool)) *MockBalancer_AssignChannel_Call
func (*MockBalancer_AssignChannel_Call) RunAndReturn ¶
func (_c *MockBalancer_AssignChannel_Call) RunAndReturn(run func([]*meta.DmChannel, []int64, bool) []ChannelAssignPlan) *MockBalancer_AssignChannel_Call
type MockBalancer_AssignSegment_Call ¶
MockBalancer_AssignSegment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AssignSegment'
func (*MockBalancer_AssignSegment_Call) Return ¶
func (_c *MockBalancer_AssignSegment_Call) Return(_a0 []SegmentAssignPlan) *MockBalancer_AssignSegment_Call
func (*MockBalancer_AssignSegment_Call) Run ¶
func (_c *MockBalancer_AssignSegment_Call) Run(run func(collectionID int64, segments []*meta.Segment, nodes []int64, manualBalance bool)) *MockBalancer_AssignSegment_Call
func (*MockBalancer_AssignSegment_Call) RunAndReturn ¶
func (_c *MockBalancer_AssignSegment_Call) RunAndReturn(run func(int64, []*meta.Segment, []int64, bool) []SegmentAssignPlan) *MockBalancer_AssignSegment_Call
type MockBalancer_BalanceReplica_Call ¶
MockBalancer_BalanceReplica_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BalanceReplica'
func (*MockBalancer_BalanceReplica_Call) Return ¶
func (_c *MockBalancer_BalanceReplica_Call) Return(_a0 []SegmentAssignPlan, _a1 []ChannelAssignPlan) *MockBalancer_BalanceReplica_Call
func (*MockBalancer_BalanceReplica_Call) Run ¶
func (_c *MockBalancer_BalanceReplica_Call) Run(run func(replica *meta.Replica)) *MockBalancer_BalanceReplica_Call
func (*MockBalancer_BalanceReplica_Call) RunAndReturn ¶
func (_c *MockBalancer_BalanceReplica_Call) RunAndReturn(run func(*meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)) *MockBalancer_BalanceReplica_Call
type MockBalancer_Expecter ¶
type MockBalancer_Expecter struct {
// contains filtered or unexported fields
}
func (*MockBalancer_Expecter) AssignChannel ¶
func (_e *MockBalancer_Expecter) AssignChannel(channels interface{}, nodes interface{}, manualBalance interface{}) *MockBalancer_AssignChannel_Call
AssignChannel is a helper method to define mock.On call
- channels []*meta.DmChannel
- nodes []int64
- manualBalance bool
func (*MockBalancer_Expecter) AssignSegment ¶
func (_e *MockBalancer_Expecter) AssignSegment(collectionID interface{}, segments interface{}, nodes interface{}, manualBalance interface{}) *MockBalancer_AssignSegment_Call
AssignSegment is a helper method to define mock.On call
- collectionID int64
- segments []*meta.Segment
- nodes []int64
- manualBalance bool
func (*MockBalancer_Expecter) BalanceReplica ¶
func (_e *MockBalancer_Expecter) BalanceReplica(replica interface{}) *MockBalancer_BalanceReplica_Call
BalanceReplica is a helper method to define mock.On call
- replica *meta.Replica
type MultiTargetBalancer ¶
type MultiTargetBalancer struct { *ScoreBasedBalancer // contains filtered or unexported fields }
func NewMultiTargetBalancer ¶
func NewMultiTargetBalancer(scheduler task.Scheduler, nodeManager *session.NodeManager, dist *meta.DistributionManager, meta *meta.Meta, targetMgr meta.TargetManagerInterface) *MultiTargetBalancer
func (*MultiTargetBalancer) BalanceReplica ¶
func (b *MultiTargetBalancer) BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
type RoundRobinBalancer ¶
type RoundRobinBalancer struct {
// contains filtered or unexported fields
}
func NewRoundRobinBalancer ¶
func NewRoundRobinBalancer(scheduler task.Scheduler, nodeManager *session.NodeManager) *RoundRobinBalancer
func (*RoundRobinBalancer) AssignChannel ¶
func (b *RoundRobinBalancer) AssignChannel(channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan
func (*RoundRobinBalancer) AssignSegment ¶
func (b *RoundRobinBalancer) AssignSegment(collectionID int64, segments []*meta.Segment, nodes []int64, manualBalance bool) []SegmentAssignPlan
func (*RoundRobinBalancer) BalanceReplica ¶
func (b *RoundRobinBalancer) BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
type RowCountBasedBalancer ¶
type RowCountBasedBalancer struct { *RoundRobinBalancer // contains filtered or unexported fields }
func NewRowCountBasedBalancer ¶
func NewRowCountBasedBalancer( scheduler task.Scheduler, nodeManager *session.NodeManager, dist *meta.DistributionManager, meta *meta.Meta, targetMgr meta.TargetManagerInterface, ) *RowCountBasedBalancer
func (*RowCountBasedBalancer) AssignChannel ¶
func (b *RowCountBasedBalancer) AssignChannel(channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan
AssignSegment, when row count based balancer assign segments, it will assign channel to node with least global channel count. try to make every query node has channel count
func (*RowCountBasedBalancer) AssignSegment ¶
func (b *RowCountBasedBalancer) AssignSegment(collectionID int64, segments []*meta.Segment, nodes []int64, manualBalance bool) []SegmentAssignPlan
AssignSegment, when row count based balancer assign segments, it will assign segment to node with least global row count. try to make every query node has same row count.
func (*RowCountBasedBalancer) BalanceReplica ¶
func (b *RowCountBasedBalancer) BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
type ScoreBasedBalancer ¶
type ScoreBasedBalancer struct {
*RowCountBasedBalancer
}
score based segment use (collection_row_count + global_row_count * factor) as node' score and try to make each node has almost same score through balance segment.
func NewScoreBasedBalancer ¶
func NewScoreBasedBalancer(scheduler task.Scheduler, nodeManager *session.NodeManager, dist *meta.DistributionManager, meta *meta.Meta, targetMgr meta.TargetManagerInterface, ) *ScoreBasedBalancer
func (*ScoreBasedBalancer) AssignSegment ¶
func (b *ScoreBasedBalancer) AssignSegment(collectionID int64, segments []*meta.Segment, nodes []int64, manualBalance bool) []SegmentAssignPlan
AssignSegment got a segment list, and try to assign each segment to node's with lowest score
func (*ScoreBasedBalancer) BalanceReplica ¶
func (b *ScoreBasedBalancer) BalanceReplica(replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)