Search in sources :

Example 1 with PutOperationContext

use of org.apache.geode.cache.operations.PutOperationContext in project geode by apache.

the class GatewayReceiverCommand method cmdExecute.

@Override
public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException, InterruptedException {
    Part regionNamePart = null, keyPart = null, valuePart = null, callbackArgPart = null;
    String regionName = null;
    Object callbackArg = null, key = null;
    int partNumber = 0;
    CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
    GatewayReceiverStats stats = (GatewayReceiverStats) serverConnection.getCacheServerStats();
    EventID eventId = null;
    LocalRegion region = null;
    List<BatchException70> exceptions = new ArrayList<BatchException70>();
    Throwable fatalException = null;
    // requiresResponse = true;// let PROCESS_BATCH deal with this itself
    {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incReadProcessBatchRequestTime(start - oldStart);
    }
    Part callbackArgExistsPart;
    // Get early ack flag. This test should eventually be moved up above this switch
    // statement so that all messages can take advantage of it.
    // msg.getEarlyAck();
    boolean earlyAck = false;
    stats.incBatchSize(clientMessage.getPayloadLength());
    // Retrieve the number of events
    Part numberOfEventsPart = clientMessage.getPart(0);
    int numberOfEvents = numberOfEventsPart.getInt();
    stats.incEventsReceived(numberOfEvents);
    // Retrieve the batch id
    Part batchIdPart = clientMessage.getPart(1);
    int batchId = batchIdPart.getInt();
    // Instead, drop the batch and continue.
    if (batchId <= serverConnection.getLatestBatchIdReplied()) {
        if (GatewayReceiver.APPLY_RETRIES) {
            // Do nothing!!!
            logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_RECEIVED_PROCESS_BATCH_REQUEST_0_THAT_HAS_ALREADY_BEEN_OR_IS_BEING_PROCESSED_GEMFIRE_GATEWAY_APPLYRETRIES_IS_SET_SO_THIS_BATCH_WILL_BE_PROCESSED_ANYWAY, batchId));
        } else {
            logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_RECEIVED_PROCESS_BATCH_REQUEST_0_THAT_HAS_ALREADY_BEEN_OR_IS_BEING_PROCESSED__THIS_PROCESS_BATCH_REQUEST_IS_BEING_IGNORED, batchId));
            writeReply(clientMessage, serverConnection, batchId, numberOfEvents);
            return;
        }
        stats.incDuplicateBatchesReceived();
    }
    // Verify the batches arrive in order
    if (batchId != serverConnection.getLatestBatchIdReplied() + 1) {
        logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_RECEIVED_PROCESS_BATCH_REQUEST_0_OUT_OF_ORDER_THE_ID_OF_THE_LAST_BATCH_PROCESSED_WAS_1_THIS_BATCH_REQUEST_WILL_BE_PROCESSED_BUT_SOME_MESSAGES_MAY_HAVE_BEEN_LOST, new Object[] { batchId, serverConnection.getLatestBatchIdReplied() }));
        stats.incOutoforderBatchesReceived();
    }
    if (logger.isDebugEnabled()) {
        logger.debug("Received process batch request {} that will be processed.", batchId);
    }
    // Not sure if earlyAck makes sense with sliding window
    if (earlyAck) {
        serverConnection.incrementLatestBatchIdReplied(batchId);
        // writeReply(msg, servConn);
        // servConn.setAsTrue(RESPONDED);
        {
            long oldStart = start;
            start = DistributionStats.getStatTime();
            stats.incWriteProcessBatchResponseTime(start - oldStart);
        }
        stats.incEarlyAcks();
    }
    if (logger.isDebugEnabled()) {
        logger.debug("{}: Received process batch request {} containing {} events ({} bytes) with {} acknowledgement on {}", serverConnection.getName(), batchId, numberOfEvents, clientMessage.getPayloadLength(), (earlyAck ? "early" : "normal"), serverConnection.getSocketString());
        if (earlyAck) {
            logger.debug("{}: Sent process batch early response for batch {} containing {} events ({} bytes) with {} acknowledgement on {}", serverConnection.getName(), batchId, numberOfEvents, clientMessage.getPayloadLength(), (earlyAck ? "early" : "normal"), serverConnection.getSocketString());
        }
    }
    // logger.warn("Received process batch request " + batchId + " containing
    // " + numberOfEvents + " events (" + msg.getPayloadLength() + " bytes) with
    // " + (earlyAck ? "early" : "normal") + " acknowledgement on " +
    // getSocketString());
    // if (earlyAck) {
    // logger.warn("Sent process batch early response for batch " + batchId +
    // " containing " + numberOfEvents + " events (" + msg.getPayloadLength() +
    // " bytes) with " + (earlyAck ? "early" : "normal") + " acknowledgement on
    // " + getSocketString());
    // }
    // Retrieve the events from the message parts. The '2' below
    // represents the number of events (part0) and the batchId (part1)
    partNumber = 2;
    int dsid = clientMessage.getPart(partNumber++).getInt();
    boolean removeOnException = clientMessage.getPart(partNumber++).getSerializedForm()[0] == 1 ? true : false;
    // Keep track of whether a response has been written for
    // exceptions
    boolean wroteResponse = earlyAck;
    // event received in batch also have PDX events at the start of the batch,to
    // represent correct index on which the exception occurred, number of PDX
    // events need to be subtratced.
    //
    int indexWithoutPDXEvent = -1;
    for (int i = 0; i < numberOfEvents; i++) {
        boolean isPdxEvent = false;
        indexWithoutPDXEvent++;
        // System.out.println("Processing event " + i + " in batch " + batchId + "
        // starting with part number " + partNumber);
        Part actionTypePart = clientMessage.getPart(partNumber);
        int actionType = actionTypePart.getInt();
        long versionTimeStamp = VersionTag.ILLEGAL_VERSION_TIMESTAMP;
        EventIDHolder clientEvent = null;
        boolean callbackArgExists = false;
        try {
            Part possibleDuplicatePart = clientMessage.getPart(partNumber + 1);
            byte[] possibleDuplicatePartBytes;
            try {
                possibleDuplicatePartBytes = (byte[]) possibleDuplicatePart.getObject();
            } catch (Exception e) {
                logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_REQUEST_1_CONTAINING_2_EVENTS, new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) }), e);
                throw e;
            }
            boolean possibleDuplicate = possibleDuplicatePartBytes[0] == 0x01;
            // Make sure instance variables are null before each iteration
            regionName = null;
            key = null;
            callbackArg = null;
            // Retrieve the region name from the message parts
            regionNamePart = clientMessage.getPart(partNumber + 2);
            regionName = regionNamePart.getString();
            if (regionName.equals(PeerTypeRegistration.REGION_FULL_PATH)) {
                indexWithoutPDXEvent--;
                isPdxEvent = true;
            }
            // Retrieve the event id from the message parts
            // This was going to be used to determine possible
            // duplication of events, but it is unused now. In
            // fact the event id is overridden by the FROM_GATEWAY
            // token.
            Part eventIdPart = clientMessage.getPart(partNumber + 3);
            eventIdPart.setVersion(serverConnection.getClientVersion());
            // String eventId = eventIdPart.getString();
            try {
                eventId = (EventID) eventIdPart.getObject();
            } catch (Exception e) {
                logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_REQUEST_1_CONTAINING_2_EVENTS, new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) }), e);
                throw e;
            }
            // Retrieve the key from the message parts
            keyPart = clientMessage.getPart(partNumber + 4);
            try {
                key = keyPart.getStringOrObject();
            } catch (Exception e) {
                logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_REQUEST_1_CONTAINING_2_EVENTS, new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) }), e);
                throw e;
            }
            switch(actionType) {
                case // Create
                0:
                    /*
             * CLIENT EXCEPTION HANDLING TESTING CODE String keySt = (String) key;
             * System.out.println("Processing new key: " + key); if (keySt.startsWith("failure")) {
             * throw new Exception(LocalizedStrings
             * .ProcessBatch_THIS_EXCEPTION_REPRESENTS_A_FAILURE_ON_THE_SERVER
             * .toLocalizedString()); }
             */
                    // Retrieve the value from the message parts (do not deserialize it)
                    valuePart = clientMessage.getPart(partNumber + 5);
                    // try {
                    // logger.warn(getName() + ": Creating key " + key + " value " +
                    // valuePart.getObject());
                    // } catch (Exception e) {}
                    // Retrieve the callbackArg from the message parts if necessary
                    int index = partNumber + 6;
                    callbackArgExistsPart = clientMessage.getPart(index++);
                    {
                        byte[] partBytes = (byte[]) callbackArgExistsPart.getObject();
                        callbackArgExists = partBytes[0] == 0x01;
                    }
                    if (callbackArgExists) {
                        callbackArgPart = clientMessage.getPart(index++);
                        try {
                            callbackArg = callbackArgPart.getObject();
                        } catch (Exception e) {
                            logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_CREATE_REQUEST_1_FOR_2_EVENTS, new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) }), e);
                            throw e;
                        }
                    }
                    if (logger.isDebugEnabled()) {
                        logger.debug("{}: Processing batch create request {} on {} for region {} key {} value {} callbackArg {}, eventId={}", serverConnection.getName(), batchId, serverConnection.getSocketString(), regionName, key, valuePart, callbackArg, eventId);
                    }
                    versionTimeStamp = clientMessage.getPart(index++).getLong();
                    // Process the create request
                    if (key == null || regionName == null) {
                        StringId message = null;
                        Object[] messageArgs = new Object[] { serverConnection.getName(), Integer.valueOf(batchId) };
                        if (key == null) {
                            message = LocalizedStrings.ProcessBatch_0_THE_INPUT_REGION_NAME_FOR_THE_BATCH_CREATE_REQUEST_1_IS_NULL;
                        }
                        if (regionName == null) {
                            message = LocalizedStrings.ProcessBatch_0_THE_INPUT_REGION_NAME_FOR_THE_BATCH_CREATE_REQUEST_1_IS_NULL;
                        }
                        String s = message.toLocalizedString(messageArgs);
                        logger.warn(s);
                        throw new Exception(s);
                    }
                    region = (LocalRegion) crHelper.getRegion(regionName);
                    if (region == null) {
                        handleRegionNull(serverConnection, regionName, batchId);
                    } else {
                        clientEvent = new EventIDHolder(eventId);
                        if (versionTimeStamp > 0) {
                            VersionTag tag = VersionTag.create(region.getVersionMember());
                            tag.setIsGatewayTag(true);
                            tag.setVersionTimeStamp(versionTimeStamp);
                            tag.setDistributedSystemId(dsid);
                            clientEvent.setVersionTag(tag);
                        }
                        clientEvent.setPossibleDuplicate(possibleDuplicate);
                        handleMessageRetry(region, clientEvent);
                        try {
                            byte[] value = valuePart.getSerializedForm();
                            boolean isObject = valuePart.isObject();
                            // [sumedh] This should be done on client while sending
                            // since that is the WAN gateway
                            AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
                            if (authzRequest != null) {
                                PutOperationContext putContext = authzRequest.putAuthorize(regionName, key, value, isObject, callbackArg);
                                value = putContext.getSerializedValue();
                                isObject = putContext.isObject();
                            }
                            // Attempt to create the entry
                            boolean result = false;
                            if (isPdxEvent) {
                                result = addPdxType(crHelper, key, value);
                            } else {
                                result = region.basicBridgeCreate(key, value, isObject, callbackArg, serverConnection.getProxyID(), false, clientEvent, false);
                                // attempt to update the entry
                                if (!result) {
                                    result = region.basicBridgePut(key, value, null, isObject, callbackArg, serverConnection.getProxyID(), false, clientEvent);
                                }
                            }
                            if (result || clientEvent.isConcurrencyConflict()) {
                                serverConnection.setModificationInfo(true, regionName, key);
                                stats.incCreateRequest();
                            } else {
                                // This exception will be logged in the catch block below
                                throw new Exception(LocalizedStrings.ProcessBatch_0_FAILED_TO_CREATE_OR_UPDATE_ENTRY_FOR_REGION_1_KEY_2_VALUE_3_CALLBACKARG_4.toLocalizedString(new Object[] { serverConnection.getName(), regionName, key, valuePart, callbackArg }));
                            }
                        } catch (Exception e) {
                            logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_CREATE_REQUEST_1_FOR_2_EVENTS, new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) }), e);
                            throw e;
                        }
                    }
                    break;
                case // Update
                1:
                    /*
             * CLIENT EXCEPTION HANDLING TESTING CODE keySt = (String) key;
             * System.out.println("Processing updated key: " + key); if
             * (keySt.startsWith("failure")) { throw new Exception(LocalizedStrings
             * .ProcessBatch_THIS_EXCEPTION_REPRESENTS_A_FAILURE_ON_THE_SERVER
             * .toLocalizedString()); }
             */
                    // Retrieve the value from the message parts (do not deserialize it)
                    valuePart = clientMessage.getPart(partNumber + 5);
                    // try {
                    // logger.warn(getName() + ": Updating key " + key + " value " +
                    // valuePart.getObject());
                    // } catch (Exception e) {}
                    // Retrieve the callbackArg from the message parts if necessary
                    index = partNumber + 6;
                    callbackArgExistsPart = clientMessage.getPart(index++);
                    {
                        byte[] partBytes = (byte[]) callbackArgExistsPart.getObject();
                        callbackArgExists = partBytes[0] == 0x01;
                    }
                    if (callbackArgExists) {
                        callbackArgPart = clientMessage.getPart(index++);
                        try {
                            callbackArg = callbackArgPart.getObject();
                        } catch (Exception e) {
                            logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_UPDATE_REQUEST_1_CONTAINING_2_EVENTS, new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) }), e);
                            throw e;
                        }
                    }
                    versionTimeStamp = clientMessage.getPart(index++).getLong();
                    if (logger.isDebugEnabled()) {
                        logger.debug("{}: Processing batch update request {} on {} for region {} key {} value {} callbackArg {}", serverConnection.getName(), batchId, serverConnection.getSocketString(), regionName, key, valuePart, callbackArg);
                    }
                    // Process the update request
                    if (key == null || regionName == null) {
                        StringId message = null;
                        Object[] messageArgs = new Object[] { serverConnection.getName(), Integer.valueOf(batchId) };
                        if (key == null) {
                            message = LocalizedStrings.ProcessBatch_0_THE_INPUT_KEY_FOR_THE_BATCH_UPDATE_REQUEST_1_IS_NULL;
                        }
                        if (regionName == null) {
                            message = LocalizedStrings.ProcessBatch_0_THE_INPUT_REGION_NAME_FOR_THE_BATCH_UPDATE_REQUEST_1_IS_NULL;
                        }
                        String s = message.toLocalizedString(messageArgs);
                        logger.warn(s);
                        throw new Exception(s);
                    }
                    region = (LocalRegion) crHelper.getRegion(regionName);
                    if (region == null) {
                        handleRegionNull(serverConnection, regionName, batchId);
                    } else {
                        clientEvent = new EventIDHolder(eventId);
                        if (versionTimeStamp > 0) {
                            VersionTag tag = VersionTag.create(region.getVersionMember());
                            tag.setIsGatewayTag(true);
                            tag.setVersionTimeStamp(versionTimeStamp);
                            tag.setDistributedSystemId(dsid);
                            clientEvent.setVersionTag(tag);
                        }
                        clientEvent.setPossibleDuplicate(possibleDuplicate);
                        handleMessageRetry(region, clientEvent);
                        try {
                            byte[] value = valuePart.getSerializedForm();
                            boolean isObject = valuePart.isObject();
                            AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
                            if (authzRequest != null) {
                                PutOperationContext putContext = authzRequest.putAuthorize(regionName, key, value, isObject, callbackArg, PutOperationContext.UPDATE);
                                value = putContext.getSerializedValue();
                                isObject = putContext.isObject();
                            }
                            boolean result = false;
                            if (isPdxEvent) {
                                result = addPdxType(crHelper, key, value);
                            } else {
                                result = region.basicBridgePut(key, value, null, isObject, callbackArg, serverConnection.getProxyID(), false, clientEvent);
                            }
                            if (result || clientEvent.isConcurrencyConflict()) {
                                serverConnection.setModificationInfo(true, regionName, key);
                                stats.incUpdateRequest();
                            } else {
                                final Object[] msgArgs = new Object[] { serverConnection.getName(), regionName, key, valuePart, callbackArg };
                                final StringId message = LocalizedStrings.ProcessBatch_0_FAILED_TO_UPDATE_ENTRY_FOR_REGION_1_KEY_2_VALUE_3_AND_CALLBACKARG_4;
                                String s = message.toLocalizedString(msgArgs);
                                logger.info(s);
                                throw new Exception(s);
                            }
                        } catch (CancelException e) {
                            // FIXME better exception hierarchy would avoid this check
                            if (serverConnection.getCachedRegionHelper().getCache().getCancelCriterion().isCancelInProgress()) {
                                if (logger.isDebugEnabled()) {
                                    logger.debug("{} ignoring message of type {} from client {} because shutdown occurred during message processing.", serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()), serverConnection.getProxyID());
                                }
                                serverConnection.setFlagProcessMessagesAsFalse();
                                serverConnection.setClientDisconnectedException(e);
                            } else {
                                throw e;
                            }
                            return;
                        } catch (Exception e) {
                            // Preserve the connection under all circumstances
                            logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_UPDATE_REQUEST_1_CONTAINING_2_EVENTS, new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) }), e);
                            throw e;
                        }
                    }
                    break;
                case // Destroy
                2:
                    // Retrieve the callbackArg from the message parts if necessary
                    index = partNumber + 5;
                    callbackArgExistsPart = clientMessage.getPart(index++);
                    {
                        byte[] partBytes = (byte[]) callbackArgExistsPart.getObject();
                        callbackArgExists = partBytes[0] == 0x01;
                    }
                    if (callbackArgExists) {
                        callbackArgPart = clientMessage.getPart(index++);
                        try {
                            callbackArg = callbackArgPart.getObject();
                        } catch (Exception e) {
                            logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_DESTROY_REQUEST_1_CONTAINING_2_EVENTS, new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) }), e);
                            throw e;
                        }
                    }
                    versionTimeStamp = clientMessage.getPart(index++).getLong();
                    if (logger.isDebugEnabled()) {
                        logger.debug("{}: Processing batch destroy request {} on {} for region {} key {}", serverConnection.getName(), batchId, serverConnection.getSocketString(), regionName, key);
                    }
                    // Process the destroy request
                    if (key == null || regionName == null) {
                        StringId message = null;
                        if (key == null) {
                            message = LocalizedStrings.ProcessBatch_0_THE_INPUT_KEY_FOR_THE_BATCH_DESTROY_REQUEST_1_IS_NULL;
                        }
                        if (regionName == null) {
                            message = LocalizedStrings.ProcessBatch_0_THE_INPUT_REGION_NAME_FOR_THE_BATCH_DESTROY_REQUEST_1_IS_NULL;
                        }
                        Object[] messageArgs = new Object[] { serverConnection.getName(), Integer.valueOf(batchId) };
                        String s = message.toLocalizedString(messageArgs);
                        logger.warn(s);
                        throw new Exception(s);
                    }
                    region = (LocalRegion) crHelper.getRegion(regionName);
                    if (region == null) {
                        handleRegionNull(serverConnection, regionName, batchId);
                    } else {
                        clientEvent = new EventIDHolder(eventId);
                        if (versionTimeStamp > 0) {
                            VersionTag tag = VersionTag.create(region.getVersionMember());
                            tag.setIsGatewayTag(true);
                            tag.setVersionTimeStamp(versionTimeStamp);
                            tag.setDistributedSystemId(dsid);
                            clientEvent.setVersionTag(tag);
                        }
                        handleMessageRetry(region, clientEvent);
                        // Destroy the entry
                        try {
                            AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
                            if (authzRequest != null) {
                                DestroyOperationContext destroyContext = authzRequest.destroyAuthorize(regionName, key, callbackArg);
                                callbackArg = destroyContext.getCallbackArg();
                            }
                            region.basicBridgeDestroy(key, callbackArg, serverConnection.getProxyID(), false, clientEvent);
                            serverConnection.setModificationInfo(true, regionName, key);
                            stats.incDestroyRequest();
                        } catch (EntryNotFoundException e) {
                            logger.info(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_DURING_BATCH_DESTROY_NO_ENTRY_WAS_FOUND_FOR_KEY_1, new Object[] { serverConnection.getName(), key }));
                        // throw new Exception(e);
                        }
                    }
                    break;
                case // Update Time-stamp for a RegionEntry
                3:
                    try {
                        // Region name
                        regionNamePart = clientMessage.getPart(partNumber + 2);
                        regionName = regionNamePart.getString();
                        // Retrieve the event id from the message parts
                        eventIdPart = clientMessage.getPart(partNumber + 3);
                        eventId = (EventID) eventIdPart.getObject();
                        // Retrieve the key from the message parts
                        keyPart = clientMessage.getPart(partNumber + 4);
                        key = keyPart.getStringOrObject();
                        // Retrieve the callbackArg from the message parts if necessary
                        index = partNumber + 5;
                        callbackArgExistsPart = clientMessage.getPart(index++);
                        byte[] partBytes = (byte[]) callbackArgExistsPart.getObject();
                        callbackArgExists = partBytes[0] == 0x01;
                        if (callbackArgExists) {
                            callbackArgPart = clientMessage.getPart(index++);
                            callbackArg = callbackArgPart.getObject();
                        }
                    } catch (Exception e) {
                        logger.warn(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_UPDATE_VERSION_REQUEST_1_CONTAINING_2_EVENTS, new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) }), e);
                        throw e;
                    }
                    versionTimeStamp = clientMessage.getPart(index++).getLong();
                    if (logger.isDebugEnabled()) {
                        logger.debug("{}: Processing batch update-version request {} on {} for region {} key {} value {} callbackArg {}", serverConnection.getName(), batchId, serverConnection.getSocketString(), regionName, key, valuePart, callbackArg);
                    }
                    // Process the update time-stamp request
                    if (key == null || regionName == null) {
                        StringId message = LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_UPDATE_VERSION_REQUEST_1_CONTAINING_2_EVENTS;
                        Object[] messageArgs = new Object[] { serverConnection.getName(), Integer.valueOf(batchId), Integer.valueOf(numberOfEvents) };
                        String s = message.toLocalizedString(messageArgs);
                        logger.warn(s);
                        throw new Exception(s);
                    } else {
                        region = (LocalRegion) crHelper.getRegion(regionName);
                        if (region == null) {
                            handleRegionNull(serverConnection, regionName, batchId);
                        } else {
                            clientEvent = new EventIDHolder(eventId);
                            if (versionTimeStamp > 0) {
                                VersionTag tag = VersionTag.create(region.getVersionMember());
                                tag.setIsGatewayTag(true);
                                tag.setVersionTimeStamp(versionTimeStamp);
                                tag.setDistributedSystemId(dsid);
                                clientEvent.setVersionTag(tag);
                            }
                            // Update the version tag
                            try {
                                region.basicBridgeUpdateVersionStamp(key, callbackArg, serverConnection.getProxyID(), false, clientEvent);
                            } catch (EntryNotFoundException e) {
                                logger.info(LocalizedMessage.create(LocalizedStrings.ProcessBatch_0_DURING_BATCH_UPDATE_VERSION_NO_ENTRY_WAS_FOUND_FOR_KEY_1, new Object[] { serverConnection.getName(), key }));
                            // throw new Exception(e);
                            }
                        }
                    }
                    break;
                default:
                    logger.fatal(LocalizedMessage.create(LocalizedStrings.Processbatch_0_UNKNOWN_ACTION_TYPE_1_FOR_BATCH_FROM_2, new Object[] { serverConnection.getName(), Integer.valueOf(actionType), serverConnection.getSocketString() }));
                    stats.incUnknowsOperationsReceived();
            }
        } catch (CancelException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("{} ignoring message of type {} from client {} because shutdown occurred during message processing.", serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()), serverConnection.getProxyID());
            }
            serverConnection.setFlagProcessMessagesAsFalse();
            serverConnection.setClientDisconnectedException(e);
            return;
        } catch (Exception e) {
            // If an interrupted exception is thrown , rethrow it
            checkForInterrupt(serverConnection, e);
            // If we have an issue with the PDX registry, stop processing more data
            if (e.getCause() instanceof PdxRegistryMismatchException) {
                fatalException = e.getCause();
                logger.fatal(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_PDX_CONFIGURATION, new Object[] { serverConnection.getMembershipID() }), e.getCause());
                break;
            }
            // write the batch exception to the caller and break
            if (!wroteResponse) {
                // Increment the batch id unless the received batch id is -1 (a
                // failover batch)
                DistributedSystem ds = crHelper.getCache().getDistributedSystem();
                String exceptionMessage = LocalizedStrings.GatewayReceiver_EXCEPTION_WHILE_PROCESSING_BATCH.toLocalizedString(new Object[] { ((InternalDistributedSystem) ds).getDistributionManager().getDistributedSystemId(), ds.getDistributedMember() });
                BatchException70 be = new BatchException70(exceptionMessage, e, indexWithoutPDXEvent, batchId);
                exceptions.add(be);
                if (!removeOnException) {
                    break;
                }
            // servConn.setAsTrue(RESPONDED);
            // wroteResponse = true;
            // break;
            } else {
                // occurred.
                return;
            }
        } finally {
            // Increment the partNumber
            if (actionType == 0 || /* create */
            actionType == 1) /* update */
            {
                if (callbackArgExists) {
                    partNumber += 9;
                } else {
                    partNumber += 8;
                }
            } else if (actionType == 2) /* destroy */
            {
                if (callbackArgExists) {
                    partNumber += 8;
                } else {
                    partNumber += 7;
                }
            } else if (actionType == 3) /* update-version */
            {
                if (callbackArgExists) {
                    partNumber += 8;
                } else {
                    partNumber += 7;
                }
            }
        }
    }
    {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incProcessBatchTime(start - oldStart);
    }
    if (fatalException != null) {
        serverConnection.incrementLatestBatchIdReplied(batchId);
        writeFatalException(clientMessage, fatalException, serverConnection, batchId);
        serverConnection.setAsTrue(RESPONDED);
    } else if (!exceptions.isEmpty()) {
        serverConnection.incrementLatestBatchIdReplied(batchId);
        writeBatchException(clientMessage, exceptions, serverConnection, batchId);
        serverConnection.setAsTrue(RESPONDED);
    } else if (!wroteResponse) {
        // Increment the batch id unless the received batch id is -1 (a failover
        // batch)
        serverConnection.incrementLatestBatchIdReplied(batchId);
        writeReply(clientMessage, serverConnection, batchId, numberOfEvents);
        serverConnection.setAsTrue(RESPONDED);
        stats.incWriteProcessBatchResponseTime(DistributionStats.getStatTime() - start);
        if (logger.isDebugEnabled()) {
            logger.debug("{}: Sent process batch normal response for batch {} containing {} events ({} bytes) with {} acknowledgement on {}", serverConnection.getName(), batchId, numberOfEvents, clientMessage.getPayloadLength(), (earlyAck ? "early" : "normal"), serverConnection.getSocketString());
        }
    // logger.warn("Sent process batch normal response for batch " +
    // batchId + " containing " + numberOfEvents + " events (" +
    // msg.getPayloadLength() + " bytes) with " + (earlyAck ? "early" :
    // "normal") + " acknowledgement on " + getSocketString());
    }
}
Also used : AuthorizeRequest(org.apache.geode.internal.security.AuthorizeRequest) ArrayList(java.util.ArrayList) LocalRegion(org.apache.geode.internal.cache.LocalRegion) DistributedSystem(org.apache.geode.distributed.DistributedSystem) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) CachedRegionHelper(org.apache.geode.internal.cache.tier.CachedRegionHelper) PdxRegistryMismatchException(org.apache.geode.pdx.PdxRegistryMismatchException) VersionTag(org.apache.geode.internal.cache.versions.VersionTag) EntryNotFoundException(org.apache.geode.cache.EntryNotFoundException) EventIDHolder(org.apache.geode.internal.cache.EventIDHolder) PdxRegistryMismatchException(org.apache.geode.pdx.PdxRegistryMismatchException) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) EntryNotFoundException(org.apache.geode.cache.EntryNotFoundException) CacheClosedException(org.apache.geode.cache.CacheClosedException) PdxConfigurationException(org.apache.geode.pdx.PdxConfigurationException) CancelException(org.apache.geode.CancelException) IOException(java.io.IOException) DestroyOperationContext(org.apache.geode.cache.operations.DestroyOperationContext) StringId(org.apache.geode.i18n.StringId) BatchException70(org.apache.geode.internal.cache.wan.BatchException70) Part(org.apache.geode.internal.cache.tier.sockets.Part) EventID(org.apache.geode.internal.cache.EventID) PutOperationContext(org.apache.geode.cache.operations.PutOperationContext) CancelException(org.apache.geode.CancelException) GatewayReceiverStats(org.apache.geode.internal.cache.wan.GatewayReceiverStats)

Example 2 with PutOperationContext

use of org.apache.geode.cache.operations.PutOperationContext in project geode by apache.

the class Put method cmdExecute.

@Override
public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException, InterruptedException {
    Part regionNamePart = null, keyPart = null, valuePart = null, callbackArgPart = null;
    String regionName = null;
    Object callbackArg = null, key = null;
    Part eventPart = null;
    String errMessage = "";
    CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
    CacheServerStats stats = serverConnection.getCacheServerStats();
    // requiresResponse = true;
    serverConnection.setAsTrue(REQUIRES_RESPONSE);
    {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incReadPutRequestTime(start - oldStart);
    }
    // Retrieve the data from the message parts
    regionNamePart = clientMessage.getPart(0);
    keyPart = clientMessage.getPart(1);
    valuePart = clientMessage.getPart(2);
    eventPart = clientMessage.getPart(3);
    // callbackArgPart = null; (redundant assignment)
    if (clientMessage.getNumberOfParts() > 4) {
        callbackArgPart = clientMessage.getPart(4);
        try {
            callbackArg = callbackArgPart.getObject();
        } catch (Exception e) {
            writeException(clientMessage, e, false, serverConnection);
            serverConnection.setAsTrue(RESPONDED);
            return;
        }
    }
    regionName = regionNamePart.getString();
    try {
        key = keyPart.getStringOrObject();
    } catch (Exception e) {
        writeException(clientMessage, e, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    if (logger.isTraceEnabled()) {
        logger.trace("{}: Received put request ({} bytes) from {} for region {} key {} value {}", serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key, valuePart);
    }
    // Process the put request
    if (key == null || regionName == null) {
        if (key == null) {
            logger.warn(LocalizedMessage.create(LocalizedStrings.Put_0_THE_INPUT_KEY_FOR_THE_PUT_REQUEST_IS_NULL, serverConnection.getName()));
            errMessage = LocalizedStrings.Put_THE_INPUT_KEY_FOR_THE_PUT_REQUEST_IS_NULL.toLocalizedString();
        }
        if (regionName == null) {
            logger.warn(LocalizedMessage.create(LocalizedStrings.Put_0_THE_INPUT_REGION_NAME_FOR_THE_PUT_REQUEST_IS_NULL, serverConnection.getName()));
            errMessage = LocalizedStrings.Put_THE_INPUT_REGION_NAME_FOR_THE_PUT_REQUEST_IS_NULL.toLocalizedString();
        }
        writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
    if (region == null) {
        String reason = LocalizedStrings.Put_REGION_WAS_NOT_FOUND_DURING_PUT_REQUEST.toLocalizedString();
        writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    if (valuePart.isNull() && region.containsKey(key)) {
        // Invalid to 'put' a null value in an existing key
        logger.info(LocalizedMessage.create(LocalizedStrings.Put_0_ATTEMPTED_TO_PUT_A_NULL_VALUE_FOR_EXISTING_KEY_1, new Object[] { serverConnection.getName(), key }));
        errMessage = LocalizedStrings.Put_ATTEMPTED_TO_PUT_A_NULL_VALUE_FOR_EXISTING_KEY_0.toLocalizedString();
        writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
    long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
    long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
    EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
    try {
        byte[] value = valuePart.getSerializedForm();
        boolean isObject = valuePart.isObject();
        this.securityService.authorizeRegionWrite(regionName, key.toString());
        AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
        if (authzRequest != null) {
            if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
                authzRequest.createRegionAuthorize((String) key);
            } else // Allow PUT operations on meta regions (bug #38961)
            if (!region.isUsedForMetaRegion()) {
                PutOperationContext putContext = authzRequest.putAuthorize(regionName, key, value, isObject, callbackArg);
                value = putContext.getSerializedValue();
                isObject = putContext.isObject();
                callbackArg = putContext.getCallbackArg();
            }
        }
        // If the value is 1 byte and the byte represents null,
        // attempt to create the entry. This test needs to be
        // moved to DataSerializer or DataSerializer.NULL needs
        // to be publicly accessible.
        boolean result = false;
        if (value == null) {
            // Create the null entry. Since the value is null, the value of the
            // isObject
            // the true after null doesn't matter and is not used.
            result = region.basicBridgeCreate(key, null, true, callbackArg, serverConnection.getProxyID(), true, new EventIDHolder(eventId), false);
        } else {
            // Put the entry
            result = region.basicBridgePut(key, value, null, isObject, callbackArg, serverConnection.getProxyID(), true, new EventIDHolder(eventId));
        }
        if (result) {
            serverConnection.setModificationInfo(true, regionName, key);
        } else {
            StringId message = LocalizedStrings.PUT_0_FAILED_TO_PUT_ENTRY_FOR_REGION_1_KEY_2_VALUE_3;
            Object[] messageArgs = new Object[] { serverConnection.getName(), regionName, key, valuePart };
            String s = message.toLocalizedString(messageArgs);
            logger.info(s);
            throw new Exception(s);
        }
    } catch (RegionDestroyedException rde) {
        writeException(clientMessage, rde, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    } catch (ResourceException re) {
        writeException(clientMessage, re, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    } catch (Exception ce) {
        // If an interrupted exception is thrown , rethrow it
        checkForInterrupt(serverConnection, ce);
        // If an exception occurs during the put, preserve the connection
        writeException(clientMessage, ce, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        if (ce instanceof GemFireSecurityException) {
            // logged by the security logger
            if (logger.isDebugEnabled()) {
                logger.debug("{}: Unexpected Security exception", serverConnection.getName(), ce);
            }
        } else {
            logger.warn(LocalizedMessage.create(LocalizedStrings.PUT_0_UNEXPECTED_EXCEPTION, serverConnection.getName()), ce);
        }
        return;
    } finally {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incProcessPutTime(start - oldStart);
    }
    // Increment statistics and write the reply
    writeReply(clientMessage, serverConnection);
    serverConnection.setAsTrue(RESPONDED);
    if (logger.isDebugEnabled()) {
        logger.debug("{}: Sent put response back to {} for region {} key {} value {}", serverConnection.getName(), serverConnection.getSocketString(), regionName, key, valuePart);
    }
    stats.incWritePutResponseTime(DistributionStats.getStatTime() - start);
}
Also used : AuthorizeRequest(org.apache.geode.internal.security.AuthorizeRequest) EventIDHolder(org.apache.geode.internal.cache.EventIDHolder) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) LocalRegion(org.apache.geode.internal.cache.LocalRegion) ByteBuffer(java.nio.ByteBuffer) IOException(java.io.IOException) ResourceException(org.apache.geode.cache.ResourceException) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) CachedRegionHelper(org.apache.geode.internal.cache.tier.CachedRegionHelper) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) StringId(org.apache.geode.i18n.StringId) CacheServerStats(org.apache.geode.internal.cache.tier.sockets.CacheServerStats) Part(org.apache.geode.internal.cache.tier.sockets.Part) EventID(org.apache.geode.internal.cache.EventID) ResourceException(org.apache.geode.cache.ResourceException) PutOperationContext(org.apache.geode.cache.operations.PutOperationContext)

Example 3 with PutOperationContext

use of org.apache.geode.cache.operations.PutOperationContext in project geode by apache.

the class Put61 method cmdExecute.

@Override
public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long p_start) throws IOException, InterruptedException {
    long start = p_start;
    Part regionNamePart = null, keyPart = null, valuePart = null, callbackArgPart = null;
    String regionName = null;
    Object callbackArg = null, key = null;
    Part eventPart = null;
    StringBuffer errMessage = new StringBuffer();
    boolean isDelta = false;
    CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
    CacheServerStats stats = serverConnection.getCacheServerStats();
    // requiresResponse = true;
    serverConnection.setAsTrue(REQUIRES_RESPONSE);
    {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incReadPutRequestTime(start - oldStart);
    }
    // Retrieve the data from the message parts
    regionNamePart = clientMessage.getPart(0);
    keyPart = clientMessage.getPart(1);
    try {
        isDelta = (Boolean) clientMessage.getPart(2).getObject();
    } catch (Exception e) {
        writeException(clientMessage, MessageType.PUT_DELTA_ERROR, e, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        // CachePerfStats not available here.
        return;
    }
    valuePart = clientMessage.getPart(3);
    eventPart = clientMessage.getPart(4);
    if (clientMessage.getNumberOfParts() > 5) {
        callbackArgPart = clientMessage.getPart(5);
        try {
            callbackArg = callbackArgPart.getObject();
        } catch (Exception e) {
            writeException(clientMessage, e, false, serverConnection);
            serverConnection.setAsTrue(RESPONDED);
            return;
        }
    }
    regionName = regionNamePart.getString();
    try {
        key = keyPart.getStringOrObject();
    } catch (Exception e) {
        writeException(clientMessage, e, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    final boolean isDebugEnabled = logger.isDebugEnabled();
    if (isDebugEnabled) {
        logger.debug("{}: Received 6.1{}put request ({} bytes) from {} for region {} key {}", serverConnection.getName(), (isDelta ? " delta " : " "), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key);
    }
    // Process the put request
    if (key == null || regionName == null) {
        if (key == null) {
            String putMsg = " The input key for the 6.1 put request is null";
            if (isDebugEnabled) {
                logger.debug("{}:{}", serverConnection.getName(), putMsg);
            }
            errMessage.append(putMsg);
        }
        if (regionName == null) {
            String putMsg = " The input region name for the 6.1 put request is null";
            if (isDebugEnabled) {
                logger.debug("{}:{}", serverConnection.getName(), putMsg);
            }
            errMessage.append(putMsg);
        }
        writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
    if (region == null) {
        String reason = " was not found during 6.1 put request";
        writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    if (valuePart.isNull() && region.containsKey(key)) {
        // Invalid to 'put' a null value in an existing key
        String putMsg = " Attempted to 6.1 put a null value for existing key " + key;
        if (isDebugEnabled) {
            logger.debug("{}:{}", serverConnection.getName(), putMsg);
        }
        errMessage.append(putMsg);
        writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    // try {
    // this.eventId = (EventID)eventPart.getObject();
    ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
    long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
    long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
    EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
    try {
        Object value = null;
        if (!isDelta) {
            value = valuePart.getSerializedForm();
        }
        boolean isObject = valuePart.isObject();
        boolean isMetaRegion = region.isUsedForMetaRegion();
        clientMessage.setMetaRegion(isMetaRegion);
        this.securityService.authorizeRegionWrite(regionName, key.toString());
        AuthorizeRequest authzRequest = null;
        if (!isMetaRegion) {
            authzRequest = serverConnection.getAuthzRequest();
        }
        if (authzRequest != null) {
            if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
                authzRequest.createRegionAuthorize((String) key);
            } else // Allow PUT operations on meta regions (bug #38961)
            {
                PutOperationContext putContext = authzRequest.putAuthorize(regionName, key, value, isObject, callbackArg);
                value = putContext.getValue();
                isObject = putContext.isObject();
                callbackArg = putContext.getCallbackArg();
            }
        }
        // If the value is 1 byte and the byte represents null,
        // attempt to create the entry. This test needs to be
        // moved to DataSerializer or DataSerializer.NULL needs
        // to be publicly accessible.
        boolean result = false;
        if (value == null && !isDelta) {
            // Create the null entry. Since the value is null, the value of the
            // isObject
            // the true after null doesn't matter and is not used.
            result = region.basicBridgeCreate(key, null, true, callbackArg, serverConnection.getProxyID(), true, new EventIDHolder(eventId), false);
        } else {
            // Put the entry
            byte[] delta = null;
            if (isDelta) {
                delta = valuePart.getSerializedForm();
            }
            result = region.basicBridgePut(key, value, delta, isObject, callbackArg, serverConnection.getProxyID(), true, new EventIDHolder(eventId));
        }
        if (result) {
            serverConnection.setModificationInfo(true, regionName, key);
        } else {
            String message = serverConnection.getName() + ": Failed to 6.1 put entry for region " + regionName + " key " + key + " value " + valuePart;
            if (isDebugEnabled) {
                logger.debug(message);
            }
            throw new Exception(message);
        }
    } catch (RegionDestroyedException rde) {
        writeException(clientMessage, rde, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    } catch (ResourceException re) {
        writeException(clientMessage, re, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    } catch (InvalidDeltaException ide) {
        logger.info(LocalizedMessage.create(LocalizedStrings.UpdateOperation_ERROR_APPLYING_DELTA_FOR_KEY_0_OF_REGION_1, new Object[] { key, regionName }));
        writeException(clientMessage, MessageType.PUT_DELTA_ERROR, ide, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        region.getCachePerfStats().incDeltaFullValuesRequested();
        return;
    } catch (Exception ce) {
        // If an interrupted exception is thrown , rethrow it
        checkForInterrupt(serverConnection, ce);
        // If an exception occurs during the put, preserve the connection
        writeException(clientMessage, ce, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        if (ce instanceof GemFireSecurityException) {
            // logged by the security logger
            if (isDebugEnabled) {
                logger.debug("{}: Unexpected Security exception", serverConnection.getName(), ce);
            }
        } else if (isDebugEnabled) {
            logger.debug("{}: Unexpected Exception", serverConnection.getName(), ce);
        }
        return;
    } finally {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incProcessPutTime(start - oldStart);
    }
    // Increment statistics and write the reply
    if (region instanceof PartitionedRegion) {
        PartitionedRegion pr = (PartitionedRegion) region;
        if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
            writeReplyWithRefreshMetadata(clientMessage, serverConnection, pr, pr.getNetworkHopType());
            pr.clearNetworkHopData();
        } else {
            writeReply(clientMessage, serverConnection);
        }
    } else {
        writeReply(clientMessage, serverConnection);
    }
    serverConnection.setAsTrue(RESPONDED);
    if (isDebugEnabled) {
        logger.debug("{}: Sent 6.1 put response back to {} for region {} key {} value {}", serverConnection.getName(), serverConnection.getSocketString(), regionName, key, valuePart);
    }
    stats.incWritePutResponseTime(DistributionStats.getStatTime() - start);
}
Also used : InvalidDeltaException(org.apache.geode.InvalidDeltaException) AuthorizeRequest(org.apache.geode.internal.security.AuthorizeRequest) EventIDHolder(org.apache.geode.internal.cache.EventIDHolder) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) LocalRegion(org.apache.geode.internal.cache.LocalRegion) ByteBuffer(java.nio.ByteBuffer) InvalidDeltaException(org.apache.geode.InvalidDeltaException) IOException(java.io.IOException) ResourceException(org.apache.geode.cache.ResourceException) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) CachedRegionHelper(org.apache.geode.internal.cache.tier.CachedRegionHelper) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) CacheServerStats(org.apache.geode.internal.cache.tier.sockets.CacheServerStats) Part(org.apache.geode.internal.cache.tier.sockets.Part) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) EventID(org.apache.geode.internal.cache.EventID) ResourceException(org.apache.geode.cache.ResourceException) PutOperationContext(org.apache.geode.cache.operations.PutOperationContext)

Example 4 with PutOperationContext

use of org.apache.geode.cache.operations.PutOperationContext in project geode by apache.

the class CacheClientProxy method getOperationContext.

private OperationContext getOperationContext(ClientMessage cmsg, String[] regionNameHolder) {
    ClientUpdateMessageImpl cmsgimpl = (ClientUpdateMessageImpl) cmsg;
    OperationContext opctxt = null;
    // TODO SW: Special handling for DynamicRegions; this should be reworked
    // when DynamicRegion API is deprecated
    String regionName = cmsgimpl.getRegionName();
    regionNameHolder[0] = regionName;
    if (cmsgimpl.isCreate()) {
        if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
            regionNameHolder[0] = (String) cmsgimpl.getKeyOfInterest();
            opctxt = new RegionCreateOperationContext(true);
        } else {
            PutOperationContext tmp = new PutOperationContext(cmsgimpl.getKeyOfInterest(), cmsgimpl.getValue(), cmsgimpl.valueIsObject(), PutOperationContext.CREATE, true);
            tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
            opctxt = tmp;
        }
    } else if (cmsgimpl.isUpdate()) {
        if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
            regionNameHolder[0] = (String) cmsgimpl.getKeyOfInterest();
            opctxt = new RegionCreateOperationContext(true);
        } else {
            PutOperationContext tmp = new PutOperationContext(cmsgimpl.getKeyOfInterest(), cmsgimpl.getValue(), cmsgimpl.valueIsObject(), PutOperationContext.UPDATE, true);
            tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
            opctxt = tmp;
        }
    } else if (cmsgimpl.isDestroy()) {
        if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
            regionNameHolder[0] = (String) cmsgimpl.getKeyOfInterest();
            opctxt = new RegionDestroyOperationContext(true);
        } else {
            DestroyOperationContext tmp = new DestroyOperationContext(cmsgimpl.getKeyOfInterest(), true);
            tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
            opctxt = tmp;
        }
    } else if (cmsgimpl.isDestroyRegion()) {
        opctxt = new RegionDestroyOperationContext(true);
    } else if (cmsgimpl.isInvalidate()) {
        InvalidateOperationContext tmp = new InvalidateOperationContext(cmsgimpl.getKeyOfInterest(), true);
        tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
        opctxt = tmp;
    } else if (cmsgimpl.isClearRegion()) {
        RegionClearOperationContext tmp = new RegionClearOperationContext(true);
        tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
        opctxt = tmp;
    }
    return opctxt;
}
Also used : RegionCreateOperationContext(org.apache.geode.cache.operations.RegionCreateOperationContext) DestroyOperationContext(org.apache.geode.cache.operations.DestroyOperationContext) PutOperationContext(org.apache.geode.cache.operations.PutOperationContext) InvalidateOperationContext(org.apache.geode.cache.operations.InvalidateOperationContext) RegionClearOperationContext(org.apache.geode.cache.operations.RegionClearOperationContext) RegionDestroyOperationContext(org.apache.geode.cache.operations.RegionDestroyOperationContext) OperationContext(org.apache.geode.cache.operations.OperationContext) InvalidateOperationContext(org.apache.geode.cache.operations.InvalidateOperationContext) RegionCreateOperationContext(org.apache.geode.cache.operations.RegionCreateOperationContext) RegionDestroyOperationContext(org.apache.geode.cache.operations.RegionDestroyOperationContext) PutOperationContext(org.apache.geode.cache.operations.PutOperationContext) RegionClearOperationContext(org.apache.geode.cache.operations.RegionClearOperationContext) DestroyOperationContext(org.apache.geode.cache.operations.DestroyOperationContext) RegionDestroyOperationContext(org.apache.geode.cache.operations.RegionDestroyOperationContext)

Example 5 with PutOperationContext

use of org.apache.geode.cache.operations.PutOperationContext in project geode by apache.

the class Put65 method cmdExecute.

@Override
public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long p_start) throws IOException, InterruptedException {
    long start = p_start;
    Part regionNamePart = null, keyPart = null, valuePart = null, callbackArgPart = null;
    String regionName = null;
    Object callbackArg = null, key = null;
    Part eventPart = null;
    StringBuffer errMessage = new StringBuffer();
    boolean isDelta = false;
    CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
    CacheServerStats stats = serverConnection.getCacheServerStats();
    // requiresResponse = true;
    serverConnection.setAsTrue(REQUIRES_RESPONSE);
    {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incReadPutRequestTime(start - oldStart);
    }
    // Retrieve the data from the message parts
    int idx = 0;
    regionNamePart = clientMessage.getPart(idx++);
    Operation operation;
    try {
        operation = (Operation) clientMessage.getPart(idx++).getObject();
        if (operation == null) {
            // native clients send a null since the op is java-serialized
            operation = Operation.UPDATE;
        }
    } catch (ClassNotFoundException e) {
        writeException(clientMessage, e, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    int flags = clientMessage.getPart(idx++).getInt();
    boolean requireOldValue = ((flags & 0x01) == 0x01);
    boolean haveExpectedOldValue = ((flags & 0x02) == 0x02);
    Object expectedOldValue = null;
    if (haveExpectedOldValue) {
        try {
            expectedOldValue = clientMessage.getPart(idx++).getObject();
        } catch (ClassNotFoundException e) {
            writeException(clientMessage, e, false, serverConnection);
            serverConnection.setAsTrue(RESPONDED);
            return;
        }
    }
    keyPart = clientMessage.getPart(idx++);
    try {
        isDelta = ((Boolean) clientMessage.getPart(idx).getObject()).booleanValue();
        idx += 1;
    } catch (Exception e) {
        writeException(clientMessage, MessageType.PUT_DELTA_ERROR, e, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        // CachePerfStats not available here.
        return;
    }
    valuePart = clientMessage.getPart(idx++);
    eventPart = clientMessage.getPart(idx++);
    if (clientMessage.getNumberOfParts() > idx) {
        callbackArgPart = clientMessage.getPart(idx++);
        try {
            callbackArg = callbackArgPart.getObject();
        } catch (Exception e) {
            writeException(clientMessage, e, false, serverConnection);
            serverConnection.setAsTrue(RESPONDED);
            return;
        }
    }
    regionName = regionNamePart.getString();
    try {
        key = keyPart.getStringOrObject();
    } catch (Exception e) {
        writeException(clientMessage, e, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    final boolean isDebugEnabled = logger.isDebugEnabled();
    if (isDebugEnabled) {
        logger.debug("{}: Received {}put request ({} bytes) from {} for region {} key {} txId {} posdup: {}", serverConnection.getName(), (isDelta ? " delta " : " "), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key, clientMessage.getTransactionId(), clientMessage.isRetry());
    }
    // Process the put request
    if (key == null || regionName == null) {
        if (key == null) {
            String putMsg = " The input key for the put request is null";
            if (isDebugEnabled) {
                logger.debug("{}:{}", serverConnection.getName(), putMsg);
            }
            errMessage.append(putMsg);
        }
        if (regionName == null) {
            String putMsg = " The input region name for the put request is null";
            if (isDebugEnabled) {
                logger.debug("{}:{}", serverConnection.getName(), putMsg);
            }
            errMessage.append(putMsg);
        }
        writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
    if (region == null) {
        String reason = " was not found during put request";
        writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    if (valuePart.isNull() && operation != Operation.PUT_IF_ABSENT && region.containsKey(key)) {
        // Invalid to 'put' a null value in an existing key
        String putMsg = " Attempted to put a null value for existing key " + key;
        if (isDebugEnabled) {
            logger.debug("{}:{}", serverConnection.getName(), putMsg);
        }
        errMessage.append(putMsg);
        writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    }
    ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
    long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
    long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
    EventIDHolder clientEvent = new EventIDHolder(new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId));
    Breadcrumbs.setEventId(clientEvent.getEventId());
    // msg.isRetry might be set by v7.0 and later clients
    if (clientMessage.isRetry()) {
        // if (logger.isDebugEnabled()) {
        // logger.debug("DEBUG: encountered isRetry in Put65");
        // }
        clientEvent.setPossibleDuplicate(true);
        if (region.getAttributes().getConcurrencyChecksEnabled()) {
            // recover the version tag from other servers
            clientEvent.setRegion(region);
            if (!recoverVersionTagForRetriedOperation(clientEvent)) {
                // no-one has seen this event
                clientEvent.setPossibleDuplicate(false);
            }
        }
    }
    boolean result = false;
    boolean sendOldValue = false;
    boolean oldValueIsObject = true;
    Object oldValue = null;
    try {
        Object value = null;
        if (!isDelta) {
            value = valuePart.getSerializedForm();
        }
        boolean isObject = valuePart.isObject();
        boolean isMetaRegion = region.isUsedForMetaRegion();
        clientMessage.setMetaRegion(isMetaRegion);
        this.securityService.authorizeRegionWrite(regionName, key.toString());
        AuthorizeRequest authzRequest = null;
        if (!isMetaRegion) {
            authzRequest = serverConnection.getAuthzRequest();
        }
        if (authzRequest != null) {
            if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
                authzRequest.createRegionAuthorize((String) key);
            } else // Allow PUT operations on meta regions (bug #38961)
            {
                PutOperationContext putContext = authzRequest.putAuthorize(regionName, key, value, isObject, callbackArg);
                value = putContext.getValue();
                isObject = putContext.isObject();
                callbackArg = putContext.getCallbackArg();
            }
        }
        if (isDebugEnabled) {
            logger.debug("processing put65 with operation={}", operation);
        }
        // to be publicly accessible.
        if (operation == Operation.PUT_IF_ABSENT) {
            // try {
            if (clientMessage.isRetry() && clientEvent.getVersionTag() != null) {
                // version tag
                if (isDebugEnabled) {
                    logger.debug("putIfAbsent operation was successful last time with version {}", clientEvent.getVersionTag());
                }
                // invoke basicBridgePutIfAbsent anyway to ensure that the event is distributed to all
                // servers - bug #51664
                region.basicBridgePutIfAbsent(key, value, isObject, callbackArg, serverConnection.getProxyID(), true, clientEvent);
                oldValue = null;
            } else {
                oldValue = region.basicBridgePutIfAbsent(key, value, isObject, callbackArg, serverConnection.getProxyID(), true, clientEvent);
            }
            sendOldValue = true;
            oldValueIsObject = true;
            Version clientVersion = serverConnection.getClientVersion();
            if (oldValue instanceof CachedDeserializable) {
                oldValue = ((CachedDeserializable) oldValue).getSerializedValue();
            } else if (oldValue instanceof byte[]) {
                oldValueIsObject = false;
            } else if ((oldValue instanceof Token) && clientVersion.compareTo(Version.GFE_651) <= 0) {
                // older clients don't know that Token is now a DSFID class, so we
                // put the token in a serialized form they can consume
                HeapDataOutputStream str = new HeapDataOutputStream(Version.CURRENT);
                DataOutput dstr = new DataOutputStream(str);
                InternalDataSerializer.writeSerializableObject(oldValue, dstr);
                oldValue = str.toByteArray();
            }
            result = true;
        // } catch (Exception e) {
        // writeException(msg, e, false, servConn);
        // servConn.setAsTrue(RESPONDED);
        // return;
        // }
        } else if (operation == Operation.REPLACE) {
            // try {
            if (requireOldValue) {
                // <V> replace(<K>, <V>)
                if (clientMessage.isRetry() && clientEvent.isConcurrencyConflict() && clientEvent.getVersionTag() != null) {
                    if (isDebugEnabled) {
                        logger.debug("replace(k,v) operation was successful last time with version {}", clientEvent.getVersionTag());
                    }
                }
                oldValue = region.basicBridgeReplace(key, value, isObject, callbackArg, serverConnection.getProxyID(), true, clientEvent);
                sendOldValue = !clientEvent.isConcurrencyConflict();
                oldValueIsObject = true;
                Version clientVersion = serverConnection.getClientVersion();
                if (oldValue instanceof CachedDeserializable) {
                    oldValue = ((CachedDeserializable) oldValue).getSerializedValue();
                } else if (oldValue instanceof byte[]) {
                    oldValueIsObject = false;
                } else if ((oldValue instanceof Token) && clientVersion.compareTo(Version.GFE_651) <= 0) {
                    // older clients don't know that Token is now a DSFID class, so we
                    // put the token in a serialized form they can consume
                    HeapDataOutputStream str = new HeapDataOutputStream(Version.CURRENT);
                    DataOutput dstr = new DataOutputStream(str);
                    InternalDataSerializer.writeSerializableObject(oldValue, dstr);
                    oldValue = str.toByteArray();
                }
                if (isDebugEnabled) {
                    logger.debug("returning {} from replace(K,V)", oldValue);
                }
                result = true;
            } else {
                // boolean replace(<K>, <V>, <V>) {
                boolean didPut;
                didPut = region.basicBridgeReplace(key, expectedOldValue, value, isObject, callbackArg, serverConnection.getProxyID(), true, clientEvent);
                if (clientMessage.isRetry() && clientEvent.getVersionTag() != null) {
                    if (isDebugEnabled) {
                        logger.debug("replace(k,v,v) operation was successful last time with version {}", clientEvent.getVersionTag());
                    }
                    didPut = true;
                }
                sendOldValue = true;
                oldValueIsObject = true;
                oldValue = didPut ? Boolean.TRUE : Boolean.FALSE;
                if (isDebugEnabled) {
                    logger.debug("returning {} from replace(K,V,V)", oldValue);
                }
                result = true;
            }
        // } catch (Exception e) {
        // writeException(msg, e, false, servConn);
        // servConn.setAsTrue(RESPONDED);
        // return;
        // }
        } else if (value == null && !isDelta) {
            // Create the null entry. Since the value is null, the value of the
            // isObject
            // the true after null doesn't matter and is not used.
            result = region.basicBridgeCreate(key, null, true, callbackArg, serverConnection.getProxyID(), true, clientEvent, false);
            if (clientMessage.isRetry() && clientEvent.isConcurrencyConflict() && clientEvent.getVersionTag() != null) {
                result = true;
                if (isDebugEnabled) {
                    logger.debug("create(k,null) operation was successful last time with version {}", clientEvent.getVersionTag());
                }
            }
        } else {
            // Put the entry
            byte[] delta = null;
            if (isDelta) {
                delta = valuePart.getSerializedForm();
            }
            TXManagerImpl txMgr = (TXManagerImpl) serverConnection.getCache().getCacheTransactionManager();
            // bug 43068 - use create() if in a transaction and op is CREATE
            if (txMgr.getTXState() != null && operation.isCreate()) {
                result = region.basicBridgeCreate(key, (byte[]) value, isObject, callbackArg, serverConnection.getProxyID(), true, clientEvent, true);
            } else {
                result = region.basicBridgePut(key, value, delta, isObject, callbackArg, serverConnection.getProxyID(), true, clientEvent);
            }
            if (clientMessage.isRetry() && clientEvent.isConcurrencyConflict() && clientEvent.getVersionTag() != null) {
                if (isDebugEnabled) {
                    logger.debug("put(k,v) operation was successful last time with version {}", clientEvent.getVersionTag());
                }
                result = true;
            }
        }
        if (result) {
            serverConnection.setModificationInfo(true, regionName, key);
        } else {
            String message = serverConnection.getName() + ": Failed to put entry for region " + regionName + " key " + key + " value " + valuePart;
            if (isDebugEnabled) {
                logger.debug(message);
            }
            throw new Exception(message);
        }
    } catch (RegionDestroyedException rde) {
        writeException(clientMessage, rde, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    } catch (ResourceException re) {
        writeException(clientMessage, re, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        return;
    } catch (InvalidDeltaException ide) {
        logger.info(LocalizedMessage.create(LocalizedStrings.UpdateOperation_ERROR_APPLYING_DELTA_FOR_KEY_0_OF_REGION_1, new Object[] { key, regionName }));
        writeException(clientMessage, MessageType.PUT_DELTA_ERROR, ide, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        region.getCachePerfStats().incDeltaFullValuesRequested();
        return;
    } catch (Exception ce) {
        // If an interrupted exception is thrown , rethrow it
        checkForInterrupt(serverConnection, ce);
        // If an exception occurs during the put, preserve the connection
        writeException(clientMessage, ce, false, serverConnection);
        serverConnection.setAsTrue(RESPONDED);
        if (ce instanceof GemFireSecurityException) {
            // logged by the security logger
            if (isDebugEnabled) {
                logger.debug("{}: Unexpected Security exception", serverConnection.getName(), ce);
            }
        } else if (isDebugEnabled) {
            logger.debug("{}: Unexpected Exception", serverConnection.getName(), ce);
        }
        return;
    } finally {
        long oldStart = start;
        start = DistributionStats.getStatTime();
        stats.incProcessPutTime(start - oldStart);
    }
    // Increment statistics and write the reply
    if (region instanceof PartitionedRegion) {
        PartitionedRegion pr = (PartitionedRegion) region;
        if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
            writeReplyWithRefreshMetadata(clientMessage, serverConnection, pr, sendOldValue, oldValueIsObject, oldValue, pr.getNetworkHopType(), clientEvent.getVersionTag());
            pr.clearNetworkHopData();
        } else {
            writeReply(clientMessage, serverConnection, sendOldValue, oldValueIsObject, oldValue, clientEvent.getVersionTag());
        }
    } else {
        writeReply(clientMessage, serverConnection, sendOldValue, oldValueIsObject, oldValue, clientEvent.getVersionTag());
    }
    serverConnection.setAsTrue(RESPONDED);
    if (isDebugEnabled) {
        logger.debug("{}: Sent put response back to {} for region {} key {} value {}", serverConnection.getName(), serverConnection.getSocketString(), regionName, key, valuePart);
    }
    stats.incWritePutResponseTime(DistributionStats.getStatTime() - start);
}
Also used : InvalidDeltaException(org.apache.geode.InvalidDeltaException) DataOutput(java.io.DataOutput) TXManagerImpl(org.apache.geode.internal.cache.TXManagerImpl) AuthorizeRequest(org.apache.geode.internal.security.AuthorizeRequest) DataOutputStream(java.io.DataOutputStream) HeapDataOutputStream(org.apache.geode.internal.HeapDataOutputStream) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) Token(org.apache.geode.internal.cache.Token) Operation(org.apache.geode.cache.Operation) LocalRegion(org.apache.geode.internal.cache.LocalRegion) CachedRegionHelper(org.apache.geode.internal.cache.tier.CachedRegionHelper) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) Version(org.apache.geode.internal.Version) ResourceException(org.apache.geode.cache.ResourceException) CachedDeserializable(org.apache.geode.internal.cache.CachedDeserializable) EventIDHolder(org.apache.geode.internal.cache.EventIDHolder) ByteBuffer(java.nio.ByteBuffer) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) InvalidDeltaException(org.apache.geode.InvalidDeltaException) IOException(java.io.IOException) ResourceException(org.apache.geode.cache.ResourceException) CacheServerStats(org.apache.geode.internal.cache.tier.sockets.CacheServerStats) Part(org.apache.geode.internal.cache.tier.sockets.Part) HeapDataOutputStream(org.apache.geode.internal.HeapDataOutputStream) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) EventID(org.apache.geode.internal.cache.EventID) PutOperationContext(org.apache.geode.cache.operations.PutOperationContext)

Aggregations

PutOperationContext (org.apache.geode.cache.operations.PutOperationContext)6 IOException (java.io.IOException)4 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)4 EventID (org.apache.geode.internal.cache.EventID)4 EventIDHolder (org.apache.geode.internal.cache.EventIDHolder)4 LocalRegion (org.apache.geode.internal.cache.LocalRegion)4 CachedRegionHelper (org.apache.geode.internal.cache.tier.CachedRegionHelper)4 Part (org.apache.geode.internal.cache.tier.sockets.Part)4 AuthorizeRequest (org.apache.geode.internal.security.AuthorizeRequest)4 ByteBuffer (java.nio.ByteBuffer)3 ResourceException (org.apache.geode.cache.ResourceException)3 CacheServerStats (org.apache.geode.internal.cache.tier.sockets.CacheServerStats)3 GemFireSecurityException (org.apache.geode.security.GemFireSecurityException)3 InvalidDeltaException (org.apache.geode.InvalidDeltaException)2 DestroyOperationContext (org.apache.geode.cache.operations.DestroyOperationContext)2 StringId (org.apache.geode.i18n.StringId)2 HeapDataOutputStream (org.apache.geode.internal.HeapDataOutputStream)2 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)2 DataOutput (java.io.DataOutput)1 DataOutputStream (java.io.DataOutputStream)1