Documentation
¶
Index ¶
- func DialRouter(r *topology.Router) (*grpc.ClientConn, error)
- type ClusteredCoordinator
- func (qc *ClusteredCoordinator) AddDataShard(ctx context.Context, shard *topology.DataShard) error
- func (qc *ClusteredCoordinator) AddRouter(ctx context.Context, router *topology.Router) error
- func (qc *ClusteredCoordinator) AddWorldShard(_ context.Context, _ *topology.DataShard) error
- func (qc *ClusteredCoordinator) AlterDistributedRelation(ctx context.Context, id string, rel *distributions.DistributedRelation) error
- func (qc *ClusteredCoordinator) AlterDistributedRelationDistributionKey(ctx context.Context, id string, relationFQN *rfqn.RelationFQN, ...) error
- func (qc *ClusteredCoordinator) AlterDistributedRelationSchema(ctx context.Context, id string, relationFQN *rfqn.RelationFQN, ...) error
- func (qc *ClusteredCoordinator) AlterDistributionAttach(ctx context.Context, id string, rels []*distributions.DistributedRelation) error
- func (qc *ClusteredCoordinator) AlterDistributionDetach(ctx context.Context, id string, relationFQN *rfqn.RelationFQN) error
- func (qc *ClusteredCoordinator) AlterReferenceRelationStorageAdvanced(ctx context.Context, relationFQN *rfqn.RelationFQN, shs []string) error
- func (qc *ClusteredCoordinator) AlterSequenceDetachRelation(ctx context.Context, rel *rfqn.RelationFQN) error
- func (qc *ClusteredCoordinator) AlterShardOptions(ctx context.Context, shardID string, options []topology.GenericOption) error
- func (qc *ClusteredCoordinator) BatchMoveKeyRange(ctx context.Context, req *kr.BatchMoveKeyRange, ...) error
- func (qc *ClusteredCoordinator) BeginTran(ctx context.Context) (*mtran.MetaTransaction, error)
- func (qc *ClusteredCoordinator) Cache() *cache.SchemaCache
- func (qc *ClusteredCoordinator) CommitTran(ctx context.Context, transaction *mtran.MetaTransaction) error
- func (qc *ClusteredCoordinator) CreateDistribution(ctx context.Context, ds *distributions.Distribution) ([]qdb.QdbStatement, error)
- func (qc *ClusteredCoordinator) CreateKeyRange(ctx context.Context, keyRange *kr.KeyRange) ([]qdb.QdbStatement, error)
- func (qc *ClusteredCoordinator) CreateReferenceRelation(ctx context.Context, r *rrelation.ReferenceRelation, ...) error
- func (qc *ClusteredCoordinator) CreateUniqueIndex(ctx context.Context, dsID string, idx *distributions.UniqueIndex) error
- func (qc *ClusteredCoordinator) DropDistribution(ctx context.Context, id string) error
- func (qc *ClusteredCoordinator) DropKeyRange(ctx context.Context, id string) ([]qdb.QdbStatement, error)
- func (qc *ClusteredCoordinator) DropKeyRangeAll(ctx context.Context) error
- func (qc *ClusteredCoordinator) DropReferenceRelation(ctx context.Context, relationFQN *rfqn.RelationFQN) error
- func (qc *ClusteredCoordinator) DropSequence(ctx context.Context, seqName string, force bool) error
- func (qc *ClusteredCoordinator) DropShard(ctx context.Context, shardID string) error
- func (qc *ClusteredCoordinator) DropUniqueIndex(ctx context.Context, idxID string) error
- func (qc *ClusteredCoordinator) ExecNoTran(ctx context.Context, chunk *mtran.MetaTransactionChunk) error
- func (qc *ClusteredCoordinator) GetKeyRangeMove(ctx context.Context, krID string) (*qdb.MoveKeyRange, error)
- func (qc *ClusteredCoordinator) GetMoveTaskGroupBoundsCache(_ context.Context, id string) ([][][]byte, int, error)
- func (qc *ClusteredCoordinator) GetRouterConn(r *topology.Router) (*grpc.ClientConn, func(), error)
- func (qc *ClusteredCoordinator) GetTxnBatchSize() uint16
- func (qc *ClusteredCoordinator) IsReadOnly() bool
- func (qc *ClusteredCoordinator) LockKeyRange(ctx context.Context, keyRangeID string) (*kr.KeyRange, error)
- func (qc *ClusteredCoordinator) Move(ctx context.Context, req *kr.MoveKeyRange) error
- func (qc *ClusteredCoordinator) PrepareClient(nconn net.Conn, pt port.RouterPortType) (rclient.RouterClient, error)
- func (qc *ClusteredCoordinator) ProcClient(ctx context.Context, nconn net.Conn, pt port.RouterPortType) error
- func (qc *ClusteredCoordinator) QDB() qdb.QDB
- func (qc *ClusteredCoordinator) RecordKeyRangeMove(ctx context.Context, m *qdb.MoveKeyRange) (string, error)
- func (qc *ClusteredCoordinator) RedistributeKeyRange(ctx context.Context, req *kr.RedistributeKeyRange) error
- func (qc *ClusteredCoordinator) RegisterRouter(ctx context.Context, r *topology.Router) error
- func (qc *ClusteredCoordinator) RenameKeyRange(ctx context.Context, krID, krIDNew string) error
- func (qc *ClusteredCoordinator) RetryMoveTaskGroup(ctx context.Context, id string, nowait bool) error
- func (qc *ClusteredCoordinator) RunCoordinator(ctx context.Context, initialRouter bool)
- func (qc *ClusteredCoordinator) Split(ctx context.Context, req *kr.SplitKeyRange) error
- func (qc *ClusteredCoordinator) StartupFinished() bool
- func (qc *ClusteredCoordinator) StopMoveTaskGroup(ctx context.Context, id string, immediate bool) error
- func (qc *ClusteredCoordinator) SyncReferenceRelations(ctx context.Context, relationFQNs []*rfqn.RelationFQN, destShard string) error
- func (qc *ClusteredCoordinator) SyncRouterCoordinatorAddress(ctx context.Context, qRouter *topology.Router) error
- func (qc *ClusteredCoordinator) SyncRouterMetadata(ctx context.Context, qRouter *topology.Router) error
- func (qc *ClusteredCoordinator) TaskState(id string) (*transferworker.TaskGroupWorkerState, error)
- func (qc *ClusteredCoordinator) TaskWorkersID() []string
- func (qc *ClusteredCoordinator) Unite(ctx context.Context, uniteKeyRange *kr.UniteKeyRange) error
- func (qc *ClusteredCoordinator) UnlockKeyRange(ctx context.Context, keyRangeID string) error
- func (qc *ClusteredCoordinator) UpdateCoordinator(ctx context.Context, address string) error
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 (*ClusteredCoordinator) AddDataShard ¶
func (*ClusteredCoordinator) AddWorldShard ¶
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 (qc *ClusteredCoordinator) BeginTran(ctx context.Context) (*mtran.MetaTransaction, error)
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 (*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 (qc *ClusteredCoordinator) ExecNoTran(ctx context.Context, chunk *mtran.MetaTransactionChunk) error
func (*ClusteredCoordinator) GetKeyRangeMove ¶
func (qc *ClusteredCoordinator) GetKeyRangeMove(ctx context.Context, krID string) (*qdb.MoveKeyRange, error)
func (*ClusteredCoordinator) GetMoveTaskGroupBoundsCache ¶
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 ¶
func (qc *ClusteredCoordinator) Move(ctx context.Context, req *kr.MoveKeyRange) error
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 ¶
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 ¶
func (qc *ClusteredCoordinator) Split(ctx context.Context, req *kr.SplitKeyRange) error
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 (qc *ClusteredCoordinator) TaskState(id string) (*transferworker.TaskGroupWorkerState, error)
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