use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class InternalPartitionServiceImpl method updatePartitionsAndFinalizeMigrations.
private void updatePartitionsAndFinalizeMigrations(PartitionRuntimeState partitionState) {
final Address[][] partitionTable = partitionState.getPartitionTable();
updateAllPartitions(partitionTable);
partitionStateManager.setVersion(partitionState.getVersion());
Collection<MigrationInfo> completedMigrations = partitionState.getCompletedMigrations();
for (MigrationInfo completedMigration : completedMigrations) {
assert completedMigration.getStatus() == MigrationStatus.SUCCESS || completedMigration.getStatus() == MigrationStatus.FAILED : "Invalid migration: " + completedMigration;
if (migrationManager.addCompletedMigration(completedMigration)) {
migrationManager.scheduleActiveMigrationFinalization(completedMigration);
}
}
if (!partitionStateManager.setInitialized()) {
node.getNodeExtension().onPartitionStateChange();
}
migrationManager.retainCompletedMigrations(completedMigrations);
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class PromotionCommitOperation method beforePromotion.
private void beforePromotion() {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
InternalOperationService operationService = nodeEngine.getOperationService();
InternalPartitionServiceImpl partitionService = getService();
ILogger logger = getLogger();
if (logger.isFineEnabled()) {
logger.fine("Submitting BeforePromotionOperations for " + promotions.size() + " promotions.");
}
Runnable beforePromotionsCallback = new BeforePromotionOperationCallback(this, new AtomicInteger(promotions.size()));
for (MigrationInfo promotion : promotions) {
if (logger.isFinestEnabled()) {
logger.finest("Submitting BeforePromotionOperation for promotion: " + promotion);
}
int currentReplicaIndex = promotion.getDestinationCurrentReplicaIndex();
BeforePromotionOperation op = new BeforePromotionOperation(currentReplicaIndex, beforePromotionsCallback);
op.setPartitionId(promotion.getPartitionId()).setNodeEngine(nodeEngine).setService(partitionService);
operationService.execute(op);
}
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class PromotionCommitOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeUTF(expectedMemberUuid);
partitionState.writeData(out);
int len = promotions.size();
out.writeInt(len);
for (MigrationInfo migrationInfo : promotions) {
migrationInfo.writeData(out);
}
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class BaseMigrationOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
migrationInfo = new MigrationInfo();
migrationInfo.readData(in);
partitionStateVersion = in.readInt();
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class MigrationCommitServiceTest method testFailedShiftDownMigration.
private void testFailedShiftDownMigration(int partitionId, int replicaIndexToClear, int oldReplicaIndex, int newReplicaIndex) throws Exception {
Address destination = clearReplicaIndex(partitionId, replicaIndexToClear);
MigrationInfo migration = createShiftDownMigration(partitionId, oldReplicaIndex, newReplicaIndex, destination);
migrateWithFailure(migration);
assertMigrationSourceRollback(migration);
assertMigrationDestinationRollback(migration);
assertPartitionDataAfterMigrations();
}
Aggregations