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 NewBalanceReport() *balanceReport
- func PrintCurrentReplicaDist(replica *meta.Replica, stoppingNodesSegments map[int64][]*meta.Segment, ...)
- func PrintNewBalancePlans(collectionID int64, replicaID int64, segmentPlans []SegmentAssignPlan, ...)
- func StrRecord(str string) strRecord
- func StrRecordf(format string, values ...any) strRecordf
- type Balance
- type ChannelAssignPlan
- type ChannelLevelScoreBalancer
- type MockBalancer
- func (_m *MockBalancer) AssignChannel(ctx context.Context, channels []*meta.DmChannel, nodes []int64, ...) []ChannelAssignPlan
- func (_m *MockBalancer) AssignSegment(ctx context.Context, collectionID int64, segments []*meta.Segment, ...) []SegmentAssignPlan
- func (_m *MockBalancer) BalanceReplica(ctx context.Context, 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(ctx context.Context, channels []*meta.DmChannel, nodes []int64, ...)) *MockBalancer_AssignChannel_Call
- func (_c *MockBalancer_AssignChannel_Call) RunAndReturn(...) *MockBalancer_AssignChannel_Call
- type 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(ctx context.Context, replica *meta.Replica)) *MockBalancer_BalanceReplica_Call
- func (_c *MockBalancer_BalanceReplica_Call) RunAndReturn(...) *MockBalancer_BalanceReplica_Call
- type MockBalancer_Expecter
- func (_e *MockBalancer_Expecter) AssignChannel(ctx interface{}, channels interface{}, nodes interface{}, ...) *MockBalancer_AssignChannel_Call
- func (_e *MockBalancer_Expecter) AssignSegment(ctx interface{}, collectionID interface{}, segments interface{}, ...) *MockBalancer_AssignSegment_Call
- func (_e *MockBalancer_Expecter) BalanceReplica(ctx interface{}, replica interface{}) *MockBalancer_BalanceReplica_Call
- type MultiTargetBalancer
- type RoundRobinBalancer
- func (b *RoundRobinBalancer) AssignChannel(ctx context.Context, channels []*meta.DmChannel, nodes []int64, ...) []ChannelAssignPlan
- func (b *RoundRobinBalancer) AssignSegment(ctx context.Context, collectionID int64, segments []*meta.Segment, ...) []SegmentAssignPlan
- func (b *RoundRobinBalancer) BalanceReplica(ctx context.Context, replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
- type RowCountBasedBalancer
- func (b *RowCountBasedBalancer) AssignChannel(ctx context.Context, channels []*meta.DmChannel, nodes []int64, ...) []ChannelAssignPlan
- func (b *RowCountBasedBalancer) AssignSegment(ctx context.Context, collectionID int64, segments []*meta.Segment, ...) []SegmentAssignPlan
- func (b *RowCountBasedBalancer) BalanceReplica(ctx context.Context, replica *meta.Replica) (segmentPlans []SegmentAssignPlan, channelPlans []ChannelAssignPlan)
- type ScoreBasedBalancer
- type SegmentAssignPlan
Constants ¶
const ( PlanInfoPrefix = "Balance-Plans:" DistInfoPrefix = "Balance-Dists:" )
Variables ¶
This section is empty.
Functions ¶
func NewBalanceReport ¶
func NewBalanceReport() *balanceReport
NewBalanceReport returns an initialized BalanceReport instance
func PrintCurrentReplicaDist ¶
func PrintNewBalancePlans ¶
func PrintNewBalancePlans(collectionID int64, replicaID int64, segmentPlans []SegmentAssignPlan, channelPlans []ChannelAssignPlan, )
func StrRecordf ¶
Types ¶
type Balance ¶
type Balance interface { AssignSegment(ctx context.Context, collectionID int64, segments []*meta.Segment, nodes []int64, manualBalance bool) []SegmentAssignPlan AssignChannel(ctx context.Context, channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan BalanceReplica(ctx context.Context, replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan) }
type ChannelAssignPlan ¶
func (*ChannelAssignPlan) String ¶
func (chanPlan *ChannelAssignPlan) String() 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(ctx context.Context, replica *meta.Replica) (segmentPlans []SegmentAssignPlan, channelPlans []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(ctx context.Context, channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan
AssignChannel provides a mock function with given fields: ctx, channels, nodes, manualBalance
func (*MockBalancer) AssignSegment ¶
func (_m *MockBalancer) AssignSegment(ctx context.Context, collectionID int64, segments []*meta.Segment, nodes []int64, manualBalance bool) []SegmentAssignPlan
AssignSegment provides a mock function with given fields: ctx, collectionID, segments, nodes, manualBalance
func (*MockBalancer) BalanceReplica ¶
func (_m *MockBalancer) BalanceReplica(ctx context.Context, replica *meta.Replica) ([]SegmentAssignPlan, []ChannelAssignPlan)
BalanceReplica provides a mock function with given fields: ctx, 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(ctx context.Context, channels []*meta.DmChannel, nodes []int64, manualBalance bool)) *MockBalancer_AssignChannel_Call
func (*MockBalancer_AssignChannel_Call) RunAndReturn ¶
func (_c *MockBalancer_AssignChannel_Call) RunAndReturn(run func(context.Context, []*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(ctx context.Context, 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(context.Context, 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(ctx context.Context, replica *meta.Replica)) *MockBalancer_BalanceReplica_Call
func (*MockBalancer_BalanceReplica_Call) RunAndReturn ¶
func (_c *MockBalancer_BalanceReplica_Call) RunAndReturn(run func(context.Context, *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(ctx interface{}, channels interface{}, nodes interface{}, manualBalance interface{}) *MockBalancer_AssignChannel_Call
AssignChannel is a helper method to define mock.On call
- ctx context.Context
- channels []*meta.DmChannel
- nodes []int64
- manualBalance bool
func (*MockBalancer_Expecter) AssignSegment ¶
func (_e *MockBalancer_Expecter) AssignSegment(ctx interface{}, collectionID interface{}, segments interface{}, nodes interface{}, manualBalance interface{}) *MockBalancer_AssignSegment_Call
AssignSegment is a helper method to define mock.On call
- ctx context.Context
- collectionID int64
- segments []*meta.Segment
- nodes []int64
- manualBalance bool
func (*MockBalancer_Expecter) BalanceReplica ¶
func (_e *MockBalancer_Expecter) BalanceReplica(ctx interface{}, replica interface{}) *MockBalancer_BalanceReplica_Call
BalanceReplica is a helper method to define mock.On call
- ctx context.Context
- 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(ctx context.Context, replica *meta.Replica) (segmentPlans []SegmentAssignPlan, channelPlans []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(ctx context.Context, channels []*meta.DmChannel, nodes []int64, manualBalance bool) []ChannelAssignPlan
func (*RoundRobinBalancer) AssignSegment ¶
func (b *RoundRobinBalancer) AssignSegment(ctx context.Context, collectionID int64, segments []*meta.Segment, nodes []int64, manualBalance bool) []SegmentAssignPlan
func (*RoundRobinBalancer) BalanceReplica ¶
func (b *RoundRobinBalancer) BalanceReplica(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, replica *meta.Replica) (segmentPlans []SegmentAssignPlan, channelPlans []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(ctx context.Context, 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(ctx context.Context, replica *meta.Replica) (segmentPlans []SegmentAssignPlan, channelPlans []ChannelAssignPlan)