private void readMutationInternal()

in cassandra-four-zero-bridge/src/main/java/org/apache/cassandra/db/commitlog/BufferingCommitLogReader.java [524:587]


    private void readMutationInternal(byte[] inputBuffer,
                                      int size,
                                      int mutationPosition) throws IOException
    {
        // For now, we need to go through the motions of deserializing the mutation to determine its size and move
        // the file pointer forward accordingly, even if we're behind the requested minPosition within this SyncSegment.

        Mutation mutation;
        try (RebufferingInputStream bufIn = new DataInputBuffer(inputBuffer, 0, size))
        {
            mutation = Mutation.serializer.deserialize(bufIn,
                                                       messagingVersion,
                                                       DeserializationHelper.Flag.LOCAL);
        }
        catch (UnknownTableException ex)
        {
            if (ex.id == null)
            {
                return;
            }
            logger.trace("Invalid mutation", ex); // we see many unknown table exception logs when we skip over mutations from other tables
            stats.mutationsIgnoredUnknownTableCount(1);

            return;
        }
        catch (Throwable t)
        {
            JVMStabilityInspector.inspectThrowable(t);
            Path p = Files.createTempFile("mutation", "dat");

            try (DataOutputStream out = new DataOutputStream(Files.newOutputStream(p)))
            {
                out.write(inputBuffer, 0, size);
            }

            // Checksum passed so this error can't be permissible.
            this.handleUnrecoverableError(new CommitLogReadException(
            String.format(
            "Unexpected error deserializing mutation; saved to %s.  " +
            "This may be caused by replaying a mutation against a table with the same name but incompatible schema.  " +
            "Exception follows: %s", p, t),
            CommitLogReadErrorReason.MUTATION_ERROR,
            false));

            stats.mutationsDeserializeFailedCount(1);

            return;
        }

        //  Cassandra has a bug of getting the string representation of tombstoned cell of some type (date, smallint, etc.)
        //  in a multi-cell collection. The trace logging below triggers AbstractCell#toString()
        // JIRA: CASSANDRA-17695 AbstractCell#toString throws MarshalException for cell in collection
        logger.trace("Read mutation for", () -> "keyspace", mutation::getKeyspaceName, () -> "key", mutation::key,
                     () -> "mutation", () -> '{'
                                             + mutation.getPartitionUpdates().stream()
                                                       .map(AbstractBTreePartition::toString)
                                                       .collect(Collectors.joining(", "))
                                             + '}');

        stats.mutationsReadCount(1);
        stats.mutationsReadBytes(size);

        this.handleMutation(mutation, size, mutationPosition, desc);
    }