splitter

package
v5.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultChannelBuffer = 1024
View Source
const (
	SplitThreshold = 1000
)

Variables

This section is empty.

Functions

func GetSplitFields

func GetSplitFields(table *model.TableInfo, splitFields []string) ([]*model.ColumnInfo, error)

GetSplitFields returns fields to split chunks, order by pk, uk, index, columns.

Types

type BucketIterator

type BucketIterator struct {
	// contains filtered or unexported fields
}

func NewBucketIterator

func NewBucketIterator(ctx context.Context, progressID string, table *common.TableDiff, dbConn *sql.DB) (*BucketIterator, error)

func NewBucketIteratorWithCheckpoint

func NewBucketIteratorWithCheckpoint(ctx context.Context, progressID string, table *common.TableDiff, dbConn *sql.DB, startRange *RangeInfo, checkThreadCount int) (*BucketIterator, error)

func (*BucketIterator) Close

func (s *BucketIterator) Close()

func (*BucketIterator) GetIndexID

func (s *BucketIterator) GetIndexID() int64

func (*BucketIterator) Next

func (s *BucketIterator) Next() (*chunk.Range, error)

type ChunkIterator

type ChunkIterator interface {
	// Next seeks the next chunk, return nil if seeks to end.
	Next() (*chunk.Range, error)
	Close()
}

ChunkIterator generate next chunk for only one table lazily.

type LimitIterator

type LimitIterator struct {
	// contains filtered or unexported fields
}

func NewLimitIterator

func NewLimitIterator(ctx context.Context, progressID string, table *common.TableDiff, dbConn *sql.DB) (*LimitIterator, error)

func NewLimitIteratorWithCheckpoint

func NewLimitIteratorWithCheckpoint(ctx context.Context, progressID string, table *common.TableDiff, dbConn *sql.DB, startRange *RangeInfo) (*LimitIterator, error)

func (*LimitIterator) Close

func (lmt *LimitIterator) Close()

func (*LimitIterator) GetIndexID

func (lmt *LimitIterator) GetIndexID() int64

func (*LimitIterator) Next

func (lmt *LimitIterator) Next() (*chunk.Range, error)

type RandomIterator

type RandomIterator struct {
	// contains filtered or unexported fields
}

func NewRandomIterator

func NewRandomIterator(ctx context.Context, progressID string, table *common.TableDiff, dbConn *sql.DB) (*RandomIterator, error)

func NewRandomIteratorWithCheckpoint

func NewRandomIteratorWithCheckpoint(ctx context.Context, progressID string, table *common.TableDiff, dbConn *sql.DB, startRange *RangeInfo) (*RandomIterator, error)

func (*RandomIterator) Close

func (s *RandomIterator) Close()

func (*RandomIterator) Next

func (s *RandomIterator) Next() (*chunk.Range, error)

type RangeInfo

type RangeInfo struct {
	ChunkRange *chunk.Range `json:"chunk-range"`
	// for bucket checkpoint
	IndexID int64 `json:"index-id"`

	ProgressID string `json:"progress-id"`
}

RangeInfo represents the unit of a process chunk. It's the only entrance of checkpoint.

func FromNode

func FromNode(n *checkpoints.Node) *RangeInfo

func (*RangeInfo) Copy

func (r *RangeInfo) Copy() *RangeInfo

func (*RangeInfo) GetBucketIndexLeft

func (r *RangeInfo) GetBucketIndexLeft() int

func (*RangeInfo) GetBucketIndexRight

func (r *RangeInfo) GetBucketIndexRight() int

func (*RangeInfo) GetChunk

func (r *RangeInfo) GetChunk() *chunk.Range

func (*RangeInfo) GetChunkIndex

func (r *RangeInfo) GetChunkIndex() int

func (*RangeInfo) GetTableIndex

func (r *RangeInfo) GetTableIndex() int

GetTableIndex return the index of table diffs. IMPORTANT!!! We need to keep the tables order during checkpoint. So we should have to save the config info to checkpoint file too

func (*RangeInfo) ToNode

func (r *RangeInfo) ToNode() *checkpoints.Node

func (*RangeInfo) Update

func (r *RangeInfo) Update(column, lower, upper string, updateLower, updateUpper bool, collation, limits string)

Jump to

Keyboard shortcuts

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