Class DatabaseShardManager
java.lang.Object
io.trino.plugin.raptor.legacy.metadata.DatabaseShardManager
- All Implemented Interfaces:
ShardManager
-
Constructor Summary
ConstructorsConstructorDescriptionDatabaseShardManager(org.jdbi.v3.core.Jdbi dbi, DaoSupplier<ShardDao> shardDaoSupplier, NodeSupplier nodeSupplier, AssignmentLimiter assignmentLimiter, com.google.common.base.Ticker ticker, io.airlift.units.Duration startupGracePeriod) DatabaseShardManager(org.jdbi.v3.core.Jdbi dbi, DaoSupplier<ShardDao> shardDaoSupplier, NodeSupplier nodeSupplier, AssignmentLimiter assignmentLimiter, com.google.common.base.Ticker ticker, MetadataConfig config) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumn(long tableId, ColumnInfo column) Add a column to the end of the table.longBegin a transaction for creating shards.voidcommitShards(long transactionId, long tableId, List<ColumnInfo> columns, Collection<ShardInfo> shards, Optional<String> externalBatchId, long updateTime) Commit data for a table.voidcreateBuckets(long distributionId, int bucketCount) Create initial bucket assignments for a distribution.voidcreateTable(long tableId, List<ColumnInfo> columns, boolean bucketed, OptionalLong temporalColumnId) Create a table.voiddropTable(long tableId) Drop a table.getBucketAssignments(long distributionId) Get map of buckets to node identifiers for a distribution.getBucketNodes(long distibutionId) Get list of bucket nodes for a distribution.Get all active distributions.longgetDistributionSizeInBytes(long distributionId) Get total physical size of all tables in a distribution.getExistingShardUuids(long tableId, Set<UUID> shardUuids) Return the subset of shard uuids that existGet the number of bytes used by assigned shards per node.getNodeShards(String nodeIdentifier) Get shard metadata for shards on a given node.getNodeShards(String nodeIdentifier, long tableId) Get shard metadata for shards on a given node.Get shard metadata for a shard.org.jdbi.v3.core.result.ResultIterator<BucketShards>getShardNodes(long tableId, TupleDomain<RaptorColumnHandle> effectivePredicate) Return the shard nodes for a non-bucketed table.org.jdbi.v3.core.result.ResultIterator<BucketShards>getShardNodesBucketed(long tableId, boolean merged, List<String> bucketToNode, TupleDomain<RaptorColumnHandle> effectivePredicate) Return the shard nodes for a bucketed table.static StringmaxColumn(long columnId) static StringminColumn(long columnId) voidreplaceShardAssignment(long tableId, UUID shardUuid, String nodeIdentifier, boolean gracePeriod) Remove all old shard assignments and assign a shard to a nodevoidreplaceShardUuids(long transactionId, long tableId, List<ColumnInfo> columns, Set<UUID> oldShardUuids, Collection<ShardInfo> newShards, OptionalLong updateTime) Replace oldShardsUuids with newShards.voidrollbackTransaction(long transactionId) Rollback a transaction.static StringshardIndexTable(long tableId) voidupdateBucketAssignment(long distributionId, int bucketNumber, String nodeId) Change the node a bucket is assigned to.
-
Constructor Details
-
DatabaseShardManager
@Inject public DatabaseShardManager(org.jdbi.v3.core.Jdbi dbi, DaoSupplier<ShardDao> shardDaoSupplier, NodeSupplier nodeSupplier, AssignmentLimiter assignmentLimiter, com.google.common.base.Ticker ticker, MetadataConfig config) -
DatabaseShardManager
public DatabaseShardManager(org.jdbi.v3.core.Jdbi dbi, DaoSupplier<ShardDao> shardDaoSupplier, NodeSupplier nodeSupplier, AssignmentLimiter assignmentLimiter, com.google.common.base.Ticker ticker, io.airlift.units.Duration startupGracePeriod)
-
-
Method Details
-
createTable
public void createTable(long tableId, List<ColumnInfo> columns, boolean bucketed, OptionalLong temporalColumnId) Description copied from interface:ShardManagerCreate a table.- Specified by:
createTablein interfaceShardManager
-
dropTable
public void dropTable(long tableId) Description copied from interface:ShardManagerDrop a table.- Specified by:
dropTablein interfaceShardManager
-
addColumn
Description copied from interface:ShardManagerAdd a column to the end of the table.- Specified by:
addColumnin interfaceShardManager
-
commitShards
public void commitShards(long transactionId, long tableId, List<ColumnInfo> columns, Collection<ShardInfo> shards, Optional<String> externalBatchId, long updateTime) Description copied from interface:ShardManagerCommit data for a table.- Specified by:
commitShardsin interfaceShardManager
-
replaceShardUuids
public void replaceShardUuids(long transactionId, long tableId, List<ColumnInfo> columns, Set<UUID> oldShardUuids, Collection<ShardInfo> newShards, OptionalLong updateTime) Description copied from interface:ShardManagerReplace oldShardsUuids with newShards.- Specified by:
replaceShardUuidsin interfaceShardManager
-
getShard
Description copied from interface:ShardManagerGet shard metadata for a shard.- Specified by:
getShardin interfaceShardManager
-
getNodeShards
Description copied from interface:ShardManagerGet shard metadata for shards on a given node.- Specified by:
getNodeShardsin interfaceShardManager
-
getNodeShards
Description copied from interface:ShardManagerGet shard metadata for shards on a given node.- Specified by:
getNodeShardsin interfaceShardManager
-
getShardNodes
public org.jdbi.v3.core.result.ResultIterator<BucketShards> getShardNodes(long tableId, TupleDomain<RaptorColumnHandle> effectivePredicate) Description copied from interface:ShardManagerReturn the shard nodes for a non-bucketed table.- Specified by:
getShardNodesin interfaceShardManager
-
getShardNodesBucketed
public org.jdbi.v3.core.result.ResultIterator<BucketShards> getShardNodesBucketed(long tableId, boolean merged, List<String> bucketToNode, TupleDomain<RaptorColumnHandle> effectivePredicate) Description copied from interface:ShardManagerReturn the shard nodes for a bucketed table.- Specified by:
getShardNodesBucketedin interfaceShardManager
-
replaceShardAssignment
public void replaceShardAssignment(long tableId, UUID shardUuid, String nodeIdentifier, boolean gracePeriod) Description copied from interface:ShardManagerRemove all old shard assignments and assign a shard to a node- Specified by:
replaceShardAssignmentin interfaceShardManager
-
getNodeBytes
Description copied from interface:ShardManagerGet the number of bytes used by assigned shards per node.- Specified by:
getNodeBytesin interfaceShardManager
-
beginTransaction
public long beginTransaction()Description copied from interface:ShardManagerBegin a transaction for creating shards.- Specified by:
beginTransactionin interfaceShardManager- Returns:
- transaction ID
-
rollbackTransaction
public void rollbackTransaction(long transactionId) Description copied from interface:ShardManagerRollback a transaction.- Specified by:
rollbackTransactionin interfaceShardManager
-
createBuckets
public void createBuckets(long distributionId, int bucketCount) Description copied from interface:ShardManagerCreate initial bucket assignments for a distribution.- Specified by:
createBucketsin interfaceShardManager
-
getBucketAssignments
Description copied from interface:ShardManagerGet map of buckets to node identifiers for a distribution.- Specified by:
getBucketAssignmentsin interfaceShardManager
-
updateBucketAssignment
Description copied from interface:ShardManagerChange the node a bucket is assigned to.- Specified by:
updateBucketAssignmentin interfaceShardManager
-
getDistributions
Description copied from interface:ShardManagerGet all active distributions.- Specified by:
getDistributionsin interfaceShardManager
-
getDistributionSizeInBytes
public long getDistributionSizeInBytes(long distributionId) Description copied from interface:ShardManagerGet total physical size of all tables in a distribution.- Specified by:
getDistributionSizeInBytesin interfaceShardManager
-
getBucketNodes
Description copied from interface:ShardManagerGet list of bucket nodes for a distribution.- Specified by:
getBucketNodesin interfaceShardManager
-
getExistingShardUuids
Description copied from interface:ShardManagerReturn the subset of shard uuids that exist- Specified by:
getExistingShardUuidsin interfaceShardManager
-
shardIndexTable
-
minColumn
-
maxColumn
-