private void unsubscribeGroupFromTopic(
        String groupId,
        String topicName
    ) {
        groupsByTopics.computeIfPresent(topicName, (__, groupIds) -> {
            groupIds.remove(groupId);
            return groupIds.isEmpty() ? null : groupIds;
        });
    }
Unsubscribes a group from a topic.

@param groupId   The group id.
@param topicName The topic name.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java