Search in sources :

Example 1 with RemoteRecoveryTask

use of org.apache.asterix.app.nc.task.RemoteRecoveryTask in project asterixdb by apache.

the class MetadataNodeFaultToleranceStrategy method getMetadataPartitionRecoveryPlan.

private RemoteRecoveryTask getMetadataPartitionRecoveryPlan() {
    if (hotStandbyMetadataReplica.isEmpty()) {
        throw new IllegalStateException("No metadata replicas to recover from");
    }
    // Construct recovery plan: Node => Set of partitions to recover from it
    Map<String, Set<Integer>> recoveryPlan = new HashMap<>();
    // Recover metadata partition from any metadata hot standby replica
    ICcApplicationContext appCtx = (ICcApplicationContext) serviceCtx.getApplicationContext();
    int metadataPartitionId = appCtx.getMetadataProperties().getMetadataPartition().getPartitionId();
    Set<Integer> metadataPartition = new HashSet<>(Arrays.asList(metadataPartitionId));
    recoveryPlan.put(hotStandbyMetadataReplica.iterator().next(), metadataPartition);
    return new RemoteRecoveryTask(recoveryPlan);
}
Also used : ICcApplicationContext(org.apache.asterix.common.dataflow.ICcApplicationContext) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) RemoteRecoveryTask(org.apache.asterix.app.nc.task.RemoteRecoveryTask) HashSet(java.util.HashSet)

Aggregations

HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 RemoteRecoveryTask (org.apache.asterix.app.nc.task.RemoteRecoveryTask)1 ICcApplicationContext (org.apache.asterix.common.dataflow.ICcApplicationContext)1