public void updateTxnIndex(CompletedTxn completedTxn, long lastStableOffset) throws IOException {
        if (completedTxn.isAborted) {
            LOGGER.trace("Writing aborted transaction {} to transaction index, last stable offset is {}", completedTxn, lastStableOffset);
            txnIndex.append(new AbortedTxn(completedTxn, lastStableOffset));
        }
    }
Append records from a file beginning at the given position until either the end of the file
is reached or an offset is found which is too large to convert to a relative offset for the indexes.

@return the number of bytes appended to the log (may be less than the size of the input if an
        offset is encountered which would overflow this segment)
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegment.java