private void assignPartitions(SortedSet<TopicIdPartition> assignedPartitions) {
        // Update assignment in the subscription state, and ensure that no fetching or positions
        // initialization happens for the newly added partitions.
        updateSubscription(assignedPartitions);

        // Clear topic names cache, removing topics that are not assigned to the member anymore.
        Set<String> assignedTopics = assignedPartitions.stream().map(TopicIdPartition::topic).collect(Collectors.toSet());
        assignedTopicNamesCache.values().retainAll(assignedTopics);
    }
Make new assignment effective and update the local topic names cache, removing from it all topics that
are not assigned to the member anymore.

@param assignedPartitions Full assignment that will be updated in the member subscription
                          state. This includes previously owned and newly added partitions.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareMembershipManager.java