use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class MigrationCommitServiceTest method testSuccessfulMoveMigration.
private void testSuccessfulMoveMigration(int partitionId, int replicaIndexToClear, int replicaIndexToMigrate) throws Exception {
Address destination = clearReplicaIndex(partitionId, replicaIndexToClear);
MigrationInfo migration = createMoveMigration(partitionId, replicaIndexToMigrate, destination);
migrateWithSuccess(migration);
assertMigrationSourceCommit(migration);
assertMigrationDestinationCommit(migration);
assertPartitionDataAfterMigrations();
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class MigrationCommitServiceTest method createMoveMigration.
private MigrationInfo createMoveMigration(int partitionId, int replicaIndex, Address destination) {
InternalPartition partition = getPartition(instances[0], partitionId);
Address source = partition.getReplicaAddress(replicaIndex);
String sourceUuid = getMemberUuid(source);
String destinationUuid = getMemberUuid(destination);
return new MigrationInfo(partitionId, source, sourceUuid, destination, destinationUuid, replicaIndex, -1, -1, replicaIndex);
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class MigrationCommitServiceTest method testPartitionBackupShiftUpRollbackWithNullOwnerOfReplicaIndex.
@Test
public void testPartitionBackupShiftUpRollbackWithNullOwnerOfReplicaIndex() throws Exception {
int oldReplicaIndex = NODE_COUNT - 1, newReplicaIndex = NODE_COUNT - 2;
clearReplicaIndex(PARTITION_ID_TO_MIGRATE, newReplicaIndex);
MigrationInfo migration = createShiftUpMigration(PARTITION_ID_TO_MIGRATE, oldReplicaIndex, newReplicaIndex);
migrateWithFailure(migration);
assertMigrationDestinationRollback(migration);
assertPartitionDataAfterMigrations();
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class BaseMigrationOperation method setActiveMigration.
void setActiveMigration() {
InternalPartitionServiceImpl partitionService = getService();
MigrationManager migrationManager = partitionService.getMigrationManager();
MigrationInfo currentActiveMigration = migrationManager.setActiveMigration(migrationInfo);
if (currentActiveMigration != null) {
throw new RetryableHazelcastException("Cannot set active migration to " + migrationInfo + ". Current active migration is " + currentActiveMigration);
}
PartitionStateManager partitionStateManager = partitionService.getPartitionStateManager();
partitionStateManager.setMigratingFlag(migrationInfo.getPartitionId());
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class PromotionCommitOperation method finalizePromotion.
private void finalizePromotion() {
NodeEngine nodeEngine = getNodeEngine();
InternalPartitionServiceImpl partitionService = getService();
OperationService operationService = nodeEngine.getOperationService();
partitionState.setEndpoint(getCallerAddress());
success = partitionService.processPartitionRuntimeState(partitionState);
ILogger logger = getLogger();
if (logger.isFineEnabled()) {
logger.fine("Submitting FinalizePromotionOperations for " + promotions.size() + " promotions. Result: " + success);
}
for (MigrationInfo promotion : promotions) {
if (logger.isFinestEnabled()) {
logger.finest("Submitting FinalizePromotionOperation for promotion: " + promotion + ". Result: " + success);
}
int currentReplicaIndex = promotion.getDestinationCurrentReplicaIndex();
FinalizePromotionOperation op = new FinalizePromotionOperation(currentReplicaIndex, success);
op.setPartitionId(promotion.getPartitionId()).setNodeEngine(nodeEngine).setService(partitionService);
operationService.execute(op);
}
}
Aggregations