public void replay(
        ConsumerGroupTargetAssignmentMetadataKey key,
        ConsumerGroupTargetAssignmentMetadataValue value,
        GroupType groupType
    ) {
        String groupId = key.groupId();
        ModernGroup<?> group = getOrMaybeCreatePersistedGroup(groupId, false, groupType);

        if (value != null) {
            group.setTargetAssignmentEpoch(value.assignmentEpoch());
        } else {
            if (!group.targetAssignment().isEmpty()) {
                throw new IllegalStateException("Received a tombstone record to delete target assignment of " + groupId
                    + " but the assignment still has " + group.targetAssignment().size() + " members.");
            }
            group.setTargetAssignmentEpoch(-1);
        }
    }
Replays ConsumerGroupTargetAssignmentMetadataKey/Value to update the hard state of
the modern group. It updates the target assignment epoch or set it to -1 to signal
that it has been deleted.

@param key   A ConsumerGroupTargetAssignmentMetadataKey key.
@param value A ConsumerGroupTargetAssignmentMetadataValue record.
@param groupType GroupType (Consumer or Share) for the record.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java