eolivelli commented on code in PR #17164:
URL: https://github.com/apache/pulsar/pull/17164#discussion_r962829422


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -365,6 +372,50 @@ public void operationFailed(MetaStoreException e) {
         return updateCursorPropertiesResult;
     }
 
+    @Override
+    public CompletableFuture<Void> setCursorProperties(Map<String, String> 
cursorProperties) {
+        MutableObject<CompletableFuture<Void>> updateCursorPropertiesResultRef 
= new MutableObject<>();
+        CURSOR_PROPERTIES_UPDATER.updateAndGet(this, map -> {
+            Map<String, String> newProperties =
+                    cursorProperties == null ? new TreeMap<>() : new 
TreeMap<>(cursorProperties);
+            if (map != null) {
+                map.forEach((k, v) -> {
+                    if (((String) 
k).startsWith(CURSOR_INTERNAL_PROPERTY_PREFIX)) {
+                        newProperties.put((String) k, (String) v);
+                    }
+                });
+
+                
updateCursorPropertiesResultRef.setValue(asyncUpdateCursorProperties(newProperties));

Review Comment:
   the new properties must take effect only after they are persisted to storage.
   otherwise:
   - in case of failure the value is no consistent on storage
   - other readers of the value won't see the value consistently (who reads 
from this node may see something that will never been read)



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to