Search in sources :

Example 26 with MigrationInfo

use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.

the class MigrationCommitServiceTest method testSuccessfulMoveMigration.

private void testSuccessfulMoveMigration(int partitionId, int replicaIndexToClear, int replicaIndexToMigrate) throws Exception {
    Address destination = clearReplicaIndex(partitionId, replicaIndexToClear);
    MigrationInfo migration = createMoveMigration(partitionId, replicaIndexToMigrate, destination);
    migrateWithSuccess(migration);
    assertMigrationSourceCommit(migration);
    assertMigrationDestinationCommit(migration);
    assertPartitionDataAfterMigrations();
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) Address(com.hazelcast.nio.Address)

Example 27 with MigrationInfo

use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.

the class MigrationCommitServiceTest method createMoveMigration.

private MigrationInfo createMoveMigration(int partitionId, int replicaIndex, Address destination) {
    InternalPartition partition = getPartition(instances[0], partitionId);
    Address source = partition.getReplicaAddress(replicaIndex);
    String sourceUuid = getMemberUuid(source);
    String destinationUuid = getMemberUuid(destination);
    return new MigrationInfo(partitionId, source, sourceUuid, destination, destinationUuid, replicaIndex, -1, -1, replicaIndex);
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) Address(com.hazelcast.nio.Address) InternalPartition(com.hazelcast.internal.partition.InternalPartition)

Example 28 with MigrationInfo

use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.

the class MigrationCommitServiceTest method testPartitionBackupShiftUpRollbackWithNullOwnerOfReplicaIndex.

@Test
public void testPartitionBackupShiftUpRollbackWithNullOwnerOfReplicaIndex() throws Exception {
    int oldReplicaIndex = NODE_COUNT - 1, newReplicaIndex = NODE_COUNT - 2;
    clearReplicaIndex(PARTITION_ID_TO_MIGRATE, newReplicaIndex);
    MigrationInfo migration = createShiftUpMigration(PARTITION_ID_TO_MIGRATE, oldReplicaIndex, newReplicaIndex);
    migrateWithFailure(migration);
    assertMigrationDestinationRollback(migration);
    assertPartitionDataAfterMigrations();
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 29 with MigrationInfo

use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.

the class BaseMigrationOperation method setActiveMigration.

void setActiveMigration() {
    InternalPartitionServiceImpl partitionService = getService();
    MigrationManager migrationManager = partitionService.getMigrationManager();
    MigrationInfo currentActiveMigration = migrationManager.setActiveMigration(migrationInfo);
    if (currentActiveMigration != null) {
        throw new RetryableHazelcastException("Cannot set active migration to " + migrationInfo + ". Current active migration is " + currentActiveMigration);
    }
    PartitionStateManager partitionStateManager = partitionService.getPartitionStateManager();
    partitionStateManager.setMigratingFlag(migrationInfo.getPartitionId());
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) RetryableHazelcastException(com.hazelcast.spi.exception.RetryableHazelcastException) InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) MigrationManager(com.hazelcast.internal.partition.impl.MigrationManager) PartitionStateManager(com.hazelcast.internal.partition.impl.PartitionStateManager)

Example 30 with MigrationInfo

use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.

the class PromotionCommitOperation method finalizePromotion.

private void finalizePromotion() {
    NodeEngine nodeEngine = getNodeEngine();
    InternalPartitionServiceImpl partitionService = getService();
    OperationService operationService = nodeEngine.getOperationService();
    partitionState.setEndpoint(getCallerAddress());
    success = partitionService.processPartitionRuntimeState(partitionState);
    ILogger logger = getLogger();
    if (logger.isFineEnabled()) {
        logger.fine("Submitting FinalizePromotionOperations for " + promotions.size() + " promotions. Result: " + success);
    }
    for (MigrationInfo promotion : promotions) {
        if (logger.isFinestEnabled()) {
            logger.finest("Submitting FinalizePromotionOperation for promotion: " + promotion + ". Result: " + success);
        }
        int currentReplicaIndex = promotion.getDestinationCurrentReplicaIndex();
        FinalizePromotionOperation op = new FinalizePromotionOperation(currentReplicaIndex, success);
        op.setPartitionId(promotion.getPartitionId()).setNodeEngine(nodeEngine).setService(partitionService);
        operationService.execute(op);
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) ILogger(com.hazelcast.logging.ILogger) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) OperationService(com.hazelcast.spi.OperationService)

Aggregations

MigrationInfo (com.hazelcast.internal.partition.MigrationInfo)34 Address (com.hazelcast.nio.Address)17 ParallelTest (com.hazelcast.test.annotation.ParallelTest)12 QuickTest (com.hazelcast.test.annotation.QuickTest)12 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)6 InternalPartition (com.hazelcast.internal.partition.InternalPartition)3 PartitionRuntimeState (com.hazelcast.internal.partition.PartitionRuntimeState)3 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)3 ILogger (com.hazelcast.logging.ILogger)2 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)2 ClusterState (com.hazelcast.cluster.ClusterState)1 MemberImpl (com.hazelcast.instance.MemberImpl)1 MemberInfo (com.hazelcast.internal.cluster.MemberInfo)1 AuthenticationFailureOperation (com.hazelcast.internal.cluster.impl.operations.AuthenticationFailureOperation)1 AuthorizationOperation (com.hazelcast.internal.cluster.impl.operations.AuthorizationOperation)1 BeforeJoinCheckFailureOperation (com.hazelcast.internal.cluster.impl.operations.BeforeJoinCheckFailureOperation)1 ChangeClusterStateOperation (com.hazelcast.internal.cluster.impl.operations.ChangeClusterStateOperation)1 ConfigMismatchOperation (com.hazelcast.internal.cluster.impl.operations.ConfigMismatchOperation)1 FinalizeJoinOperation (com.hazelcast.internal.cluster.impl.operations.FinalizeJoinOperation)1