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