use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class ReplicaSyncRequest method run.
@Override
public void run() throws Exception {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
InternalPartitionServiceImpl partitionService = (InternalPartitionServiceImpl) nodeEngine.getPartitionService();
int partitionId = getPartitionId();
int replicaIndex = getReplicaIndex();
if (!partitionService.isReplicaSyncAllowed()) {
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
logger.finest("Migration is paused! Cannot run replica sync -> " + toString());
}
sendRetryResponse();
return;
}
if (!preCheckReplicaSync(nodeEngine, partitionId, replicaIndex)) {
return;
}
try {
List<Operation> tasks = createReplicationOperations();
if (tasks.isEmpty()) {
logNoReplicaDataFound(partitionId, replicaIndex);
sendEmptyResponse();
} else {
sendResponse(tasks);
}
} finally {
partitionService.getReplicaManager().releaseReplicaSyncPermit();
}
}
use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class MigrationCommitOperation method run.
@Override
public void run() {
NodeEngine nodeEngine = getNodeEngine();
final Member localMember = nodeEngine.getLocalMember();
if (!localMember.getUuid().equals(expectedMemberUuid)) {
throw new IllegalStateException("This " + localMember + " is migration commit destination but most probably it's restarted " + "and not the expected target.");
}
partitionState.setEndpoint(getCallerAddress());
InternalPartitionServiceImpl partitionService = getService();
success = partitionService.processPartitionRuntimeState(partitionState);
}
use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class MigrationRequestOperation method invokeMigrationOperation.
private void invokeMigrationOperation(Address destination, long[] replicaVersions, Collection<Operation> tasks) throws IOException {
MigrationOperation operation = new MigrationOperation(migrationInfo, replicaVersions, tasks, partitionStateVersion);
NodeEngine nodeEngine = getNodeEngine();
InternalPartitionServiceImpl partitionService = getService();
nodeEngine.getOperationService().createInvocationBuilder(InternalPartitionService.SERVICE_NAME, operation, destination).setExecutionCallback(new MigrationCallback(migrationInfo, this)).setResultDeserialized(true).setCallTimeout(partitionService.getPartitionMigrationTimeout()).setTryCount(InternalPartitionService.MIGRATION_RETRY_COUNT).setTryPauseMillis(InternalPartitionService.MIGRATION_RETRY_PAUSE).setReplicaIndex(getReplicaIndex()).invoke();
}
use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class MigrationRequestOperation method run.
@Override
public void run() {
NodeEngine nodeEngine = getNodeEngine();
verifyGoodMaster(nodeEngine);
Address source = migrationInfo.getSource();
Address destination = migrationInfo.getDestination();
verifyExistingTarget(nodeEngine, destination);
if (destination.equals(source)) {
getLogger().warning("Source and destination addresses are the same! => " + toString());
setFailed();
return;
}
InternalPartition partition = getPartition();
verifySource(nodeEngine.getThisAddress(), partition);
setActiveMigration();
if (!migrationInfo.startProcessing()) {
getLogger().warning("Migration is cancelled -> " + migrationInfo);
setFailed();
return;
}
try {
executeBeforeMigrations();
Collection<Operation> tasks = prepareMigrationOperations();
InternalPartitionServiceImpl partitionService = getService();
long[] replicaVersions = partitionService.getPartitionReplicaVersions(migrationInfo.getPartitionId());
invokeMigrationOperation(destination, replicaVersions, tasks);
returnResponse = false;
} catch (Throwable e) {
logThrowable(e);
setFailed();
} finally {
migrationInfo.doneProcessing();
}
}
use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class FinalizeMigrationOperation method run.
@Override
public void run() {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
notifyServices(nodeEngine);
if (endpoint == MigrationEndpoint.SOURCE && success) {
commitSource();
} else if (endpoint == MigrationEndpoint.DESTINATION && !success) {
rollbackDestination();
}
InternalPartitionServiceImpl partitionService = getService();
PartitionStateManager partitionStateManager = partitionService.getPartitionStateManager();
partitionStateManager.clearMigratingFlag(migrationInfo.getPartitionId());
if (success) {
nodeEngine.onPartitionMigrate(migrationInfo);
}
}
Aggregations