codelipenghui commented on a change in pull request #9900:
URL: https://github.com/apache/pulsar/pull/9900#discussion_r594869412
##########
File path:
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/MetadataCache.java
##########
@@ -103,6 +103,18 @@
*/
CompletableFuture<Void> readModifyUpdate(String path, Function<T, T>
modifyFunction);
Review comment:
```suggestion
default CompletableFuture<Void> readModifyUpdate(String path,
Function<T, T> modifyFunction) {
return readModifyUpdate(path, modifyFunction, false);
}
```
##########
File path:
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/MetadataCache.java
##########
@@ -103,6 +103,18 @@
*/
CompletableFuture<Void> readModifyUpdate(String path, Function<T, T>
modifyFunction);
+ /**
+ * Perform an atomic read-modify-update of the value.
+ * <p>
+ * And the read value will be cloned to avoid directly modifying the
reference.
+ * <p>
+ * The modify function can potentially be called multiple times if there
are concurrent updates happening.
+ * @param path
+ * @param modifyFunction
+ * @return
+ */
+ CompletableFuture<Void> readCloneModifyUpdate(String path, Function<T, T>
modifyFunction);
Review comment:
```suggestion
CompletableFuture<Void> readModifyUpdate(String path, Function<T, T>
modifyFunction, boolean cloneData);
```
----------------------------------------------------------------
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]