Search in sources :

Example 6 with MigrationInfo

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

the class InternalPartitionServiceImpl method updatePartitionsAndFinalizeMigrations.

private void updatePartitionsAndFinalizeMigrations(PartitionRuntimeState partitionState) {
    final Address[][] partitionTable = partitionState.getPartitionTable();
    updateAllPartitions(partitionTable);
    partitionStateManager.setVersion(partitionState.getVersion());
    Collection<MigrationInfo> completedMigrations = partitionState.getCompletedMigrations();
    for (MigrationInfo completedMigration : completedMigrations) {
        assert completedMigration.getStatus() == MigrationStatus.SUCCESS || completedMigration.getStatus() == MigrationStatus.FAILED : "Invalid migration: " + completedMigration;
        if (migrationManager.addCompletedMigration(completedMigration)) {
            migrationManager.scheduleActiveMigrationFinalization(completedMigration);
        }
    }
    if (!partitionStateManager.setInitialized()) {
        node.getNodeExtension().onPartitionStateChange();
    }
    migrationManager.retainCompletedMigrations(completedMigrations);
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo)

Example 7 with MigrationInfo

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

the class PromotionCommitOperation method beforePromotion.

private void beforePromotion() {
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    InternalOperationService operationService = nodeEngine.getOperationService();
    InternalPartitionServiceImpl partitionService = getService();
    ILogger logger = getLogger();
    if (logger.isFineEnabled()) {
        logger.fine("Submitting BeforePromotionOperations for " + promotions.size() + " promotions.");
    }
    Runnable beforePromotionsCallback = new BeforePromotionOperationCallback(this, new AtomicInteger(promotions.size()));
    for (MigrationInfo promotion : promotions) {
        if (logger.isFinestEnabled()) {
            logger.finest("Submitting BeforePromotionOperation for promotion: " + promotion);
        }
        int currentReplicaIndex = promotion.getDestinationCurrentReplicaIndex();
        BeforePromotionOperation op = new BeforePromotionOperation(currentReplicaIndex, beforePromotionsCallback);
        op.setPartitionId(promotion.getPartitionId()).setNodeEngine(nodeEngine).setService(partitionService);
        operationService.execute(op);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) ILogger(com.hazelcast.logging.ILogger) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Example 8 with MigrationInfo

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

the class PromotionCommitOperation method writeInternal.

@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
    super.writeInternal(out);
    out.writeUTF(expectedMemberUuid);
    partitionState.writeData(out);
    int len = promotions.size();
    out.writeInt(len);
    for (MigrationInfo migrationInfo : promotions) {
        migrationInfo.writeData(out);
    }
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo)

Example 9 with MigrationInfo

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

the class BaseMigrationOperation method readInternal.

@Override
protected void readInternal(ObjectDataInput in) throws IOException {
    migrationInfo = new MigrationInfo();
    migrationInfo.readData(in);
    partitionStateVersion = in.readInt();
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo)

Example 10 with MigrationInfo

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

the class MigrationCommitServiceTest method testFailedShiftDownMigration.

private void testFailedShiftDownMigration(int partitionId, int replicaIndexToClear, int oldReplicaIndex, int newReplicaIndex) throws Exception {
    Address destination = clearReplicaIndex(partitionId, replicaIndexToClear);
    MigrationInfo migration = createShiftDownMigration(partitionId, oldReplicaIndex, newReplicaIndex, destination);
    migrateWithFailure(migration);
    assertMigrationSourceRollback(migration);
    assertMigrationDestinationRollback(migration);
    assertPartitionDataAfterMigrations();
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) Address(com.hazelcast.nio.Address)

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