segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/MemoryStateUpdater.java
private void addToReadIndex(StorageOperation operation) throws DataCorruptionException, CacheFullException {
        try {
            if (operation instanceof StreamSegmentAppendOperation) {
                // Record a StreamSegmentAppendOperation. Just in case, we also support this type of operation, but we need to
                // log a warning indicating so. This means we do not optimize memory properly, and we end up storing data
                // in two different places.
                StreamSegmentAppendOperation appendOperation = (StreamSegmentAppendOperation) operation;
                this.readIndex.append(appendOperation.getStreamSegmentId(),
                        appendOperation.getStreamSegmentOffset(),
                        appendOperation.getData());
            } else if (operation instanceof MergeSegmentOperation) {
                // Record a MergeSegmentOperation. We call beginMerge here, and the StorageWriter will call completeMerge.
                MergeSegmentOperation mergeOperation = (MergeSegmentOperation) operation;
                this.readIndex.beginMerge(mergeOperation.getStreamSegmentId(),
                        mergeOperation.getStreamSegmentOffset(),
                        mergeOperation.getSourceSegmentId());
            } else {
                assert !(operation instanceof CachedStreamSegmentAppendOperation)
                        : "attempted to add a CachedStreamSegmentAppendOperation to the ReadIndex";
            }
        } catch (ObjectClosedException | StreamSegmentNotExistsException ex) {
            // The Segment is in the process of being deleted. We usually end up in here because a concurrent delete
            // request has updated the metadata while we were executing.
            log.warn("Not adding operation '{}' to ReadIndex because it refers to a deleted StreamSegment.", operation);
        } catch (CacheFullException ex) {
            // Record the operation that we couldn't add and re-throw the exception as we cannot do anything about it here.
            log.warn("Not adding operation '{}' to ReadIndex because the Cache is full.", operation);
            throw ex;
        } catch (Exception ex) {
            throw new DataCorruptionException(String.format("Unable to add operation '%s' to ReadIndex.", operation), ex);
        }
    }
/**
     * Registers the given operation in the ReadIndex.
     *
     * @param operation The operation to register.
     * @throws CacheFullException If the operation could not be added to the {@link ReadIndex} due to the cache being
     * full and unable to evict anything to make room for more.
     * @throws DataCorruptionException If any unexpected exception occurred that prevented the operation from being
     * added to the {@link ReadIndex}. Unexpected exceptions are all exceptions other than those declared in this
     * method or that indicate we are shutting down or that the segment has been deleted.
     */
Registers the given operation in the ReadIndex.
@param operation The operation to register.
@throws CacheFullException If the operation could not be added to the  ReadIndex due to the cache being
full and unable to evict anything to make room for more.
@throws DataCorruptionException If any unexpected exception occurred that prevented the operation from being
added to the  ReadIndex. Unexpected exceptions are all exceptions other than those declared in this
method or that indicate we are shutting down or that the segment has been deleted.
Registers the given operation in the ReadIndex . @param operation The operation to register . @throws CacheFullException If the operation could not be added to the ReadIndex due to the cache being full and unable to evict anything to make room for more . @throws DataCorruptionException If any unexpected exception occurred that prevented the operation from being added to the ReadIndex . Unexpected exceptions are all exceptions other than those declared in this method or that indicate we are shutting down or that the segment has been deleted .
private void addToReadIndex(StorageOperation operation) throws DataCorruptionException, CacheFullException {
        try {
            if (operation instanceof StreamSegmentAppendOperation) {
                StreamSegmentAppendOperation appendOperation = (StreamSegmentAppendOperation) operation;
                this.readIndex.append(appendOperation.getStreamSegmentId(),
                        appendOperation.getStreamSegmentOffset(),
                        appendOperation.getData());
            } else if (operation instanceof MergeSegmentOperation) {
                MergeSegmentOperation mergeOperation = (MergeSegmentOperation) operation;
                this.readIndex.beginMerge(mergeOperation.getStreamSegmentId(),
                        mergeOperation.getStreamSegmentOffset(),
                        mergeOperation.getSourceSegmentId());
            } else {
                assert !(operation instanceof CachedStreamSegmentAppendOperation)
                        : "attempted to add a CachedStreamSegmentAppendOperation to the ReadIndex";
            }
        } catch (ObjectClosedException | StreamSegmentNotExistsException ex) {
            log.warn("Not adding operation '{}' to ReadIndex because it refers to a deleted StreamSegment.", operation);
        } catch (CacheFullException ex) {
            log.warn("Not adding operation '{}' to ReadIndex because the Cache is full.", operation);
            throw ex;
        } catch (Exception ex) {
            throw new DataCorruptionException(String.format("Unable to add operation '%s' to ReadIndex.", operation), ex);
        }
    }
private void addToReadIndex ( StorageOperation operation ) throws DataCorruptionException , CacheFullException { try { if ( operation instanceof StreamSegmentAppendOperation ) { StreamSegmentAppendOperation appendOperation = ( StreamSegmentAppendOperation ) operation ; this . readIndex . append ( appendOperation . getStreamSegmentId ( ) , appendOperation . getStreamSegmentOffset ( ) , appendOperation . getData ( ) ) ; } else if ( operation instanceof MergeSegmentOperation ) { MergeSegmentOperation mergeOperation = ( MergeSegmentOperation ) operation ; this . readIndex . beginMerge ( mergeOperation . getStreamSegmentId ( ) , mergeOperation . getStreamSegmentOffset ( ) , mergeOperation . getSourceSegmentId ( ) ) ; } else { assert ! ( operation instanceof CachedStreamSegmentAppendOperation ) : "attempted to add a CachedStreamSegmentAppendOperation to the ReadIndex" ; } } catch ( ObjectClosedException | StreamSegmentNotExistsException ex ) { log . warn ( "Not adding operation '{}' to ReadIndex because it refers to a deleted StreamSegment." , operation ) ; } catch ( CacheFullException ex ) { log . warn ( "Not adding operation '{}' to ReadIndex because the Cache is full." , operation ) ; throw ex ; } catch ( Exception ex ) { throw new DataCorruptionException ( String . format ( "Unable to add operation '%s' to ReadIndex." , operation ) , ex ) ; } }
Registers the given operation in the ReadIndex.
Registers the given operation in the ReadIndex .
// Record a StreamSegmentAppendOperation. Just in case, we also support this type of operation, but we need to // log a warning indicating so. This means we do not optimize memory properly, and we end up storing data // in two different places. // Record a MergeSegmentOperation. We call beginMerge here, and the StorageWriter will call completeMerge. // The Segment is in the process of being deleted. We usually end up in here because a concurrent delete // request has updated the metadata while we were executing. // Record the operation that we couldn't add and re-throw the exception as we cannot do anything about it here.