use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class PromotionCommitOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
expectedMemberUuid = in.readUTF();
partitionState = new PartitionRuntimeState();
partitionState.readData(in);
int len = in.readInt();
if (len > 0) {
promotions = new ArrayList<MigrationInfo>(len);
for (int i = 0; i < len; i++) {
MigrationInfo migrationInfo = new MigrationInfo();
migrationInfo.readData(in);
promotions.add(migrationInfo);
}
}
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class InternalPartitionServiceImpl method createPromotionCommitPartitionState.
/**
* Creates a transient PartitionRuntimeState to commit promotions.
* Results of promotions are applied to partition table.
* Version of created partition table is incremented by number of promotions.
*/
PartitionRuntimeState createPromotionCommitPartitionState(Collection<MigrationInfo> migrationInfos) {
lock.lock();
try {
if (!partitionStateManager.isInitialized()) {
return null;
}
List<MigrationInfo> completedMigrations = migrationManager.getCompletedMigrationsCopy();
InternalPartition[] partitions = partitionStateManager.getPartitionsCopy();
for (MigrationInfo migrationInfo : migrationInfos) {
int partitionId = migrationInfo.getPartitionId();
InternalPartitionImpl partition = (InternalPartitionImpl) partitions[partitionId];
migrationManager.applyMigration(partition, migrationInfo);
migrationInfo.setStatus(MigrationStatus.SUCCESS);
}
int committedVersion = getPartitionStateVersion() + migrationInfos.size();
return new PartitionRuntimeState(partitions, completedMigrations, committedVersion);
} finally {
lock.unlock();
}
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class MigrationManager method scheduleActiveMigrationFinalization.
void scheduleActiveMigrationFinalization(final MigrationInfo migrationInfo) {
partitionServiceLock.lock();
try {
final MigrationInfo activeMigrationInfo = this.activeMigrationInfo;
if (activeMigrationInfo != null && migrationInfo.equals(activeMigrationInfo)) {
if (activeMigrationInfo.startProcessing()) {
activeMigrationInfo.setStatus(migrationInfo.getStatus());
finalizeMigration(activeMigrationInfo);
} else {
logger.info("Scheduling finalization of " + migrationInfo + ", because migration process is currently running.");
nodeEngine.getExecutionService().schedule(new Runnable() {
@Override
public void run() {
scheduleActiveMigrationFinalization(migrationInfo);
}
}, 3, TimeUnit.SECONDS);
}
return;
}
if (migrationInfo.getSourceCurrentReplicaIndex() > 0 && node.getThisAddress().equals(migrationInfo.getSource())) {
// OLD BACKUP
finalizeMigration(migrationInfo);
return;
}
} finally {
partitionServiceLock.unlock();
}
}
use of com.hazelcast.internal.partition.MigrationInfo in project hazelcast by hazelcast.
the class MigrationManager method onMemberRemove.
void onMemberRemove(MemberImpl member) {
Address deadAddress = member.getAddress();
shutdownRequestedAddresses.remove(deadAddress);
final MigrationInfo activeMigration = activeMigrationInfo;
if (activeMigration != null) {
if (deadAddress.equals(activeMigration.getSource()) || deadAddress.equals(activeMigration.getDestination())) {
activeMigration.setStatus(MigrationStatus.INVALID);
}
}
}
Aggregations