private Set<String> removeSubscriptionInternal(
      @NonNull final String consumerId, final Set<String> topics) {
    if (!consumerIdToConsumerMeta.containsKey(consumerId)) {
      throw new SubscriptionException(
          String.format(
              "Failed to remove subscription from consumer group meta: consumer %s does not exist in consumer group %s",
              consumerId, consumerGroupId));
    }

    final Set<String> noSubscriptionTopicAfterRemoval = new HashSet<>();
    for (final String topic : topics) {
      if (topicNameToSubscribedConsumerIdSet.containsKey(topic)) {
        topicNameToSubscribedConsumerIdSet.get(topic).remove(consumerId);
        if (topicNameToSubscribedConsumerIdSet.get(topic).isEmpty()) {
          // remove subscription for consumer group
          noSubscriptionTopicAfterRemoval.add(topic);
          topicNameToSubscribedConsumerIdSet.remove(topic);
          if (shouldRecordSubscriptionCreationTime()) {
            topicNameToSubscriptionCreationTime.remove(topic);
          }
        }
      }
    }
    return noSubscriptionTopicAfterRemoval;
  }
@return topics subscribed by no consumers in this group after this removal.
@param consumerId if null, remove subscriptions of topics for all consumers
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/subscription/meta/consumer/ConsumerGroupMeta.java