use of com.facebook.presto.raptor.metadata.ShardMetadata in project presto by prestodb.
the class ShardOrganizationManager method runOrganization.
private void runOrganization(long tableId) {
Set<ShardMetadata> shardMetadatas = shardManager.getNodeShards(currentNodeIdentifier, tableId);
Table tableInfo = metadataDao.getTableInformation(tableId);
Set<ShardMetadata> filteredShards = shardMetadatas.stream().filter(shard -> !organizer.inProgress(shard.getShardUuid())).collect(toSet());
Collection<ShardIndexInfo> indexInfos = getOrganizationEligibleShards(dbi, metadataDao, tableInfo, filteredShards, true);
Set<OrganizationSet> organizationSets = createOrganizationSets(tableInfo, indexInfos);
if (organizationSets.isEmpty()) {
return;
}
log.info("Created %s organization set(s) from %s shards for table ID %s", organizationSets.size(), filteredShards.size(), tableId);
long lastStartTime = System.currentTimeMillis();
tablesInProgress.add(tableId);
ImmutableList.Builder<CompletableFuture<?>> futures = ImmutableList.builder();
for (OrganizationSet organizationSet : organizationSets) {
futures.add(organizer.enqueue(organizationSet));
}
allAsList(futures.build()).whenComplete((value, throwable) -> {
tablesInProgress.remove(tableId);
organizerDao.updateLastStartTime(currentNodeIdentifier, tableId, lastStartTime);
});
}
Aggregations