Search in sources :

Example 16 with MigrationInfo

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

the class MigrationCommitServiceTest method createShiftDownMigration.

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

Example 17 with MigrationInfo

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

the class MigrationCommitServiceTest method testPartitionBackupCopyRollback.

@Test
public void testPartitionBackupCopyRollback() throws Exception {
    Address destination = clearReplicaIndex(PARTITION_ID_TO_MIGRATE, NODE_COUNT - 1);
    MigrationInfo migration = createCopyMigration(PARTITION_ID_TO_MIGRATE, NODE_COUNT - 1, destination);
    migrateWithFailure(migration);
    assertMigrationDestinationRollback(migration);
    assertPartitionDataAfterMigrations();
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) Address(com.hazelcast.nio.Address) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 18 with MigrationInfo

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

the class MigrationCommitServiceTest method testPartitionBackupShiftUpRollbackWithNonNullOwnerOfReplicaIndex.

@Test
public void testPartitionBackupShiftUpRollbackWithNonNullOwnerOfReplicaIndex() throws Exception {
    int oldReplicaIndex = NODE_COUNT - 1, newReplicaIndex = NODE_COUNT - 2;
    MigrationInfo migration = createShiftUpMigration(PARTITION_ID_TO_MIGRATE, oldReplicaIndex, newReplicaIndex);
    migrateWithFailure(migration);
    assertMigrationSourceRollback(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 19 with MigrationInfo

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

the class MigrationPlannerTest method testCopyPrioritizationAgainstMove.

@Test
public void testCopyPrioritizationAgainstMove() throws UnknownHostException {
    List<MigrationInfo> migrations = new ArrayList<MigrationInfo>();
    final MigrationInfo migration1 = new MigrationInfo(0, null, null, new Address("localhost", 5701), "5701", -1, -1, -1, 0);
    final MigrationInfo migration2 = new MigrationInfo(0, null, null, new Address("localhost", 5702), "5702", -1, -1, -1, 1);
    final MigrationInfo migration3 = new MigrationInfo(0, new Address("localhost", 5703), "5703", new Address("localhost", 5704), "5704", 2, -1, -1, 2);
    final MigrationInfo migration4 = new MigrationInfo(0, new Address("localhost", 5705), "5705", new Address("localhost", 5706), "5706", 2, -1, -1, 3);
    final MigrationInfo migration5 = new MigrationInfo(0, null, null, new Address("localhost", 5707), "5707", -1, -1, -1, 4);
    migrations.add(migration1);
    migrations.add(migration2);
    migrations.add(migration3);
    migrations.add(migration4);
    migrations.add(migration5);
    migrationPlanner.prioritizeCopiesAndShiftUps(migrations);
    assertEquals(asList(migration1, migration2, migration5, migration3, migration4), migrations);
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) Address(com.hazelcast.nio.Address) ArrayList(java.util.ArrayList) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 20 with MigrationInfo

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

the class MigrationPlannerTest method testNoCopyPrioritizationAgainstCopy.

@Test
public void testNoCopyPrioritizationAgainstCopy() throws UnknownHostException {
    List<MigrationInfo> migrations = new ArrayList<MigrationInfo>();
    final MigrationInfo migration1 = new MigrationInfo(0, null, null, new Address("localhost", 5701), "5701", -1, -1, -1, 0);
    final MigrationInfo migration2 = new MigrationInfo(0, null, null, new Address("localhost", 5702), "5702", -1, -1, -1, 1);
    final MigrationInfo migration3 = new MigrationInfo(0, null, null, new Address("localhost", 5703), "5702", -1, -1, -1, 2);
    final MigrationInfo migration4 = new MigrationInfo(0, null, null, new Address("localhost", 5704), "5702", -1, -1, -1, 3);
    migrations.add(migration1);
    migrations.add(migration2);
    migrations.add(migration3);
    migrations.add(migration4);
    migrationPlanner.prioritizeCopiesAndShiftUps(migrations);
    assertEquals(asList(migration1, migration2, migration3, migration4), migrations);
}
Also used : MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) Address(com.hazelcast.nio.Address) ArrayList(java.util.ArrayList) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

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