shards

package
v0.10.3-0...-96d0e78 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCollectionExists   = errors.New("collection exists")
	ErrCollectionNotFound = errors.New("collection not found")
	ErrPartitionExists    = errors.New("partition exists")
	ErrPartitionNotFound  = errors.New("partition not found")
	ErrSegmentExists      = errors.New("segment exists")
	ErrSegmentNotFound    = errors.New("segment not found")
	ErrSegmentOnGrowing   = errors.New("segment on growing")
	ErrFencedAssign       = errors.New("fenced assign")

	ErrTimeTickTooOld    = errors.New("time tick is too old")
	ErrWaitForNewSegment = errors.New("wait for new segment")
	ErrNotGrowing        = errors.New("segment is not growing")
	ErrNotEnoughSpace    = stats.ErrNotEnoughSpace
	ErrTooLargeInsert    = stats.ErrTooLargeInsert
)

Functions

This section is empty.

Types

type AssignSegmentRequest

type AssignSegmentRequest struct {
	CollectionID    int64
	PartitionID     int64
	ModifiedMetrics stats.ModifiedMetrics
	TimeTick        uint64
	TxnSession      TxnSession
}

AssignSegmentRequest is a request to allocate segment.

type AssignSegmentResult

type AssignSegmentResult struct {
	SegmentID   int64
	Acknowledge *atomic.Int32 // used to ack the segment assign result has been consumed
}

AssignSegmentResult is a result of segment allocation. The sum of Results.Row is equal to InserMetrics.NumRows.

func (*AssignSegmentResult) Ack

func (r *AssignSegmentResult) Ack()

Ack acks the segment assign result has been consumed. Must be only call once after the segment assign result has been consumed.

type CollectionInfo

type CollectionInfo struct {
	VChannel     string
	PartitionIDs map[int64]struct{}
}

type PartitionUniqueKey

type PartitionUniqueKey = utils.PartitionUniqueKey

type SegmentBelongs

type SegmentBelongs = utils.SegmentBelongs

type SegmentLimitationPolicy

type SegmentLimitationPolicy interface {
	// GenerateLimitation generates the limitation of the segment.
	GenerateLimitation(lv datapb.SegmentLevel) segmentLimitation
}

SegmentLimitationPolicy is the interface to generate the limitation of the segment.

type ShardManager

type ShardManager interface {
	log.WithLogger

	Channel() types.PChannelInfo

	CheckIfCollectionCanBeCreated(collectionID int64) error

	CheckIfCollectionExists(collectionID int64) error

	CreateCollection(msg message.ImmutableCreateCollectionMessageV1)

	DropCollection(msg message.ImmutableDropCollectionMessageV1)

	CheckIfPartitionCanBeCreated(uniquePartitionKey PartitionUniqueKey) error

	CheckIfPartitionExists(uniquePartitionKey PartitionUniqueKey) error

	CreatePartition(msg message.ImmutableCreatePartitionMessageV1)

	DropPartition(msg message.ImmutableDropPartitionMessageV1)

	CheckIfSegmentCanBeCreated(uniquePartitionKey PartitionUniqueKey, segmentID int64) error

	CheckIfSegmentCanBeFlushed(uniquePartitionKey PartitionUniqueKey, segmentID int64) error

	CreateSegment(msg message.ImmutableCreateSegmentMessageV2)

	FlushSegment(msg message.ImmutableFlushMessageV2)

	AssignSegment(req *AssignSegmentRequest) (*AssignSegmentResult, error)

	ApplyDelete(msg message.MutableDeleteMessageV1) error

	WaitUntilGrowingSegmentReady(uniquePartitionKey PartitionUniqueKey) (<-chan struct{}, error)

	FlushAndFenceSegmentAllocUntil(collectionID int64, timetick uint64) ([]int64, error)

	AsyncFlushSegment(signal utils.SealSegmentSignal)

	Close()
}

func RecoverShardManager

func RecoverShardManager(param *ShardManagerRecoverParam) ShardManager

RecoverShardManager recovers the segment assignment manager from the recovery snapshot.

type ShardManagerRecoverParam

type ShardManagerRecoverParam struct {
	ChannelInfo            types.PChannelInfo
	WAL                    *syncutil.Future[wal.WAL]
	InitialRecoverSnapshot *recovery.RecoverySnapshot
	TxnManager             TxnManager
}

ShardManagerRecoverParam is the parameter for recovering the segment assignment manager.

type TxnManager

type TxnManager interface {
	RecoverDone() <-chan struct{}
}

type TxnSession

type TxnSession interface {
	// should be called when the session is done.
	RegisterCleanup(cleanup func(), timetick uint64)
}

TxnSession is a session interface

Jump to

Keyboard shortcuts

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