coord

package
v0.0.0-...-cea691e Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: PostgreSQL Imports: 57 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialRouter

func DialRouter(r *topology.Router) (*grpc.ClientConn, error)

Types

type ClusteredCoordinator

type ClusteredCoordinator struct {
	coord.Coordinator
	// contains filtered or unexported fields
}

* This is the global coordinator, which manages the spqr cluster as a whole. * Its method calls result in cluster-wide changes.

func NewClusteredCoordinator

func NewClusteredCoordinator(tlsconfig *tls.Config, db qdb.XQDB, maxTxnBatch uint16) (*ClusteredCoordinator, error)

func (*ClusteredCoordinator) AddDataShard

func (qc *ClusteredCoordinator) AddDataShard(ctx context.Context, shard *topology.DataShard) error

func (*ClusteredCoordinator) AddRouter

func (qc *ClusteredCoordinator) AddRouter(ctx context.Context, router *topology.Router) error

TODO : unit tests

func (*ClusteredCoordinator) AddWorldShard

func (qc *ClusteredCoordinator) AddWorldShard(_ context.Context, _ *topology.DataShard) error

func (*ClusteredCoordinator) AlterDistributedRelation

func (qc *ClusteredCoordinator) AlterDistributedRelation(ctx context.Context, id string, rel *distributions.DistributedRelation) error

AlterDistributedRelation changes relation attached to a distribution TODO: unit tests

func (*ClusteredCoordinator) AlterDistributedRelationDistributionKey

func (qc *ClusteredCoordinator) AlterDistributedRelationDistributionKey(ctx context.Context, id string, relationFQN *rfqn.RelationFQN, distributionKey []distributions.DistributionKeyEntry) error

AlterDistributedRelationSchema changes the distribution key of a relation attached to a distribution TODO: unit tests

func (*ClusteredCoordinator) AlterDistributedRelationSchema

func (qc *ClusteredCoordinator) AlterDistributedRelationSchema(ctx context.Context, id string, relationFQN *rfqn.RelationFQN, schemaName string) error

AlterDistributedRelationSchema changes the schema name of a relation attached to a distribution TODO: unit tests

func (*ClusteredCoordinator) AlterDistributionAttach

func (qc *ClusteredCoordinator) AlterDistributionAttach(ctx context.Context, id string, rels []*distributions.DistributedRelation) error

AlterDistributionAttach attaches relation to distribution TODO: unit tests

func (*ClusteredCoordinator) AlterDistributionDetach

func (qc *ClusteredCoordinator) AlterDistributionDetach(ctx context.Context, id string, relationFQN *rfqn.RelationFQN) error

AlterDistributionDetach detaches relation from distribution TODO: unit tests

func (*ClusteredCoordinator) AlterReferenceRelationStorageAdvanced

func (qc *ClusteredCoordinator) AlterReferenceRelationStorageAdvanced(ctx context.Context, relationFQN *rfqn.RelationFQN, shs []string) error

AlterReferenceRelationStorage implements meta.EntityMgr.

func (*ClusteredCoordinator) AlterSequenceDetachRelation

func (qc *ClusteredCoordinator) AlterSequenceDetachRelation(ctx context.Context, rel *rfqn.RelationFQN) error

func (*ClusteredCoordinator) AlterShardOptions

func (qc *ClusteredCoordinator) AlterShardOptions(ctx context.Context, shardID string, options []topology.GenericOption) error

func (*ClusteredCoordinator) BatchMoveKeyRange

func (qc *ClusteredCoordinator) BatchMoveKeyRange(ctx context.Context, req *kr.BatchMoveKeyRange, issuer *tasks.MoveTaskGroupIssuer) error

BatchMoveKeyRange moves specified amount of keys from a key range to another shard.

Parameters:

  • ctx (context.Context): The context of the operation.
  • req (*kr.BatchMoveKeyRange): The request with args for the operation.

Returns:

  • error: Any error occurred during transfer.

func (*ClusteredCoordinator) BeginTran

func (*ClusteredCoordinator) Cache

func (qc *ClusteredCoordinator) Cache() *cache.SchemaCache

func (*ClusteredCoordinator) CommitTran

func (qc *ClusteredCoordinator) CommitTran(ctx context.Context, transaction *mtran.MetaTransaction) error

func (*ClusteredCoordinator) CreateDistribution

func (qc *ClusteredCoordinator) CreateDistribution(ctx context.Context, ds *distributions.Distribution) ([]qdb.QdbStatement, error)

CreateDistribution creates distribution in QDB. Sending data to routers is done through ExecNoTran or CommTran.

func (*ClusteredCoordinator) CreateKeyRange

func (qc *ClusteredCoordinator) CreateKeyRange(ctx context.Context, keyRange *kr.KeyRange) ([]qdb.QdbStatement, error)

func (*ClusteredCoordinator) CreateReferenceRelation

func (qc *ClusteredCoordinator) CreateReferenceRelation(ctx context.Context,
	r *rrelation.ReferenceRelation, entry []*rrelation.AutoIncrementEntry) error

CreateReferenceRelation creates reference relation in QDB. If enabled, CreateReferenceRelation also attempts to set up the relation in spqrguard extension. TODO: unit tests

func (*ClusteredCoordinator) CreateUniqueIndex

func (qc *ClusteredCoordinator) CreateUniqueIndex(ctx context.Context, dsID string, idx *distributions.UniqueIndex) error

func (*ClusteredCoordinator) DropDistribution

func (qc *ClusteredCoordinator) DropDistribution(ctx context.Context, id string) error

DropDistribution deletes distribution from QDB TODO: unit tests

func (*ClusteredCoordinator) DropKeyRange

func (qc *ClusteredCoordinator) DropKeyRange(ctx context.Context, id string) ([]qdb.QdbStatement, error)

TODO : unit tests

func (*ClusteredCoordinator) DropKeyRangeAll

func (qc *ClusteredCoordinator) DropKeyRangeAll(ctx context.Context) error

TODO : unit tests

func (*ClusteredCoordinator) DropReferenceRelation

func (qc *ClusteredCoordinator) DropReferenceRelation(ctx context.Context, relationFQN *rfqn.RelationFQN) error

TODO: unit tests

func (*ClusteredCoordinator) DropSequence

func (qc *ClusteredCoordinator) DropSequence(ctx context.Context, seqName string, force bool) error

func (*ClusteredCoordinator) DropShard

func (qc *ClusteredCoordinator) DropShard(ctx context.Context, shardID string) error

TODO : unit tests

func (*ClusteredCoordinator) DropUniqueIndex

func (qc *ClusteredCoordinator) DropUniqueIndex(ctx context.Context, idxID string) error

func (*ClusteredCoordinator) ExecNoTran

func (*ClusteredCoordinator) GetKeyRangeMove

func (qc *ClusteredCoordinator) GetKeyRangeMove(ctx context.Context, krID string) (*qdb.MoveKeyRange, error)

func (*ClusteredCoordinator) GetMoveTaskGroupBoundsCache

func (qc *ClusteredCoordinator) GetMoveTaskGroupBoundsCache(_ context.Context, id string) ([][][]byte, int, error)

func (*ClusteredCoordinator) GetRouterConn

func (qc *ClusteredCoordinator) GetRouterConn(r *topology.Router) (*grpc.ClientConn, func(), error)

GetRouterConn implements meta.RouterConnector interface. It returns a gRPC connection to the specified router.

func (*ClusteredCoordinator) GetTxnBatchSize

func (qc *ClusteredCoordinator) GetTxnBatchSize() uint16

func (*ClusteredCoordinator) IsReadOnly

func (qc *ClusteredCoordinator) IsReadOnly() bool

func (*ClusteredCoordinator) LockKeyRange

func (qc *ClusteredCoordinator) LockKeyRange(ctx context.Context, keyRangeID string) (*kr.KeyRange, error)

TODO : unit tests

func (*ClusteredCoordinator) Move

Move key range from one logical shard to another This function re-shards data by locking a portion of it, making it unavailable for read and write access during the process. TODO : unit tests

func (*ClusteredCoordinator) PrepareClient

func (qc *ClusteredCoordinator) PrepareClient(nconn net.Conn, pt port.RouterPortType) (rclient.RouterClient, error)

TODO : unit tests

func (*ClusteredCoordinator) ProcClient

func (qc *ClusteredCoordinator) ProcClient(ctx context.Context, nconn net.Conn, pt port.RouterPortType) error

TODO : unit tests

func (*ClusteredCoordinator) QDB

func (qc *ClusteredCoordinator) QDB() qdb.QDB

func (*ClusteredCoordinator) RecordKeyRangeMove

func (qc *ClusteredCoordinator) RecordKeyRangeMove(ctx context.Context, m *qdb.MoveKeyRange) (string, error)

TODO : unit tests

func (*ClusteredCoordinator) RedistributeKeyRange

func (qc *ClusteredCoordinator) RedistributeKeyRange(ctx context.Context, req *kr.RedistributeKeyRange) error

RedistributeKeyRange moves the whole key range to another shard in batches

Parameters:

  • ctx (context.Context): The context of the operation.
  • req (*kr.RedistributeKeyRange): The request with args for the operation.

Returns:

  • error: An error if any occurred during transfer.

func (*ClusteredCoordinator) RegisterRouter

func (qc *ClusteredCoordinator) RegisterRouter(ctx context.Context, r *topology.Router) error

TODO : unit tests

func (*ClusteredCoordinator) RenameKeyRange

func (qc *ClusteredCoordinator) RenameKeyRange(ctx context.Context, krID, krIDNew string) error

RenameKeyRange renames a key range.

Parameters:

  • ctx (context.Context): The context for the request.
  • krID (string): The ID of the key range to be renamed.
  • krIdNew (string): The new ID for the specified key range.

Returns: - error: An error if renaming key range was unsuccessful.

func (*ClusteredCoordinator) RetryMoveTaskGroup

func (qc *ClusteredCoordinator) RetryMoveTaskGroup(ctx context.Context, id string, nowait bool) error

RetryMoveTaskGroup re-launches the current move task group. If no move task group is currently being executed, then nothing is done.

Parameters: - ctx (context.Context): The context for the request.

Returns: - error: An error if the operation fails, otherwise nil.

func (*ClusteredCoordinator) RunCoordinator

func (qc *ClusteredCoordinator) RunCoordinator(ctx context.Context, initialRouter bool)

RunCoordinator side effect: it runs an asynchronous goroutine that checks the availability of the SPQR router

TODO: unit tests

func (*ClusteredCoordinator) Split

Split splits key range by req.bound TODO : unit tests

func (*ClusteredCoordinator) StartupFinished

func (qc *ClusteredCoordinator) StartupFinished() bool

func (*ClusteredCoordinator) StopMoveTaskGroup

func (qc *ClusteredCoordinator) StopMoveTaskGroup(ctx context.Context, id string, immediate bool) error

StopMoveTaskGroup gracefully stops the execution of current move task group. When current move task is completed, move task group will be finished.

Parameters: - ctx (context.Context): The context for the request.

Returns: - error: An error if the operation fails, otherwise nil.

func (*ClusteredCoordinator) SyncReferenceRelations

func (qc *ClusteredCoordinator) SyncReferenceRelations(ctx context.Context, relationFQNs []*rfqn.RelationFQN, destShard string) error

func (*ClusteredCoordinator) SyncRouterCoordinatorAddress

func (qc *ClusteredCoordinator) SyncRouterCoordinatorAddress(ctx context.Context, qRouter *topology.Router) error

TODO : unit tests

func (*ClusteredCoordinator) SyncRouterMetadata

func (qc *ClusteredCoordinator) SyncRouterMetadata(ctx context.Context, qRouter *topology.Router) error

TODO : unit tests

func (*ClusteredCoordinator) TaskState

func (*ClusteredCoordinator) TaskWorkersID

func (qc *ClusteredCoordinator) TaskWorkersID() []string

func (*ClusteredCoordinator) Unite

func (qc *ClusteredCoordinator) Unite(ctx context.Context, uniteKeyRange *kr.UniteKeyRange) error

TODO : unit tests

func (*ClusteredCoordinator) UnlockKeyRange

func (qc *ClusteredCoordinator) UnlockKeyRange(ctx context.Context, keyRangeID string) error

TODO : unit tests

func (*ClusteredCoordinator) UpdateCoordinator

func (qc *ClusteredCoordinator) UpdateCoordinator(ctx context.Context, address string) error

TODO : unit tests

Jump to

Keyboard shortcuts

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