Search in sources :

Example 21 with MigrationInfo

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

the class MigrationPlannerTest method testShiftUpPrioritizationAgainstMove.

@Test
public void testShiftUpPrioritizationAgainstMove() 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", 5705), "5705", new Address("localhost", 5706), "5706", 2, -1, -1, 3);
    final MigrationInfo migration4 = new MigrationInfo(0, null, null, new Address("localhost", 5707), "5707", -1, -1, 4, 2);
    migrations.add(migration1);
    migrations.add(migration2);
    migrations.add(migration3);
    migrations.add(migration4);
    migrationPlanner.prioritizeCopiesAndShiftUps(migrations);
    assertEquals(asList(migration1, migration2, migration4, migration3), 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 22 with MigrationInfo

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

the class MigrationPlannerTest method testNoCopyPrioritizationAgainstShiftDownToHotterIndex.

@Test
public void testNoCopyPrioritizationAgainstShiftDownToHotterIndex() throws UnknownHostException {
    List<MigrationInfo> migrations = new ArrayList<MigrationInfo>();
    final MigrationInfo migration1 = new MigrationInfo(0, new Address("localhost", 5701), "5701", new Address("localhost", 5702), "5702", 0, 1, -1, 0);
    final MigrationInfo migration2 = new MigrationInfo(0, null, null, new Address("localhost", 5703), "5703", -1, -1, -1, 2);
    migrations.add(migration1);
    migrations.add(migration2);
    migrationPlanner.prioritizeCopiesAndShiftUps(migrations);
    assertEquals(asList(migration1, migration2), 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 23 with MigrationInfo

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

the class MigrationPlannerTest method testSingleMigrationPrioritization.

@Test
public void testSingleMigrationPrioritization() 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);
    migrations.add(migration1);
    migrationPlanner.prioritizeCopiesAndShiftUps(migrations);
    assertEquals(singletonList(migration1), 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 24 with MigrationInfo

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

the class MigrationPlannerTest method testCopyPrioritizationAgainstShiftDownToColderIndex.

@Test
public void testCopyPrioritizationAgainstShiftDownToColderIndex() throws UnknownHostException {
    List<MigrationInfo> migrations = new ArrayList<MigrationInfo>();
    final MigrationInfo migration1 = new MigrationInfo(0, new Address("localhost", 5701), "5701", new Address("localhost", 5702), "5702", 0, 2, -1, 0);
    final MigrationInfo migration2 = new MigrationInfo(0, null, null, new Address("localhost", 5703), "5703", -1, -1, -1, 1);
    migrations.add(migration1);
    migrations.add(migration2);
    migrationPlanner.prioritizeCopiesAndShiftUps(migrations);
    assertEquals(asList(migration2, migration1), 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 25 with MigrationInfo

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

the class MigrationCommitServiceTest method createShiftUpMigration.

private MigrationInfo createShiftUpMigration(int partitionId, int oldReplicaIndex, int newReplicaIndex) {
    InternalPartitionImpl partition = getPartition(instances[0], partitionId);
    Address source = partition.getReplicaAddress(newReplicaIndex);
    String sourceUuid = getMemberUuid(source);
    Address destination = partition.getReplicaAddress(oldReplicaIndex);
    String destinationUuid = getMemberUuid(destination);
    return new MigrationInfo(partitionId, source, sourceUuid, destination, destinationUuid, newReplicaIndex, -1, oldReplicaIndex, newReplicaIndex);
}
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