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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations