Documentation
¶
Index ¶
- Constants
- Variables
- func ExecuteCommands(saver func() error, commands ...Command) error
- func LockPath(key string) string
- type ACLItem
- type AppendCommand
- type BalancerTask
- type Command
- type CustomCommand
- type DCStateKeeper
- type DataTransferTransaction
- type DeleteCommand
- type DistributedRelation
- type Distribution
- type DistributionKeyEntry
- type DropCommand
- type EtcdQDB
- func (q *EtcdQDB) AddMoveTaskGroupStopFlag(ctx context.Context, id string, immediate bool) error
- func (q *EtcdQDB) AddRouter(ctx context.Context, r *Router) error
- func (q *EtcdQDB) AddShard(ctx context.Context, shard *Shard) error
- func (q *EtcdQDB) AlterDistributedRelation(ctx context.Context, id string, rel *DistributedRelation) error
- func (q *EtcdQDB) AlterDistributedRelationDistributionKey(ctx context.Context, id string, relationFQN *rfqn.RelationFQN, ...) error
- func (q *EtcdQDB) AlterDistributedRelationSchema(ctx context.Context, id string, relationFQN *rfqn.RelationFQN, ...) error
- func (q *EtcdQDB) AlterDistributionAttach(ctx context.Context, id string, rels []*DistributedRelation) error
- func (q *EtcdQDB) AlterDistributionDetach(ctx context.Context, id string, relation *rfqn.RelationFQN) error
- func (q *EtcdQDB) AlterReferenceRelationStorage(ctx context.Context, relation *rfqn.RelationFQN, shs []string) error
- func (q *EtcdQDB) AlterReplicatedRelationSchema(ctx context.Context, dsID string, relationFQN *rfqn.RelationFQN, ...) error
- func (q *EtcdQDB) AlterSequenceAttach(ctx context.Context, seqName string, relationFQN *rfqn.RelationFQN, ...) error
- func (q *EtcdQDB) AlterSequenceDetachRelation(ctx context.Context, relationFQN *rfqn.RelationFQN) error
- func (q *EtcdQDB) AlterShard(ctx context.Context, newShard *Shard) error
- func (q *EtcdQDB) BeginTransaction(ctx context.Context, transaction *QdbTransaction) error
- func (q *EtcdQDB) CheckDistribution(ctx context.Context, id string) (bool, error)
- func (q *EtcdQDB) CheckLockedKeyRange(ctx context.Context, id string) (*KeyRange, error)
- func (q *EtcdQDB) CheckMoveTaskGroupStopFlag(ctx context.Context, id string) (bool, bool, error)
- func (q *EtcdQDB) CheckSequence(ctx context.Context, seqName string) (bool, error)
- func (q *EtcdQDB) CheckTaskGroupLocked(ctx context.Context, tgId string) (bool, error)
- func (q *EtcdQDB) Client() *clientv3.Client
- func (q *EtcdQDB) CloseRouter(ctx context.Context, id string) error
- func (q *EtcdQDB) CommitTransaction(ctx context.Context, transaction *QdbTransaction) error
- func (q *EtcdQDB) CreateDistribution(_ context.Context, distribution *Distribution) ([]QdbStatement, error)
- func (q *EtcdQDB) CreateKeyRange(_ context.Context, keyRange *KeyRange) ([]QdbStatement, error)
- func (q *EtcdQDB) CreateRedistributeTask(ctx context.Context, task *RedistributeTask) error
- func (q *EtcdQDB) CreateReferenceRelation(ctx context.Context, r *ReferenceRelation) error
- func (q *EtcdQDB) CreateSequence(_ context.Context, seqName string, initialValue int64) ([]QdbStatement, error)
- func (q *EtcdQDB) CreateUniqueIndex(ctx context.Context, idx *UniqueIndex) error
- func (q *EtcdQDB) CurrVal(ctx context.Context, seqName string) (int64, error)
- func (q *EtcdQDB) DeleteKeyRangeMove(ctx context.Context, moveId string) error
- func (q *EtcdQDB) DeleteRouter(ctx context.Context, id string) error
- func (q *EtcdQDB) DeleteRouterAll(ctx context.Context) error
- func (q *EtcdQDB) DropBalancerTask(ctx context.Context) error
- func (q *EtcdQDB) DropDistribution(ctx context.Context, id string) error
- func (q *EtcdQDB) DropKeyRange(_ context.Context, id string) ([]QdbStatement, error)
- func (q *EtcdQDB) DropKeyRangeAll(ctx context.Context) error
- func (q *EtcdQDB) DropMoveTask(ctx context.Context, id string) error
- func (q *EtcdQDB) DropMoveTaskGroup(ctx context.Context, id string) error
- func (q *EtcdQDB) DropRedistributeTask(ctx context.Context, task *RedistributeTask) error
- func (q *EtcdQDB) DropRedistributeTaskLock(ctx context.Context, id string) error
- func (q *EtcdQDB) DropReferenceRelation(ctx context.Context, relation *rfqn.RelationFQN) error
- func (q *EtcdQDB) DropSequence(ctx context.Context, seqName string, force bool) error
- func (q *EtcdQDB) DropShard(ctx context.Context, id string) error
- func (q *EtcdQDB) DropTaskGroupLock(ctx context.Context, tgId string) error
- func (q *EtcdQDB) DropUniqueIndex(ctx context.Context, id string) error
- func (q *EtcdQDB) ExecNoTransaction(ctx context.Context, operations []QdbStatement) error
- func (q *EtcdQDB) GetAllTaskGroupStatuses(ctx context.Context) (map[string]*TaskGroupStatus, error)
- func (q *EtcdQDB) GetBalancerTask(ctx context.Context) (*BalancerTask, error)
- func (q *EtcdQDB) GetCoordinator(ctx context.Context) (string, error)
- func (q *EtcdQDB) GetDistribution(ctx context.Context, id string) (*Distribution, error)
- func (q *EtcdQDB) GetKeyRange(ctx context.Context, id string) (*KeyRange, error)
- func (q *EtcdQDB) GetKeyRangeRedistributeTaskId(ctx context.Context, keyRangeId string) (string, error)
- func (q *EtcdQDB) GetMoveTask(ctx context.Context, id string) (*MoveTask, error)
- func (q *EtcdQDB) GetMoveTaskByGroup(ctx context.Context, taskGroupID string) (*MoveTask, error)
- func (q *EtcdQDB) GetMoveTaskGroup(ctx context.Context, id string) (*MoveTaskGroup, error)
- func (q *EtcdQDB) GetMoveTaskGroupTotalKeys(ctx context.Context, id string) (int64, error)
- func (q *EtcdQDB) GetRedistributeTask(ctx context.Context, id string) (*RedistributeTask, error)
- func (q *EtcdQDB) GetRedistributeTaskTaskGroupId(ctx context.Context, id string) (string, error)
- func (q *EtcdQDB) GetReferenceRelation(ctx context.Context, relation *rfqn.RelationFQN) (*ReferenceRelation, error)
- func (q *EtcdQDB) GetRelationDistribution(ctx context.Context, relationFQN *rfqn.RelationFQN) (*Distribution, error)
- func (q *EtcdQDB) GetRelationSequence(ctx context.Context, relationFQN *rfqn.RelationFQN) (map[string]string, error)
- func (q *EtcdQDB) GetSequenceRelations(ctx context.Context, seqName string) ([]*rfqn.RelationFQN, error)
- func (q *EtcdQDB) GetShard(ctx context.Context, id string) (*Shard, error)
- func (q *EtcdQDB) GetTaskGroupStatus(ctx context.Context, id string) (*TaskGroupStatus, error)
- func (q *EtcdQDB) GetTransferTx(ctx context.Context, key string) (*DataTransferTransaction, error)
- func (q *EtcdQDB) GetTxMetaStorage(ctx context.Context) (shards []string, err error)
- func (q *EtcdQDB) ListAllKeyRanges(ctx context.Context) ([]*KeyRange, error)
- func (q *EtcdQDB) ListDistributions(ctx context.Context) ([]*Distribution, error)
- func (q *EtcdQDB) ListKeyRangeMoves(ctx context.Context) ([]*MoveKeyRange, error)
- func (q *EtcdQDB) ListKeyRanges(ctx context.Context, distribution string) ([]*KeyRange, error)
- func (q *EtcdQDB) ListLockedKeyRanges(ctx context.Context) ([]string, error)
- func (q *EtcdQDB) ListMoveTasks(ctx context.Context) (map[string]*MoveTask, error)
- func (q *EtcdQDB) ListRedistributeTasks(ctx context.Context) ([]*RedistributeTask, error)
- func (q *EtcdQDB) ListReferenceRelations(ctx context.Context) ([]*ReferenceRelation, error)
- func (q *EtcdQDB) ListRelationIndexes(ctx context.Context, relationFQN *rfqn.RelationFQN) (map[string]*UniqueIndex, error)
- func (q *EtcdQDB) ListRouters(ctx context.Context) ([]*Router, error)
- func (q *EtcdQDB) ListSequences(ctx context.Context) ([]string, error)
- func (q *EtcdQDB) ListShards(ctx context.Context) ([]*Shard, error)
- func (q *EtcdQDB) ListTaskGroups(ctx context.Context) (map[string]*MoveTaskGroup, error)
- func (q *EtcdQDB) ListUniqueIndexes(ctx context.Context) (map[string]*UniqueIndex, error)
- func (q *EtcdQDB) LockKeyRange(ctx context.Context, idKeyRange string) (*KeyRange, error)
- func (q *EtcdQDB) LockRedistributeTask(ctx context.Context, id, holder string) error
- func (q *EtcdQDB) NextRange(ctx context.Context, seqName string, rangeSize uint64) (*SequenceIdRange, error)
- func (q *EtcdQDB) OpenRouter(ctx context.Context, id string) error
- func (q *EtcdQDB) RecordKeyRangeMove(ctx context.Context, m *MoveKeyRange) error
- func (q *EtcdQDB) RecordTransferTx(ctx context.Context, key string, info *DataTransferTransaction) error
- func (q *EtcdQDB) RemoveTransferTx(ctx context.Context, key string) error
- func (q *EtcdQDB) RenameKeyRange(ctx context.Context, krId, krIdNew string) error
- func (q *EtcdQDB) SetTxMetaStorage(ctx context.Context, shards []string) error
- func (q *EtcdQDB) ShareKeyRange(id string) error
- func (q *EtcdQDB) TryCoordinatorLock(ctx context.Context, addr string) error
- func (q *EtcdQDB) TryTaskGroupLock(ctx context.Context, tgId string, holder string) error
- func (q *EtcdQDB) UnlockKeyRange(ctx context.Context, idKeyRange string) error
- func (q *EtcdQDB) UpdateCoordinator(_ context.Context, _ string) error
- func (q *EtcdQDB) UpdateKeyRange(_ context.Context, keyRange *KeyRange) ([]QdbStatement, error)
- func (q *EtcdQDB) UpdateKeyRangeMoveStatus(ctx context.Context, moveId string, s MoveKeyRangeStatus) error
- func (q *EtcdQDB) UpdateMoveTask(ctx context.Context, task *MoveTask) error
- func (q *EtcdQDB) UpdateMoveTaskGroupTotalKeys(ctx context.Context, id string, totalKeys int64) error
- func (q *EtcdQDB) UpdateRedistributeTask(ctx context.Context, task *RedistributeTask) error
- func (q *EtcdQDB) WriteBalancerTask(ctx context.Context, task *BalancerTask) error
- func (q *EtcdQDB) WriteMoveTask(ctx context.Context, task *MoveTask) error
- func (q *EtcdQDB) WriteMoveTaskGroup(ctx context.Context, id string, group *MoveTaskGroup, totalKeys int64, ...) error
- func (q *EtcdQDB) WriteTaskGroupStatus(ctx context.Context, id string, status *TaskGroupStatus) error
- type GenericOption
- type KeyRange
- type KeyRangeMeta
- type KeyRangeStatus
- type MemPgQDB
- func (q *MemPgQDB) AcquireTxOwnership(ctx context.Context, txid string) (bool, error)
- func (q *MemPgQDB) ChangeTxStatus(ctx context.Context, txid string, state TwoPhaseTxState) error
- func (q *MemPgQDB) ClearTxStatuses(ctx context.Context) error
- func (q *MemPgQDB) GetTXs(ctx context.Context) (map[string]*TwoPCInfo, error)
- func (q *MemPgQDB) GetTxMetaStorage(_ context.Context) ([]string, error)
- func (q *MemPgQDB) ListTXNames(ctx context.Context) ([]string, error)
- func (q *MemPgQDB) RecordTwoPhaseMembers(ctx context.Context, txid string, shards []string) error
- func (q *MemPgQDB) ReleaseTxOwnership(ctx context.Context, txid string) error
- func (q *MemPgQDB) RemoveTXData(ctx context.Context, txid string) error
- func (q *MemPgQDB) SetTxMetaStorage(_ context.Context, storage []string) error
- func (q *MemPgQDB) TXCohortShards(ctx context.Context, txid string) ([]string, error)
- func (q *MemPgQDB) TXStatus(ctx context.Context, txid string) (TwoPhaseTxState, error)
- type MemQDB
- func (q *MemQDB) AcquireTxOwnership(_ context.Context, id string) (bool, error)
- func (q *MemQDB) AddMoveTaskGroupStopFlag(_ context.Context, id string, immediate bool) error
- func (q *MemQDB) AddRouter(_ context.Context, r *Router) error
- func (q *MemQDB) AddShard(_ context.Context, shard *Shard) error
- func (q *MemQDB) AlterDistributedRelation(_ context.Context, id string, rel *DistributedRelation) error
- func (q *MemQDB) AlterDistributedRelationDistributionKey(_ context.Context, id string, relation *rfqn.RelationFQN, ...) error
- func (q *MemQDB) AlterDistributedRelationSchema(_ context.Context, id string, relation *rfqn.RelationFQN, schemaName string) error
- func (q *MemQDB) AlterDistributionAttach(_ context.Context, id string, rels []*DistributedRelation) error
- func (q *MemQDB) AlterDistributionDetach(ctx context.Context, id string, relationFQN *rfqn.RelationFQN) error
- func (q *MemQDB) AlterReferenceRelationStorage(_ context.Context, relationFQN *rfqn.RelationFQN, shs []string) error
- func (q *MemQDB) AlterReplicatedRelationSchema(_ context.Context, id string, relation *rfqn.RelationFQN, schemaName string) error
- func (q *MemQDB) AlterSequenceAttach(_ context.Context, seqName string, relationFQN *rfqn.RelationFQN, ...) error
- func (q *MemQDB) AlterSequenceDetachRelation(_ context.Context, relationFQN *rfqn.RelationFQN) error
- func (q *MemQDB) AlterShard(_ context.Context, newShard *Shard) error
- func (q *MemQDB) BeginTransaction(_ context.Context, transaction *QdbTransaction) error
- func (q *MemQDB) ChangeTxStatus(_ context.Context, id string, state TwoPhaseTxState) error
- func (q *MemQDB) CheckDistribution(_ context.Context, id string) (bool, error)
- func (q *MemQDB) CheckLockedKeyRange(_ context.Context, id string) (*KeyRange, error)
- func (q *MemQDB) CheckMoveTaskGroupStopFlag(_ context.Context, id string) (bool, bool, error)
- func (q *MemQDB) CheckSequence(_ context.Context, seqName string) (bool, error)
- func (q *MemQDB) CheckTaskGroupLocked(_ context.Context, _ string) (bool, error)
- func (q *MemQDB) ClearTxStatuses(_ context.Context) error
- func (q *MemQDB) CloseRouter(_ context.Context, id string) error
- func (q *MemQDB) CommitTransaction(_ context.Context, transaction *QdbTransaction) error
- func (q *MemQDB) CreateDistribution(_ context.Context, distribution *Distribution) ([]QdbStatement, error)
- func (q *MemQDB) CreateKeyRange(_ context.Context, keyRange *KeyRange) ([]QdbStatement, error)
- func (q *MemQDB) CreateRedistributeTask(_ context.Context, task *RedistributeTask) error
- func (q *MemQDB) CreateReferenceRelation(_ context.Context, r *ReferenceRelation) error
- func (q *MemQDB) CreateSequence(_ context.Context, seqName string, initialValue int64) ([]QdbStatement, error)
- func (q *MemQDB) CreateUniqueIndex(_ context.Context, idx *UniqueIndex) error
- func (q *MemQDB) CurrVal(_ context.Context, seqName string) (int64, error)
- func (q *MemQDB) DeleteKeyRangeMove(_ context.Context, _ string) error
- func (q *MemQDB) DeleteRouter(_ context.Context, id string) error
- func (q *MemQDB) DeleteRouterAll(_ context.Context) error
- func (q *MemQDB) DropBalancerTask(_ context.Context) error
- func (q *MemQDB) DropDistribution(_ context.Context, id string) error
- func (q *MemQDB) DropKeyRange(_ context.Context, id string) ([]QdbStatement, error)
- func (q *MemQDB) DropKeyRangeAll(_ context.Context) error
- func (q *MemQDB) DropMoveTask(_ context.Context, id string) error
- func (q *MemQDB) DropMoveTaskGroup(_ context.Context, id string) error
- func (q *MemQDB) DropRedistributeTask(_ context.Context, task *RedistributeTask) error
- func (q *MemQDB) DropRedistributeTaskLock(_ context.Context, _ string) error
- func (q *MemQDB) DropReferenceRelation(_ context.Context, relationFQN *rfqn.RelationFQN) error
- func (q *MemQDB) DropSequence(_ context.Context, seqName string, force bool) error
- func (q *MemQDB) DropShard(_ context.Context, id string) error
- func (q *MemQDB) DropTaskGroupLock(_ context.Context, _ string) error
- func (q *MemQDB) DropUniqueIndex(_ context.Context, id string) error
- func (q *MemQDB) DumpState() error
- func (q *MemQDB) ExecNoTransaction(_ context.Context, operations []QdbStatement) error
- func (q *MemQDB) GetAllTaskGroupStatuses(_ context.Context) (map[string]*TaskGroupStatus, error)
- func (q *MemQDB) GetBalancerTask(_ context.Context) (*BalancerTask, error)
- func (q *MemQDB) GetCoordinator(_ context.Context) (string, error)
- func (q *MemQDB) GetDistribution(_ context.Context, id string) (*Distribution, error)
- func (q *MemQDB) GetKeyRange(_ context.Context, id string) (*KeyRange, error)
- func (q *MemQDB) GetKeyRangeRedistributeTaskId(_ context.Context, _ string) (string, error)
- func (q *MemQDB) GetMoveTask(_ context.Context, id string) (*MoveTask, error)
- func (q *MemQDB) GetMoveTaskByGroup(_ context.Context, taskGroupID string) (*MoveTask, error)
- func (q *MemQDB) GetMoveTaskGroup(_ context.Context, id string) (*MoveTaskGroup, error)
- func (q *MemQDB) GetMoveTaskGroupTotalKeys(_ context.Context, id string) (int64, error)
- func (q *MemQDB) GetRedistributeTask(_ context.Context, id string) (*RedistributeTask, error)
- func (q *MemQDB) GetRedistributeTaskTaskGroupId(_ context.Context, id string) (string, error)
- func (q *MemQDB) GetReferenceRelation(_ context.Context, relationFQN *rfqn.RelationFQN) (*ReferenceRelation, error)
- func (q *MemQDB) GetRelationDistribution(_ context.Context, relation *rfqn.RelationFQN) (*Distribution, error)
- func (q *MemQDB) GetRelationSequence(_ context.Context, relationFQN *rfqn.RelationFQN) (map[string]string, error)
- func (q *MemQDB) GetSequenceRelations(_ context.Context, seqName string) ([]*rfqn.RelationFQN, error)
- func (q *MemQDB) GetShard(_ context.Context, id string) (*Shard, error)
- func (q *MemQDB) GetTXs(_ context.Context) (map[string]*TwoPCInfo, error)
- func (q *MemQDB) GetTaskGroupStatus(_ context.Context, id string) (*TaskGroupStatus, error)
- func (q *MemQDB) GetTransferTx(_ context.Context, key string) (*DataTransferTransaction, error)
- func (q *MemQDB) GetTxMetaStorage(_ context.Context) ([]string, error)
- func (q *MemQDB) ListAllKeyRanges(_ context.Context) ([]*KeyRange, error)
- func (q *MemQDB) ListDistributions(_ context.Context) ([]*Distribution, error)
- func (q *MemQDB) ListKeyRangeMoves(_ context.Context) ([]*MoveKeyRange, error)
- func (q *MemQDB) ListKeyRanges(_ context.Context, distribution string) ([]*KeyRange, error)
- func (q *MemQDB) ListLockedKeyRanges(_ context.Context) ([]string, error)
- func (q *MemQDB) ListMoveTasks(_ context.Context) (map[string]*MoveTask, error)
- func (q *MemQDB) ListRedistributeTasks(_ context.Context) ([]*RedistributeTask, error)
- func (q *MemQDB) ListReferenceRelations(_ context.Context) ([]*ReferenceRelation, error)
- func (q *MemQDB) ListRelationIndexes(_ context.Context, relationFQN *rfqn.RelationFQN) (map[string]*UniqueIndex, error)
- func (q *MemQDB) ListRouters(_ context.Context) ([]*Router, error)
- func (q *MemQDB) ListSequences(_ context.Context) ([]string, error)
- func (q *MemQDB) ListShards(_ context.Context) ([]*Shard, error)
- func (q *MemQDB) ListTXNames(_ context.Context) ([]string, error)
- func (q *MemQDB) ListTaskGroups(_ context.Context) (map[string]*MoveTaskGroup, error)
- func (q *MemQDB) ListUniqueIndexes(_ context.Context) (map[string]*UniqueIndex, error)
- func (q *MemQDB) LockKeyRange(_ context.Context, id string) (*KeyRange, error)
- func (q *MemQDB) LockRedistributeTask(_ context.Context, _, _ string) error
- func (q *MemQDB) NextRange(_ context.Context, seqName string, rangeSize uint64) (*SequenceIdRange, error)
- func (q *MemQDB) OpenRouter(_ context.Context, id string) error
- func (q *MemQDB) RecordKeyRangeMove(_ context.Context, _ *MoveKeyRange) error
- func (q *MemQDB) RecordTransferTx(_ context.Context, key string, info *DataTransferTransaction) error
- func (q *MemQDB) RecordTwoPhaseMembers(_ context.Context, id string, shards []string) error
- func (q *MemQDB) ReleaseTxOwnership(_ context.Context, gid string) error
- func (q *MemQDB) RemoveTXData(_ context.Context, gid string) error
- func (q *MemQDB) RemoveTransferTx(_ context.Context, key string) error
- func (q *MemQDB) RenameKeyRange(_ context.Context, krId, krIdNew string) error
- func (q *MemQDB) SetTxMetaStorage(context.Context, []string) error
- func (q *MemQDB) ShareKeyRange(id string) error
- func (q *MemQDB) SwapState(state *MemQDBState)
- func (q *MemQDB) TXCohortShards(_ context.Context, gid string) ([]string, error)
- func (q *MemQDB) TXStatus(_ context.Context, gid string) (TwoPhaseTxState, error)
- func (q *MemQDB) TryCoordinatorLock(_ context.Context, _ string) error
- func (q *MemQDB) TryTaskGroupLock(_ context.Context, _ string, _ string) error
- func (q *MemQDB) UnlockKeyRange(_ context.Context, id string) error
- func (q *MemQDB) UpdateCoordinator(_ context.Context, address string) error
- func (q *MemQDB) UpdateKeyRange(_ context.Context, keyRange *KeyRange) ([]QdbStatement, error)
- func (q *MemQDB) UpdateKeyRangeMoveStatus(_ context.Context, _ string, _ MoveKeyRangeStatus) error
- func (q *MemQDB) UpdateMoveTask(_ context.Context, task *MoveTask) error
- func (q *MemQDB) UpdateMoveTaskGroupTotalKeys(_ context.Context, id string, totalKeys int64) error
- func (q *MemQDB) UpdateRedistributeTask(_ context.Context, task *RedistributeTask) error
- func (q *MemQDB) WriteBalancerTask(_ context.Context, task *BalancerTask) error
- func (q *MemQDB) WriteMoveTask(_ context.Context, task *MoveTask) error
- func (q *MemQDB) WriteMoveTaskGroup(_ context.Context, id string, group *MoveTaskGroup, _ int64, _ *MoveTask) error
- func (q *MemQDB) WriteTaskGroupStatus(_ context.Context, id string, status *TaskGroupStatus) error
- type MemQDBState
- type MoveKeyRange
- type MoveKeyRangeStatus
- type MoveTask
- type MoveTaskGroup
- type MoveTaskGroupIssuer
- type PgDCStateKeeper
- func (q *PgDCStateKeeper) AcquireTxOwnership(_ context.Context, txid string) (bool, error)
- func (q *PgDCStateKeeper) ChangeTxStatus(ctx context.Context, txid string, state TwoPhaseTxState) error
- func (q *PgDCStateKeeper) ClearTxStatuses(ctx context.Context) error
- func (q *PgDCStateKeeper) GetTXs(ctx context.Context) (map[string]*TwoPCInfo, error)
- func (q *PgDCStateKeeper) GetTxMetaStorage() []string
- func (q *PgDCStateKeeper) ListTXNames(ctx context.Context) ([]string, error)
- func (q *PgDCStateKeeper) RecordTwoPhaseMembers(ctx context.Context, txid string, shards []string) error
- func (q *PgDCStateKeeper) ReleaseTxOwnership(_ context.Context, txid string) error
- func (q *PgDCStateKeeper) RemoveTXData(ctx context.Context, txid string) error
- func (q *PgDCStateKeeper) SetTxMetaStorage(storage []string) error
- func (q *PgDCStateKeeper) TXCohortShards(ctx context.Context, txid string) ([]string, error)
- func (q *PgDCStateKeeper) TXStatus(ctx context.Context, txid string) (TwoPhaseTxState, error)
- type QDB
- type QdbStatement
- type QdbTransaction
- type RedistributeTask
- type ReferenceRelation
- type Router
- type RouterState
- type RoutingExpr
- type Sequence
- type SequenceIdRange
- type Shard
- type ShardKey
- type ShardingSchemaKeeper
- type StateKeeperQDB
- type TXManager
- type TaskGroupStatus
- type TaskStateKeeper
- type TopologyKeeper
- type TransferXactKeeper
- type TwoPCInfo
- type TwoPhaseTxMetaKeeper
- type TwoPhaseTxState
- type TxStatus
- type TypedColRef
- type UniqueIndex
- type UpdateCommand
- type XDCStateKeeper
- type XQDB
Constants ¶
const ( CoordKeepAliveTTL = 3 TaskGroupLeaseTTL = 30 // generous lease )
const ( // maps of MemQDB as `extensions` of QdbStatement MapRelationDistribution = "RelationDistribution" MapDistributions = "Distributions" MapKrs = "Krs" MapFreq = "Freq" MapLocks = "Locks" MapKrVersions = "KrVersions" MapSequences = "Sequences" MapSequenceToValues = "SequenceToValues" )
const ( MoveKeyRangePlanned = MoveKeyRangeStatus("PLANNED") MoveKeyRangeLocked = MoveKeyRangeStatus("LOCKED") MoveKeyRangeDataMoved = MoveKeyRangeStatus("DATA_MOVED") MoveKeyRangeDataCoordMetaUpdated = MoveKeyRangeStatus("COORD_META_UPDATED") MoveKeyRangeComplete = MoveKeyRangeStatus("COMPLETE") // Deprecated: use MoveKeyRangeLocked MoveKeyRangeStarted = MoveKeyRangeStatus("STARTED") )
const ( CLOSED = RouterState("CLOSED") OPENED = RouterState("OPENED") )
const ( IssuerRedistributeTask = iota + 1 IssuerBalancerTask )
const ( StopTaskGroup = "cancel" StopTaskGroupImmediate = "cancel immediate" )
const ( Planned = TxStatus("planned") Locked = TxStatus("locked") DataCopied = TxStatus("data_copied") )
const ( CmdPut = iota CmdDelete )
const DefaultMaxTxnSize uint16 = 128 // like ETCD max-txn-ops default value
const KRLocked = KeyRangeStatus("LOCKED")
const KRUnlocked = KeyRangeStatus("UNLOCKED")
Variables ¶
var ( ColumnTypeVarchar = "varchar" ColumnTypeVarcharHashed = "varchar hashed" ColumnTypeVarcharDeprecated = "_varchar" ColumnTypeInteger = "integer" ColumnTypeUinteger = "uinteger" ColumnTypeUUID = "uuid" )
Functions ¶
func ExecuteCommands ¶
Types ¶
type AppendCommand ¶
type AppendCommand[T any] struct { // contains filtered or unexported fields }
func NewAppendCommand ¶
func NewAppendCommand[T any](m []T, _ T) *AppendCommand[T]
func (*AppendCommand[T]) Do ¶
func (c *AppendCommand[T]) Do() error
func (*AppendCommand[T]) Undo ¶
func (c *AppendCommand[T]) Undo() error
type BalancerTask ¶
type CustomCommand ¶
type CustomCommand struct {
// contains filtered or unexported fields
}
func NewCustomCommand ¶
func NewCustomCommand(do func() error, undo func() error) *CustomCommand
func (*CustomCommand) Do ¶
func (c *CustomCommand) Do() error
func (*CustomCommand) Undo ¶
func (c *CustomCommand) Undo() error
type DCStateKeeper ¶
type DCStateKeeper interface {
RecordTwoPhaseMembers(ctx context.Context, gid string, shards []string) error
ChangeTxStatus(ctx context.Context, gid string, state TwoPhaseTxState) error
ListTXNames(ctx context.Context) ([]string, error)
GetTXs(ctx context.Context) (map[string]*TwoPCInfo, error)
AcquireTxOwnership(ctx context.Context, gid string) (bool, error)
ReleaseTxOwnership(ctx context.Context, gid string) error
TXStatus(ctx context.Context, gid string) (TwoPhaseTxState, error)
TXCohortShards(ctx context.Context, gid string) ([]string, error)
RemoveTXData(ctx context.Context, gid string) error
ClearTxStatuses(ctx context.Context) error
}
Distributed (2pc) commit state keeper. Could be ether local storage or ETCD
type DataTransferTransaction ¶
type DataTransferTransaction struct {
ToShardId string `json:"to_shard"`
FromShardId string `json:"from_shard"`
Status TxStatus `json:"status"`
}
DataTransferTransaction contains information about data transfer from one shard to another
type DeleteCommand ¶
type DeleteCommand[T any] struct { // contains filtered or unexported fields }
func NewDeleteCommand ¶
func NewDeleteCommand[T any](m map[string]T, key string) *DeleteCommand[T]
func (*DeleteCommand[T]) Do ¶
func (c *DeleteCommand[T]) Do() error
func (*DeleteCommand[T]) Undo ¶
func (c *DeleteCommand[T]) Undo() error
type DistributedRelation ¶
type DistributedRelation struct {
Name string `json:"name"`
SchemaName string `json:"schema_name,omitempty"`
DistributionKey []DistributionKeyEntry `json:"column_names"`
ReplicatedRelation bool `json:"replicated_relation,omitempty"`
Version uint64 `json:"version,omitempty"`
ACL []ACLItem `json:"acl,omitempty"`
}
func (*DistributedRelation) QualifiedName ¶
func (r *DistributedRelation) QualifiedName() *rfqn.RelationFQN
type Distribution ¶
type Distribution struct {
ID string `json:"id"`
ColTypes []string `json:"col_types,omitempty"`
Relations map[string]*DistributedRelation `json:"relations"`
FQNRelations map[string]*DistributedRelation `json:"fqn_relations,omitempty"`
UniqueIndexes map[string]*UniqueIndex `json:"unique_indexes"`
Version uint64 `json:"version,omitempty"`
ACL []ACLItem `json:"acl,omitempty"`
}
func NewDistribution ¶
func NewDistribution(id string, coltypes []string) *Distribution
func (*Distribution) Copy ¶
func (d *Distribution) Copy() *Distribution
func (*Distribution) GetRelation ¶
func (d *Distribution) GetRelation(fqn *rfqn.RelationFQN) (*DistributedRelation, bool)
type DistributionKeyEntry ¶
type DistributionKeyEntry struct {
Column string `json:"column"`
HashFunction string `json:"hash"`
Expr RoutingExpr `json:"routing_expression"`
}
type DropCommand ¶
type DropCommand[T any] struct { // contains filtered or unexported fields }
func NewDropCommand ¶
func NewDropCommand[T any](m map[string]T) *DropCommand[T]
func (*DropCommand[T]) Do ¶
func (c *DropCommand[T]) Do() error
func (*DropCommand[T]) Undo ¶
func (c *DropCommand[T]) Undo() error
type EtcdQDB ¶
type EtcdQDB struct {
// contains filtered or unexported fields
}
func (*EtcdQDB) AddMoveTaskGroupStopFlag ¶
TODO unit test
func (*EtcdQDB) AlterDistributedRelation ¶
func (q *EtcdQDB) AlterDistributedRelation(ctx context.Context, id string, rel *DistributedRelation) error
TODO : unit tests
func (*EtcdQDB) AlterDistributedRelationDistributionKey ¶
func (q *EtcdQDB) AlterDistributedRelationDistributionKey(ctx context.Context, id string, relationFQN *rfqn.RelationFQN, distributionKey []DistributionKeyEntry) error
TODO : unit tests
func (*EtcdQDB) AlterDistributedRelationSchema ¶
func (q *EtcdQDB) AlterDistributedRelationSchema(ctx context.Context, id string, relationFQN *rfqn.RelationFQN, schemaName string) error
TODO : unit tests
func (*EtcdQDB) AlterDistributionAttach ¶
func (q *EtcdQDB) AlterDistributionAttach(ctx context.Context, id string, rels []*DistributedRelation) error
TODO : unit tests
func (*EtcdQDB) AlterDistributionDetach ¶
func (q *EtcdQDB) AlterDistributionDetach(ctx context.Context, id string, relation *rfqn.RelationFQN) error
TODO: unit tests
func (*EtcdQDB) AlterReferenceRelationStorage ¶
func (q *EtcdQDB) AlterReferenceRelationStorage(ctx context.Context, relation *rfqn.RelationFQN, shs []string) error
AlterReferenceRelationStorage implements XQDB.
func (*EtcdQDB) AlterReplicatedRelationSchema ¶
func (q *EtcdQDB) AlterReplicatedRelationSchema(ctx context.Context, dsID string, relationFQN *rfqn.RelationFQN, schemaName string) error
TODO : unit tests
func (*EtcdQDB) AlterSequenceAttach ¶
func (*EtcdQDB) AlterSequenceDetachRelation ¶
func (*EtcdQDB) AlterShard ¶
func (*EtcdQDB) BeginTransaction ¶
func (q *EtcdQDB) BeginTransaction(ctx context.Context, transaction *QdbTransaction) error
func (*EtcdQDB) CheckDistribution ¶
TODO : unit tests
func (*EtcdQDB) CheckLockedKeyRange ¶
TODO : unit tests
func (*EtcdQDB) CheckMoveTaskGroupStopFlag ¶
TODO unit test
func (*EtcdQDB) CheckSequence ¶
func (*EtcdQDB) CheckTaskGroupLocked ¶
func (*EtcdQDB) CloseRouter ¶
TODO : unit tests
func (*EtcdQDB) CommitTransaction ¶
func (q *EtcdQDB) CommitTransaction(ctx context.Context, transaction *QdbTransaction) error
func (*EtcdQDB) CreateDistribution ¶
func (q *EtcdQDB) CreateDistribution(_ context.Context, distribution *Distribution) ([]QdbStatement, error)
TODO : unit tests
func (*EtcdQDB) CreateKeyRange ¶
TODO : unit tests
func (*EtcdQDB) CreateRedistributeTask ¶
func (q *EtcdQDB) CreateRedistributeTask(ctx context.Context, task *RedistributeTask) error
TODO: unit tests
func (*EtcdQDB) CreateReferenceRelation ¶
func (q *EtcdQDB) CreateReferenceRelation(ctx context.Context, r *ReferenceRelation) error
CreateReferenceRelation implements XQDB.
func (*EtcdQDB) CreateSequence ¶
func (*EtcdQDB) CreateUniqueIndex ¶
func (q *EtcdQDB) CreateUniqueIndex(ctx context.Context, idx *UniqueIndex) error
func (*EtcdQDB) DeleteKeyRangeMove ¶
func (*EtcdQDB) DeleteRouter ¶
TODO : unit tests
func (*EtcdQDB) DeleteRouterAll ¶
TODO : unit tests
func (*EtcdQDB) DropBalancerTask ¶
TODO: unit tests
func (*EtcdQDB) DropDistribution ¶
func (*EtcdQDB) DropKeyRange ¶
TODO : unit tests
func (*EtcdQDB) DropKeyRangeAll ¶
TODO : unit tests
func (*EtcdQDB) DropMoveTask ¶
TODO unit test
func (*EtcdQDB) DropMoveTaskGroup ¶
TODO: unit tests TODO: drop move task
func (*EtcdQDB) DropRedistributeTask ¶
func (q *EtcdQDB) DropRedistributeTask(ctx context.Context, task *RedistributeTask) error
TODO: unit tests
func (*EtcdQDB) DropRedistributeTaskLock ¶
func (*EtcdQDB) DropReferenceRelation ¶
DropReferenceRelation implements XQDB.
func (*EtcdQDB) DropSequence ¶
func (*EtcdQDB) DropTaskGroupLock ¶
func (*EtcdQDB) DropUniqueIndex ¶
func (*EtcdQDB) ExecNoTransaction ¶
func (q *EtcdQDB) ExecNoTransaction(ctx context.Context, operations []QdbStatement) error
func (*EtcdQDB) GetAllTaskGroupStatuses ¶
func (*EtcdQDB) GetBalancerTask ¶
func (q *EtcdQDB) GetBalancerTask(ctx context.Context) (*BalancerTask, error)
TODO: unit tests
func (*EtcdQDB) GetCoordinator ¶
TODO : unit tests
func (*EtcdQDB) GetDistribution ¶
TODO : unit tests
func (*EtcdQDB) GetKeyRange ¶
TODO : unit tests
func (*EtcdQDB) GetKeyRangeRedistributeTaskId ¶
func (*EtcdQDB) GetMoveTask ¶
TODO unit test
func (*EtcdQDB) GetMoveTaskByGroup ¶
func (*EtcdQDB) GetMoveTaskGroup ¶
TODO: unit tests
func (*EtcdQDB) GetMoveTaskGroupTotalKeys ¶
TODO: unit tests
func (*EtcdQDB) GetRedistributeTask ¶
TODO: unit tests
func (*EtcdQDB) GetRedistributeTaskTaskGroupId ¶
func (*EtcdQDB) GetReferenceRelation ¶
func (q *EtcdQDB) GetReferenceRelation(ctx context.Context, relation *rfqn.RelationFQN) (*ReferenceRelation, error)
GetReferenceRelation implements XQDB.
func (*EtcdQDB) GetRelationDistribution ¶
func (q *EtcdQDB) GetRelationDistribution(ctx context.Context, relationFQN *rfqn.RelationFQN) (*Distribution, error)
TODO : unit tests
func (*EtcdQDB) GetRelationSequence ¶
func (*EtcdQDB) GetSequenceRelations ¶
func (*EtcdQDB) GetTaskGroupStatus ¶
func (*EtcdQDB) GetTransferTx ¶
TODO : unit tests
func (*EtcdQDB) GetTxMetaStorage ¶
func (*EtcdQDB) ListAllKeyRanges ¶
TODO : unit tests
func (*EtcdQDB) ListDistributions ¶
func (q *EtcdQDB) ListDistributions(ctx context.Context) ([]*Distribution, error)
TODO : unit tests
func (*EtcdQDB) ListKeyRangeMoves ¶
func (q *EtcdQDB) ListKeyRangeMoves(ctx context.Context) ([]*MoveKeyRange, error)
TODO : unit tests
func (*EtcdQDB) ListKeyRanges ¶
TODO : unit tests
func (*EtcdQDB) ListLockedKeyRanges ¶
func (*EtcdQDB) ListMoveTasks ¶
TODO unit test
func (*EtcdQDB) ListRedistributeTasks ¶
func (q *EtcdQDB) ListRedistributeTasks(ctx context.Context) ([]*RedistributeTask, error)
func (*EtcdQDB) ListReferenceRelations ¶
func (q *EtcdQDB) ListReferenceRelations(ctx context.Context) ([]*ReferenceRelation, error)
ListReferenceRelations implements XQDB.
func (*EtcdQDB) ListRelationIndexes ¶
func (q *EtcdQDB) ListRelationIndexes(ctx context.Context, relationFQN *rfqn.RelationFQN) (map[string]*UniqueIndex, error)
func (*EtcdQDB) ListRouters ¶
TODO : unit tests
func (*EtcdQDB) ListSequences ¶
func (*EtcdQDB) ListShards ¶
TODO : unit tests
func (*EtcdQDB) ListTaskGroups ¶
func (*EtcdQDB) ListUniqueIndexes ¶
func (*EtcdQDB) LockKeyRange ¶
TODO : unit tests
func (*EtcdQDB) LockRedistributeTask ¶
func (*EtcdQDB) OpenRouter ¶
TODO : unit tests
func (*EtcdQDB) RecordKeyRangeMove ¶
func (q *EtcdQDB) RecordKeyRangeMove(ctx context.Context, m *MoveKeyRange) error
TODO : unit tests
func (*EtcdQDB) RecordTransferTx ¶
func (q *EtcdQDB) RecordTransferTx(ctx context.Context, key string, info *DataTransferTransaction) error
TODO : unit tests
func (*EtcdQDB) RemoveTransferTx ¶
TODO : unit tests
func (*EtcdQDB) RenameKeyRange ¶
TODO: unit tests
func (*EtcdQDB) SetTxMetaStorage ¶
func (*EtcdQDB) TryCoordinatorLock ¶
TODO : unit tests
func (*EtcdQDB) TryTaskGroupLock ¶
func (*EtcdQDB) UnlockKeyRange ¶
TODO : unit tests
func (*EtcdQDB) UpdateCoordinator ¶
TODO : unit tests TODO : implement
func (*EtcdQDB) UpdateKeyRange ¶
TODO : unit tests
func (*EtcdQDB) UpdateKeyRangeMoveStatus ¶
func (q *EtcdQDB) UpdateKeyRangeMoveStatus(ctx context.Context, moveId string, s MoveKeyRangeStatus) error
TODO : unit tests
func (*EtcdQDB) UpdateMoveTask ¶
TODO unit test
func (*EtcdQDB) UpdateMoveTaskGroupTotalKeys ¶
func (q *EtcdQDB) UpdateMoveTaskGroupTotalKeys(ctx context.Context, id string, totalKeys int64) error
TODO: unit tests
func (*EtcdQDB) UpdateRedistributeTask ¶
func (q *EtcdQDB) UpdateRedistributeTask(ctx context.Context, task *RedistributeTask) error
TODO: unit tests
func (*EtcdQDB) WriteBalancerTask ¶
func (q *EtcdQDB) WriteBalancerTask(ctx context.Context, task *BalancerTask) error
TODO: unit tests
func (*EtcdQDB) WriteMoveTask ¶
TODO unit test
func (*EtcdQDB) WriteMoveTaskGroup ¶
func (q *EtcdQDB) WriteMoveTaskGroup(ctx context.Context, id string, group *MoveTaskGroup, totalKeys int64, task *MoveTask) error
TODO: unit tests
func (*EtcdQDB) WriteTaskGroupStatus ¶
type GenericOption ¶
type KeyRangeMeta ¶
type KeyRangeStatus ¶
type KeyRangeStatus string
type MemPgQDB ¶
type MemPgQDB struct {
*MemQDB
// contains filtered or unexported fields
}
func GetMemPgQDB ¶
func NewMemPgQDB ¶
func RestoreMemPgQDB ¶
func (*MemPgQDB) AcquireTxOwnership ¶
AcquireTxOwnership implements DCStateKeeper.
func (*MemPgQDB) ChangeTxStatus ¶
ChangeTxStatus implements DCStateKeeper.
func (*MemPgQDB) GetTxMetaStorage ¶
func (*MemPgQDB) ListTXNames ¶
func (*MemPgQDB) RecordTwoPhaseMembers ¶
RecordTwoPhaseMembers implements DCStateKeeper.
func (*MemPgQDB) ReleaseTxOwnership ¶
ReleaseTxOwnership implements DCStateKeeper.
func (*MemPgQDB) RemoveTXData ¶
func (*MemPgQDB) SetTxMetaStorage ¶
func (*MemPgQDB) TXCohortShards ¶
TXCohortShards implements DCStateKeeper.
func (*MemPgQDB) TXStatus ¶
TXStatus implements DCStateKeeper.
type MemQDB ¶
type MemQDB struct {
State *MemQDBState
SequenceLock sync.RWMutex
// contains filtered or unexported fields
}
func RestoreQDB ¶
func (*MemQDB) AcquireTxOwnership ¶
func (*MemQDB) AddMoveTaskGroupStopFlag ¶
TODO: unit tests
func (*MemQDB) AlterDistributedRelation ¶
func (q *MemQDB) AlterDistributedRelation(_ context.Context, id string, rel *DistributedRelation) error
TODO : unit tests
func (*MemQDB) AlterDistributedRelationDistributionKey ¶
func (q *MemQDB) AlterDistributedRelationDistributionKey(_ context.Context, id string, relation *rfqn.RelationFQN, distributionKey []DistributionKeyEntry) error
TODO : unit tests
func (*MemQDB) AlterDistributedRelationSchema ¶
func (q *MemQDB) AlterDistributedRelationSchema(_ context.Context, id string, relation *rfqn.RelationFQN, schemaName string) error
TODO : unit tests TODO: explicitly pass version
func (*MemQDB) AlterDistributionAttach ¶
func (q *MemQDB) AlterDistributionAttach(_ context.Context, id string, rels []*DistributedRelation) error
TODO : unit tests
func (*MemQDB) AlterDistributionDetach ¶
func (q *MemQDB) AlterDistributionDetach(ctx context.Context, id string, relationFQN *rfqn.RelationFQN) error
TODO: unit tests
func (*MemQDB) AlterReferenceRelationStorage ¶
func (q *MemQDB) AlterReferenceRelationStorage(_ context.Context, relationFQN *rfqn.RelationFQN, shs []string) error
AlterReferenceRelationStorage implements XQDB.
func (*MemQDB) AlterReplicatedRelationSchema ¶
func (q *MemQDB) AlterReplicatedRelationSchema(_ context.Context, id string, relation *rfqn.RelationFQN, schemaName string) error
TODO : unit tests
func (*MemQDB) AlterSequenceAttach ¶
func (*MemQDB) AlterSequenceDetachRelation ¶
func (*MemQDB) BeginTransaction ¶
func (q *MemQDB) BeginTransaction(_ context.Context, transaction *QdbTransaction) error
func (*MemQDB) ChangeTxStatus ¶
ChangeTxStatus implements DCStateKeeper.
func (*MemQDB) CheckDistribution ¶
TODO : unit tests
func (*MemQDB) CheckLockedKeyRange ¶
TODO : unit tests
func (*MemQDB) CheckMoveTaskGroupStopFlag ¶
TODO: unit tests
func (*MemQDB) CheckSequence ¶
func (*MemQDB) CheckTaskGroupLocked ¶
func (*MemQDB) CloseRouter ¶
TODO : unit tests
func (*MemQDB) CommitTransaction ¶
func (q *MemQDB) CommitTransaction(_ context.Context, transaction *QdbTransaction) error
func (*MemQDB) CreateDistribution ¶
func (q *MemQDB) CreateDistribution(_ context.Context, distribution *Distribution) ([]QdbStatement, error)
TODO : unit tests
func (*MemQDB) CreateKeyRange ¶
TODO : unit tests
func (*MemQDB) CreateRedistributeTask ¶
func (q *MemQDB) CreateRedistributeTask(_ context.Context, task *RedistributeTask) error
TODO: unit tests
func (*MemQDB) CreateReferenceRelation ¶
func (q *MemQDB) CreateReferenceRelation(_ context.Context, r *ReferenceRelation) error
CreateReferenceRelation implements XQDB.
func (*MemQDB) CreateSequence ¶
func (*MemQDB) CreateUniqueIndex ¶
func (q *MemQDB) CreateUniqueIndex(_ context.Context, idx *UniqueIndex) error
func (*MemQDB) DeleteKeyRangeMove ¶
func (*MemQDB) DeleteRouter ¶
TODO : unit tests
func (*MemQDB) DeleteRouterAll ¶
TODO : unit tests
func (*MemQDB) DropBalancerTask ¶
TODO: unit tests
func (*MemQDB) DropDistribution ¶
TODO : unit tests
func (*MemQDB) DropKeyRange ¶
TODO : unit tests
func (*MemQDB) DropKeyRangeAll ¶
TODO : unit tests
func (*MemQDB) DropMoveTask ¶
TODO: unit tests
func (*MemQDB) DropMoveTaskGroup ¶
TODO: unit tests
func (*MemQDB) DropRedistributeTask ¶
func (q *MemQDB) DropRedistributeTask(_ context.Context, task *RedistributeTask) error
TODO: unit tests
func (*MemQDB) DropRedistributeTaskLock ¶
func (*MemQDB) DropReferenceRelation ¶
DropReferenceRelation implements XQDB.
func (*MemQDB) DropSequence ¶
func (*MemQDB) DropTaskGroupLock ¶
func (*MemQDB) DropUniqueIndex ¶
func (*MemQDB) ExecNoTransaction ¶
func (q *MemQDB) ExecNoTransaction(_ context.Context, operations []QdbStatement) error
func (*MemQDB) GetAllTaskGroupStatuses ¶
func (*MemQDB) GetBalancerTask ¶
func (q *MemQDB) GetBalancerTask(_ context.Context) (*BalancerTask, error)
TODO: unit tests
func (*MemQDB) GetDistribution ¶
TODO : unit tests
func (*MemQDB) GetKeyRange ¶
func (*MemQDB) GetKeyRangeRedistributeTaskId ¶
func (*MemQDB) GetMoveTask ¶
TODO: unit tests
func (*MemQDB) GetMoveTaskByGroup ¶
func (*MemQDB) GetMoveTaskGroup ¶
TODO: unit tests
func (*MemQDB) GetMoveTaskGroupTotalKeys ¶
TODO: unit tests
func (*MemQDB) GetRedistributeTask ¶
TODO: unit tests
func (*MemQDB) GetRedistributeTaskTaskGroupId ¶
func (*MemQDB) GetReferenceRelation ¶
func (q *MemQDB) GetReferenceRelation(_ context.Context, relationFQN *rfqn.RelationFQN) (*ReferenceRelation, error)
GetReferenceRelation implements XQDB.
func (*MemQDB) GetRelationDistribution ¶
func (q *MemQDB) GetRelationDistribution(_ context.Context, relation *rfqn.RelationFQN) (*Distribution, error)
func (*MemQDB) GetRelationSequence ¶
func (*MemQDB) GetSequenceRelations ¶
func (*MemQDB) GetTaskGroupStatus ¶
func (*MemQDB) GetTransferTx ¶
TODO : unit tests
func (*MemQDB) GetTxMetaStorage ¶
func (*MemQDB) ListAllKeyRanges ¶
TODO : unit tests
func (*MemQDB) ListDistributions ¶
func (q *MemQDB) ListDistributions(_ context.Context) ([]*Distribution, error)
TODO : unit tests
func (*MemQDB) ListKeyRangeMoves ¶
func (q *MemQDB) ListKeyRangeMoves(_ context.Context) ([]*MoveKeyRange, error)
func (*MemQDB) ListKeyRanges ¶
TODO : unit tests
func (*MemQDB) ListLockedKeyRanges ¶
func (*MemQDB) ListMoveTasks ¶
func (*MemQDB) ListRedistributeTasks ¶
func (q *MemQDB) ListRedistributeTasks(_ context.Context) ([]*RedistributeTask, error)
TODO: unit tests
func (*MemQDB) ListReferenceRelations ¶
func (q *MemQDB) ListReferenceRelations(_ context.Context) ([]*ReferenceRelation, error)
ListReferenceRelations implements XQDB.
func (*MemQDB) ListRelationIndexes ¶
func (q *MemQDB) ListRelationIndexes(_ context.Context, relationFQN *rfqn.RelationFQN) (map[string]*UniqueIndex, error)
func (*MemQDB) ListRouters ¶
TODO : unit tests
func (*MemQDB) ListShards ¶
TODO : unit tests
func (*MemQDB) ListTXNames ¶
ListTXNames implements DCStateKeeper.
func (*MemQDB) ListTaskGroups ¶
func (*MemQDB) ListUniqueIndexes ¶
func (*MemQDB) LockKeyRange ¶
TODO : unit tests
func (*MemQDB) LockRedistributeTask ¶
func (*MemQDB) OpenRouter ¶
TODO : unit tests
func (*MemQDB) RecordKeyRangeMove ¶
func (q *MemQDB) RecordKeyRangeMove(_ context.Context, _ *MoveKeyRange) error
func (*MemQDB) RecordTransferTx ¶
func (q *MemQDB) RecordTransferTx(_ context.Context, key string, info *DataTransferTransaction) error
TODO : unit tests
func (*MemQDB) RecordTwoPhaseMembers ¶
RecordTwoPhaseMembers implements DCStateKeeper. XXX: check that all members are valid spqr shards
func (*MemQDB) ReleaseTxOwnership ¶
func (*MemQDB) RemoveTransferTx ¶
TODO : unit tests
func (*MemQDB) RenameKeyRange ¶
TODO: unit tests
func (*MemQDB) SetTxMetaStorage ¶
func (*MemQDB) SwapState ¶
func (q *MemQDB) SwapState(state *MemQDBState)
func (*MemQDB) TXCohortShards ¶
TXCohortShards implements DCStateKeeper.
func (*MemQDB) TryCoordinatorLock ¶
func (*MemQDB) TryTaskGroupLock ¶
func (*MemQDB) UnlockKeyRange ¶
TODO : unit tests
func (*MemQDB) UpdateCoordinator ¶
TODO : unit tests
func (*MemQDB) UpdateKeyRange ¶
TODO : unit tests
func (*MemQDB) UpdateKeyRangeMoveStatus ¶
func (*MemQDB) UpdateMoveTask ¶
TODO: unit tests
func (*MemQDB) UpdateMoveTaskGroupTotalKeys ¶
TODO: unit tests
func (*MemQDB) UpdateRedistributeTask ¶
func (q *MemQDB) UpdateRedistributeTask(_ context.Context, task *RedistributeTask) error
TODO: unit tests
func (*MemQDB) WriteBalancerTask ¶
func (q *MemQDB) WriteBalancerTask(_ context.Context, task *BalancerTask) error
TODO: unit tests
func (*MemQDB) WriteMoveTask ¶
TODO: unit tests
func (*MemQDB) WriteMoveTaskGroup ¶
func (q *MemQDB) WriteMoveTaskGroup(_ context.Context, id string, group *MoveTaskGroup, _ int64, _ *MoveTask) error
TODO: unit tests
func (*MemQDB) WriteTaskGroupStatus ¶
type MemQDBState ¶
type MemQDBState struct {
Locks map[string]*sync.RWMutex `json:"locks"`
Freq map[string]bool `json:"freq"`
Krs map[string]*internalKeyRange `json:"krs"`
KrVersions map[string]int `json:"kr_versions"`
Shards map[string]*Shard `json:"shards"`
Distributions map[string]*Distribution `json:"distributions"`
RelationDistribution map[string]string `json:"relation_distribution"`
Routers map[string]*Router `json:"routers"`
Transactions map[string]*DataTransferTransaction `json:"transactions"`
Coordinator string `json:"coordinator"`
MoveTaskGroups map[string]*MoveTaskGroup `json:"taskGroup"`
TaskGroupIDToStatus map[string]*TaskGroupStatus `json:"task_group_statuses"`
StopMoveTaskGroup map[string]string `json:"stop_move_task_group"`
MoveTasks map[string]*MoveTask `json:"move_tasks"`
TotalKeys map[string]int64 `json:"total_keys"`
RedistributeTasks map[string]*RedistributeTask `json:"redistribute_tasks"`
RedistributeTaskTaskGroupId map[string]string `json:"redistribute_task_task_group"`
KeyRangeRedistributeTasks map[string]string `json:"key_range_redistribute_tasks"`
BalancerTask *BalancerTask `json:"balancer_task"`
ReferenceRelations map[string]*ReferenceRelation `json:"reference_relations"`
Sequences map[string]bool `json:"sequences"`
ColumnSequence map[string]string `json:"column_sequence"`
SequenceToValues map[string]int64 `json:"sequence_to_values"`
TaskGroupMoveTaskID map[string]string `json:"task_group_move_task"`
UniqueIndexes map[string]*UniqueIndex `json:"unique_indexes"`
UniqueIndexesByRel map[string]map[string]*UniqueIndex `json:"unique_indexes_by_relation"`
TwoPhaseTx map[string]*TwoPCInfo `json:"two_phase_info"`
}
type MoveKeyRange ¶
type MoveKeyRange struct {
MoveId string `json:"move_id"`
ShardId string `json:"shard_id"`
KeyRangeID string `json:"key_range_id"`
Status MoveKeyRangeStatus `json:"status"`
}
type MoveKeyRangeStatus ¶
type MoveKeyRangeStatus string
type MoveTaskGroup ¶
type MoveTaskGroup struct {
Type int `json:"type"`
ShardToId string `json:"shard_to_id"`
KrIdFrom string `json:"kr_id_from"`
KrIdTo string `json:"kr_id_to"`
BoundRel string `json:"rel"`
Coeff float64 `json:"coeff"`
BatchSize int64 `json:"batch_size"`
Limit int64 `json:"limit"`
CreatedAt time.Time `json:"created_at"`
Issuer *MoveTaskGroupIssuer `json:"issuer"`
}
type MoveTaskGroupIssuer ¶
type PgDCStateKeeper ¶
type PgDCStateKeeper struct {
// contains filtered or unexported fields
}
func NewPgQDB ¶
func NewPgQDB(shards *config.DatatransferConnections) *PgDCStateKeeper
func (*PgDCStateKeeper) AcquireTxOwnership ¶
AcquireTxOwnership implements DCStateKeeper.
func (*PgDCStateKeeper) ChangeTxStatus ¶
func (q *PgDCStateKeeper) ChangeTxStatus(ctx context.Context, txid string, state TwoPhaseTxState) error
ChangeTxStatus implements DCStateKeeper.
func (*PgDCStateKeeper) ClearTxStatuses ¶
func (q *PgDCStateKeeper) ClearTxStatuses(ctx context.Context) error
func (*PgDCStateKeeper) GetTxMetaStorage ¶
func (q *PgDCStateKeeper) GetTxMetaStorage() []string
func (*PgDCStateKeeper) ListTXNames ¶
func (q *PgDCStateKeeper) ListTXNames(ctx context.Context) ([]string, error)
func (*PgDCStateKeeper) RecordTwoPhaseMembers ¶
func (q *PgDCStateKeeper) RecordTwoPhaseMembers(ctx context.Context, txid string, shards []string) error
RecordTwoPhaseMembers implements DCStateKeeper.
func (*PgDCStateKeeper) ReleaseTxOwnership ¶
func (q *PgDCStateKeeper) ReleaseTxOwnership(_ context.Context, txid string) error
ReleaseTxOwnership implements DCStateKeeper.
func (*PgDCStateKeeper) RemoveTXData ¶
func (q *PgDCStateKeeper) RemoveTXData(ctx context.Context, txid string) error
func (*PgDCStateKeeper) SetTxMetaStorage ¶
func (q *PgDCStateKeeper) SetTxMetaStorage(storage []string) error
func (*PgDCStateKeeper) TXCohortShards ¶
TXCohortShards implements DCStateKeeper.
func (*PgDCStateKeeper) TXStatus ¶
func (q *PgDCStateKeeper) TXStatus(ctx context.Context, txid string) (TwoPhaseTxState, error)
TXStatus implements DCStateKeeper.
type QDB ¶
type QDB interface {
// Key ranges
CreateKeyRange(ctx context.Context, keyRange *KeyRange) ([]QdbStatement, error)
GetKeyRange(ctx context.Context, id string) (*KeyRange, error)
UpdateKeyRange(ctx context.Context, keyRange *KeyRange) ([]QdbStatement, error)
DropKeyRange(ctx context.Context, id string) ([]QdbStatement, error)
DropKeyRangeAll(ctx context.Context) error
ListKeyRanges(ctx context.Context, distribution string) ([]*KeyRange, error)
ListAllKeyRanges(ctx context.Context) ([]*KeyRange, error)
LockKeyRange(ctx context.Context, id string) (*KeyRange, error)
UnlockKeyRange(ctx context.Context, id string) error
CheckLockedKeyRange(ctx context.Context, id string) (*KeyRange, error)
ListLockedKeyRanges(ctx context.Context) ([]string, error)
RenameKeyRange(ctx context.Context, krId, ktIdNew string) error
// Distribution management
CreateDistribution(ctx context.Context, distr *Distribution) ([]QdbStatement, error)
ListDistributions(ctx context.Context) ([]*Distribution, error)
DropDistribution(ctx context.Context, id string) error
GetDistribution(ctx context.Context, id string) (*Distribution, error)
CheckDistribution(ctx context.Context, id string) (bool, error)
GetRelationDistribution(ctx context.Context, relation *rfqn.RelationFQN) (*Distribution, error)
// Reference relations
CreateReferenceRelation(ctx context.Context, r *ReferenceRelation) error
GetReferenceRelation(ctx context.Context, relationFQN *rfqn.RelationFQN) (*ReferenceRelation, error)
AlterReferenceRelationStorage(ctx context.Context, relationFQN *rfqn.RelationFQN, shs []string) error
ListReferenceRelations(ctx context.Context) ([]*ReferenceRelation, error)
DropReferenceRelation(ctx context.Context, relationFQN *rfqn.RelationFQN) error
// Update distribution
AlterDistributionAttach(ctx context.Context, id string, rels []*DistributedRelation) error
AlterDistributionDetach(ctx context.Context, id string, relationFQN *rfqn.RelationFQN) error
AlterDistributedRelation(ctx context.Context, id string, rel *DistributedRelation) error
AlterDistributedRelationSchema(ctx context.Context, id string, relation *rfqn.RelationFQN, schemaName string) error
AlterDistributedRelationDistributionKey(ctx context.Context, id string, relation *rfqn.RelationFQN, distributionKey []DistributionKeyEntry) error
AlterReplicatedRelationSchema(ctx context.Context, dsID string, relation *rfqn.RelationFQN, schemaName string) error
// Unique indexes
CreateUniqueIndex(ctx context.Context, idx *UniqueIndex) error
DropUniqueIndex(ctx context.Context, id string) error
ListUniqueIndexes(ctx context.Context) (map[string]*UniqueIndex, error)
ListRelationIndexes(ctx context.Context, relationFQN *rfqn.RelationFQN) (map[string]*UniqueIndex, error)
// Task group
ListTaskGroups(ctx context.Context) (map[string]*MoveTaskGroup, error)
GetMoveTaskGroup(ctx context.Context, id string) (*MoveTaskGroup, error)
WriteMoveTaskGroup(ctx context.Context, id string, group *MoveTaskGroup, totalKeys int64, moveTask *MoveTask) error
GetMoveTaskGroupTotalKeys(ctx context.Context, id string) (int64, error)
UpdateMoveTaskGroupTotalKeys(ctx context.Context, id string, totalKeys int64) error
DropMoveTaskGroup(ctx context.Context, id string) error
AddMoveTaskGroupStopFlag(ctx context.Context, id string, immediate bool) error
/* XXX: stop move task kind? */
CheckMoveTaskGroupStopFlag(ctx context.Context, id string) (bool, bool, error)
WriteTaskGroupStatus(ctx context.Context, id string, status *TaskGroupStatus) error
GetTaskGroupStatus(ctx context.Context, id string) (*TaskGroupStatus, error)
GetAllTaskGroupStatuses(ctx context.Context) (map[string]*TaskGroupStatus, error)
// MOVE tasks
ListMoveTasks(ctx context.Context) (map[string]*MoveTask, error)
GetMoveTask(ctx context.Context, id string) (*MoveTask, error)
WriteMoveTask(ctx context.Context, task *MoveTask) error
UpdateMoveTask(ctx context.Context, task *MoveTask) error
DropMoveTask(ctx context.Context, id string) error
GetMoveTaskByGroup(ctx context.Context, taskGroupId string) (*MoveTask, error)
// Redistribute tasks
ListRedistributeTasks(ctx context.Context) ([]*RedistributeTask, error)
GetRedistributeTask(ctx context.Context, id string) (*RedistributeTask, error)
CreateRedistributeTask(ctx context.Context, task *RedistributeTask) error
UpdateRedistributeTask(ctx context.Context, task *RedistributeTask) error
DropRedistributeTask(ctx context.Context, task *RedistributeTask) error
GetRedistributeTaskTaskGroupId(ctx context.Context, redistributeTaskId string) (string, error)
GetKeyRangeRedistributeTaskId(ctx context.Context, keyRangeId string) (string, error)
// Balancer interaction
GetBalancerTask(ctx context.Context) (*BalancerTask, error)
WriteBalancerTask(ctx context.Context, task *BalancerTask) error
DropBalancerTask(ctx context.Context) error
// Coordinator interaction
UpdateCoordinator(ctx context.Context, address string) error
GetCoordinator(ctx context.Context) (string, error)
ListRouters(ctx context.Context) ([]*Router, error)
// Sequences for reference relation
CreateSequence(ctx context.Context, seqName string, initialValue int64) ([]QdbStatement, error)
CheckSequence(ctx context.Context, seqName string) (bool, error)
ListSequences(ctx context.Context) ([]string, error)
AlterSequenceAttach(ctx context.Context, seqName string, relationFQN *rfqn.RelationFQN, colName string) error
GetRelationSequence(ctx context.Context, relationFQN *rfqn.RelationFQN) (map[string]string, error)
NextRange(ctx context.Context, seqName string, rangeSize uint64) (*SequenceIdRange, error)
CurrVal(ctx context.Context, seqName string) (int64, error)
DropSequence(ctx context.Context, seqName string, force bool) error
GetSequenceRelations(ctx context.Context, seqName string) ([]*rfqn.RelationFQN, error)
AlterSequenceDetachRelation(ctx context.Context, rel *rfqn.RelationFQN) error
}
QDB is a generic interface used by both the coordinator and the router. The router uses a memory-based version of this interface to cache routing schema state while the coordinator uses etcd-based implementation to synchronize distributed state.
type QdbStatement ¶
type QdbStatement struct {
CmdType int32
Key string
Value any
// for case when qdb have more than one KV-storage
Extension string
}
func NewQdbStatement ¶
func NewQdbStatement(cmdType int32, key string, value any) (*QdbStatement, error)
func NewQdbStatementExt ¶
type QdbTransaction ¶
type QdbTransaction struct {
// contains filtered or unexported fields
}
func NewTransaction ¶
func NewTransaction() (*QdbTransaction, error)
func NewTransactionWithCmd ¶
func NewTransactionWithCmd(transactionId uuid.UUID, commands []QdbStatement) *QdbTransaction
func (*QdbTransaction) Append ¶
func (t *QdbTransaction) Append(qdbCommands []QdbStatement) error
func (*QdbTransaction) Id ¶
func (t *QdbTransaction) Id() uuid.UUID
func (*QdbTransaction) Validate ¶
func (t *QdbTransaction) Validate() error
type RedistributeTask ¶
type ReferenceRelation ¶
type ReferenceRelation struct {
TableName string `json:"table_name"`
SchemaName string `json:"schema_name"`
SchemaVersion uint64 `json:"schema_version"`
ColumnSequenceMapping map[string]string `json:"column_sequence_mapping"`
ShardIDs []string `json:"shard_ids"`
Version uint64 `json:"version,omitempty"`
ACL []ACLItem `json:"acl,omitempty"`
}
type Router ¶
type Router struct {
Address string `json:"address"`
ID string `json:"id"`
State RouterState `json:"state,omitempty"`
}
func NewRouter ¶
func NewRouter(addr, id string, rst RouterState) *Router
type RouterState ¶
type RouterState string
type RoutingExpr ¶
type RoutingExpr struct {
ColRefs []TypedColRef `json:"column_refs_v1"`
}
type SequenceIdRange ¶
func NewRangeBySize ¶
func NewRangeBySize(currentRight int64, rangeSize uint64) (*SequenceIdRange, error)
func NewSequenceIdRange ¶
func NewSequenceIdRange(left int64, right int64) (*SequenceIdRange, error)
type Shard ¶
type Shard struct {
ID string `json:"id"`
RawHosts []string `json:"hosts"` // format host:port:availability_zone
Options []GenericOption `json:"options,omitempty"`
}
type ShardingSchemaKeeper ¶
type ShardingSchemaKeeper interface {
// RecordKeyRangeMove persists start of key range movement in distributed storage
RecordKeyRangeMove(ctx context.Context, m *MoveKeyRange) error
// ListKeyRangeMoves lists all key-range moves that are in progress
ListKeyRangeMoves(ctx context.Context) ([]*MoveKeyRange, error)
// UpdateKeyRangeMoveStatus marks the key range move as complete
UpdateKeyRangeMoveStatus(ctx context.Context, moveId string, s MoveKeyRangeStatus) error
// DeleteKeyRangeMove removes information about key range moves
DeleteKeyRangeMove(ctx context.Context, moveId string) error
}
type StateKeeperQDB ¶
type StateKeeperQDB interface {
XQDB
DCStateKeeper
}
func GetStateKeeperQDB ¶
func GetStateKeeperQDB() (StateKeeperQDB, error)
type TXManager ¶
type TXManager interface {
//batch execution
ExecNoTransaction(ctx context.Context, operations []QdbStatement) error
CommitTransaction(ctx context.Context, transaction *QdbTransaction) error
BeginTransaction(ctx context.Context, transaction *QdbTransaction) error
}
type TaskGroupStatus ¶
type TaskStateKeeper ¶
type TaskStateKeeper interface {
TryTaskGroupLock(ctx context.Context, tgId string, holder string) error
CheckTaskGroupLocked(ctx context.Context, tgId string) (bool, error)
DropTaskGroupLock(ctx context.Context, tgId string) error
LockRedistributeTask(ctx context.Context, id string, holder string) error
DropRedistributeTaskLock(ctx context.Context, id string) error
}
type TopologyKeeper ¶
type TopologyKeeper interface {
// AddRouter adds a new router to the cluster
AddRouter(ctx context.Context, r *Router) error
// DeleteRouter removes the router from the cluster
DeleteRouter(ctx context.Context, rID string) error
// DeleteRouter removes all routers from the cluster
DeleteRouterAll(ctx context.Context) error
//ListRouters lists the routers of the cluster
ListRouters(ctx context.Context) ([]*Router, error)
// OpenRouter changes the state of the router to online, making it usable for query execution.
OpenRouter(ctx context.Context, rID string) error
// CloseRouter changes the state of the router to offline, making it unavailable for query execution.
CloseRouter(ctx context.Context, rID string) error
// Shards
AddShard(ctx context.Context, shard *Shard) error
ListShards(ctx context.Context) ([]*Shard, error)
GetShard(ctx context.Context, shardID string) (*Shard, error)
DropShard(ctx context.Context, shardID string) error
AlterShard(ctx context.Context, newShard *Shard) error
}
type TransferXactKeeper ¶
type TransferXactKeeper interface {
RecordTransferTx(ctx context.Context, key string, info *DataTransferTransaction) error
GetTransferTx(ctx context.Context, key string) (*DataTransferTransaction, error)
RemoveTransferTx(ctx context.Context, key string) error
}
Keep track of the status of the two-phase data move transaction.
type TwoPhaseTxMetaKeeper ¶
type TwoPhaseTxState ¶
type TwoPhaseTxState string
const ( TwoPhaseInitState TwoPhaseTxState = "TxInitState" TwoPhaseP1 TwoPhaseTxState = "PrepareDone" TwoPhaseP2 TwoPhaseTxState = "Done" TwoPhaseP2Rejected TwoPhaseTxState = "DoneRejected" )
XXX: note that this is data-plane two phase transaction state,
* not control-plane transfer task state
func TwoPhaseTXStateFromString ¶
func TwoPhaseTXStateFromString(status string) (TwoPhaseTxState, error)
type TypedColRef ¶
type UniqueIndex ¶
type UpdateCommand ¶
type UpdateCommand[T any] struct { // contains filtered or unexported fields }
func NewUpdateCommand ¶
func NewUpdateCommand[T any](m map[string]T, key string, value T) *UpdateCommand[T]
func (*UpdateCommand[T]) Do ¶
func (c *UpdateCommand[T]) Do() error
func (*UpdateCommand[T]) Undo ¶
func (c *UpdateCommand[T]) Undo() error
type XDCStateKeeper ¶
type XDCStateKeeper interface {
TopologyKeeper
DCStateKeeper
TwoPhaseTxMetaKeeper
}
func NewDataPlaneTwoPhaseStateKeeper ¶
func NewDataPlaneTwoPhaseStateKeeper(qdbType string) (XDCStateKeeper, error)
type XQDB ¶
type XQDB interface {
// routing schema
QDB
// router topology
TopologyKeeper
// data move state
ShardingSchemaKeeper
TransferXactKeeper
TXManager
TaskStateKeeper
TwoPhaseTxMetaKeeper
TryCoordinatorLock(ctx context.Context, addr string) error
}
XQDB means extended QDB The coordinator should use an etcd-based implementation to keep the distributed state in sync.