private void archive(String newMemberId) {
            state = RecordState.ARCHIVED;
            memberId = newMemberId;
        }
Try to update the state of the records. The state of the records can only be updated if the
new state is allowed to be transitioned from old state. The delivery count is not incremented
if the state update is unsuccessful.

@param newState The new state of the records.
@param incrementDeliveryCount Whether to increment the delivery count.

@return {@code InFlightState} if update succeeds, null otherwise. Returning state
        helps update chaining.
core/src/main/java/kafka/server/share/SharePartition.java