Search in sources :

Example 1 with IReplicaResourcesManager

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);
}
Also used : PersistentLocalResourceRepository(org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository) IReplicaResourcesManager(org.apache.asterix.common.replication.IReplicaResourcesManager) IApplicationContext(org.apache.asterix.common.api.IApplicationContext) MetadataProperties(org.apache.asterix.common.config.MetadataProperties) HashSet(java.util.HashSet) ClusterPartition(org.apache.asterix.common.cluster.ClusterPartition)

Aggregations

HashSet (java.util.HashSet)1 IApplicationContext (org.apache.asterix.common.api.IApplicationContext)1 ClusterPartition (org.apache.asterix.common.cluster.ClusterPartition)1 MetadataProperties (org.apache.asterix.common.config.MetadataProperties)1 IReplicaResourcesManager (org.apache.asterix.common.replication.IReplicaResourcesManager)1 PersistentLocalResourceRepository (org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository)1