use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class BeforePromotionOperation method beforeRun.
@Override
public void beforeRun() throws Exception {
sendMigrationEvent(STARTED);
InternalPartitionServiceImpl service = getService();
PartitionStateManager partitionStateManager = service.getPartitionStateManager();
partitionStateManager.setMigratingFlag(getPartitionId());
}
use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class CheckReplicaVersion method run.
@Override
public void run() throws Exception {
InternalPartitionServiceImpl partitionService = getService();
int partitionId = getPartitionId();
int replicaIndex = getReplicaIndex();
PartitionReplicaManager replicaManager = partitionService.getReplicaManager();
long[] currentVersions = replicaManager.getPartitionReplicaVersions(partitionId);
long currentVersion = currentVersions[replicaIndex - 1];
if (replicaManager.isPartitionReplicaVersionDirty(partitionId) || currentVersion != version) {
logBackupVersionMismatch(currentVersion);
replicaManager.triggerPartitionReplicaSync(partitionId, replicaIndex, 0L);
response = false;
} else {
response = true;
}
}
use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class FetchPartitionStateOperation method run.
@Override
public void run() {
final Address caller = getCallerAddress();
final Address master = getNodeEngine().getMasterAddress();
if (!caller.equals(master)) {
final String msg = caller + " requested our partition table but it's not our known master. " + "Master: " + master;
getLogger().warning(msg);
throw new RetryableHazelcastException(msg);
}
InternalPartitionServiceImpl service = getService();
partitionState = service.createPartitionStateInternal();
}
use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class FinalizeMigrationOperation method rollbackDestination.
private void rollbackDestination() {
int partitionId = getPartitionId();
InternalPartitionServiceImpl partitionService = getService();
PartitionReplicaManager replicaManager = partitionService.getReplicaManager();
ILogger logger = getLogger();
int destinationCurrentReplicaIndex = migrationInfo.getDestinationCurrentReplicaIndex();
if (destinationCurrentReplicaIndex == -1) {
replicaManager.clearPartitionReplicaVersions(partitionId);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are cleared in destination after failed migration. partitionId=" + partitionId);
}
} else {
int replicaOffset = migrationInfo.getDestinationCurrentReplicaIndex() <= 1 ? 1 : migrationInfo.getDestinationCurrentReplicaIndex();
long[] versions = updatePartitionReplicaVersions(replicaManager, partitionId, replicaOffset - 1);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are rolled back in destination after failed migration. partitionId=" + partitionId + " replica versions=" + Arrays.toString(versions));
}
}
}
use of com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl in project hazelcast by hazelcast.
the class FinalizeMigrationOperation method commitSource.
private void commitSource() {
int partitionId = getPartitionId();
InternalPartitionServiceImpl partitionService = getService();
PartitionReplicaManager replicaManager = partitionService.getReplicaManager();
ILogger logger = getLogger();
int sourceNewReplicaIndex = migrationInfo.getSourceNewReplicaIndex();
if (sourceNewReplicaIndex < 0) {
replicaManager.clearPartitionReplicaVersions(partitionId);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are cleared in source after migration. partitionId=" + partitionId);
}
} else if (migrationInfo.getSourceCurrentReplicaIndex() != sourceNewReplicaIndex && sourceNewReplicaIndex > 1) {
long[] versions = updatePartitionReplicaVersions(replicaManager, partitionId, sourceNewReplicaIndex - 1);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are set after SHIFT DOWN migration. partitionId=" + partitionId + " replica versions=" + Arrays.toString(versions));
}
}
}
Aggregations