Search in sources :

Example 51 with ILogger

use of com.hazelcast.logging.ILogger 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));
        }
    }
}
Also used : InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) PartitionReplicaManager(com.hazelcast.internal.partition.impl.PartitionReplicaManager) ILogger(com.hazelcast.logging.ILogger) MigrationEndpoint(com.hazelcast.spi.partition.MigrationEndpoint)

Example 52 with ILogger

use of com.hazelcast.logging.ILogger 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));
        }
    }
}
Also used : InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) PartitionReplicaManager(com.hazelcast.internal.partition.impl.PartitionReplicaManager) ILogger(com.hazelcast.logging.ILogger) MigrationEndpoint(com.hazelcast.spi.partition.MigrationEndpoint)

Example 53 with ILogger

use of com.hazelcast.logging.ILogger 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);
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) ILogger(com.hazelcast.logging.ILogger) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) OperationService(com.hazelcast.spi.OperationService)

Example 54 with ILogger

use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.

the class ReplicaSyncRequest method logNoReplicaDataFound.

private void logNoReplicaDataFound(int partitionId, int replicaIndex) {
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    ILogger logger = nodeEngine.getLogger(getClass());
    if (logger.isFinestEnabled()) {
        logger.finest("No replica data is found for partitionId=" + partitionId + ", replicaIndex=" + replicaIndex);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ILogger(com.hazelcast.logging.ILogger)

Example 55 with ILogger

use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.

the class ReplicaSyncRequest method sendResponse.

/** Send a synchronization response to the caller replica containing the replication operations to be executed */
private void sendResponse(List<Operation> data) throws IOException {
    NodeEngine nodeEngine = getNodeEngine();
    ReplicaSyncResponse syncResponse = createResponse(data);
    Address target = getCallerAddress();
    ILogger logger = getLogger();
    if (logger.isFinestEnabled()) {
        logger.finest("Sending sync response to -> " + target + " for partitionId=" + getPartitionId() + ", replicaIndex=" + getReplicaIndex());
    }
    OperationService operationService = nodeEngine.getOperationService();
    operationService.send(syncResponse, target);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Address(com.hazelcast.nio.Address) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.OperationService)

Aggregations

ILogger (com.hazelcast.logging.ILogger)76 Address (com.hazelcast.nio.Address)19 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)11 Node (com.hazelcast.instance.Node)10 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)10 NodeEngine (com.hazelcast.spi.NodeEngine)10 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)9 ReplicatedMapService (com.hazelcast.replicatedmap.impl.ReplicatedMapService)6 OperationService (com.hazelcast.spi.OperationService)6 IOException (java.io.IOException)4 Before (org.junit.Before)4 JsonObject (com.eclipsesource.json.JsonObject)3 ClientAwsConfig (com.hazelcast.client.config.ClientAwsConfig)3 Connection (com.hazelcast.nio.Connection)3 ReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore)3 Operation (com.hazelcast.spi.Operation)3 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)3 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)3 ClientNetworkConfig (com.hazelcast.client.config.ClientNetworkConfig)2 ClusterState (com.hazelcast.cluster.ClusterState)2