use of org.apache.asterix.common.replication.IReplicaResourcesManager in project asterixdb by apache.
the class ReplicationCheckpointManager method getDeadReplicasMinFirstLSN.
private long getDeadReplicasMinFirstLSN(Set<String> deadReplicaIds) {
final IReplicaResourcesManager remoteResourcesManager = txnSubsystem.getAsterixAppRuntimeContextProvider().getAppContext().getReplicaResourcesManager();
final IApplicationContext propertiesProvider = txnSubsystem.getAsterixAppRuntimeContextProvider().getAppContext();
final MetadataProperties metadataProperties = propertiesProvider.getMetadataProperties();
final PersistentLocalResourceRepository localResourceRepository = (PersistentLocalResourceRepository) txnSubsystem.getAsterixAppRuntimeContextProvider().getLocalResourceRepository();
// Get partitions of the dead replicas that are not active on this node
final Set<Integer> deadReplicasPartitions = new HashSet<>();
for (String deadReplicaId : deadReplicaIds) {
final ClusterPartition[] nodePartitons = metadataProperties.getNodePartitions().get(deadReplicaId);
for (ClusterPartition partition : nodePartitons) {
if (!localResourceRepository.getActivePartitions().contains(partition.getPartitionId())) {
deadReplicasPartitions.add(partition.getPartitionId());
}
}
}
return remoteResourcesManager.getPartitionsMinLSN(deadReplicasPartitions);
}
Aggregations