xuesongxs commented on pull request #9999: URL: https://github.com/apache/pulsar/pull/9999#issuecomment-809820131
> conf.clone() is a shallow copy. Modifying the Set in the cloned object will affect the original conf. > So, I think the better way is to do a deep copy, such as: > > ``` > Set<String> clonedSet = new HashSet<>(cloneConf.getTopicNames()); > clonedSet.remove(topicName); > ``` > > https://github.com/apache/pulsar/blob/ccecd031ce2e5d459717c433107a7abc58046cae/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java#L838-L840  At present, the code used by pulsar to create consumers is deep copy, but after two clones, the conf after the first clone will delete the topic in cloneconf. The conf from the second clone is based on the conf from the first clone. Even if it is a deep copy, the data can not be copied, but the value in the original conf has not been deleted. When creating a partitioned consumer, consumerstat The log output in the srecorderimpl class uses the conf from the last clone. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
