massakam commented on a change in pull request #10790:
URL: https://github.com/apache/pulsar/pull/10790#discussion_r648516867



##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
##########
@@ -285,6 +285,37 @@ public MarkDeleteEntry(PositionImpl newPosition, 
Map<String, Long> properties,
         return lastMarkDeleteEntry != null ? lastMarkDeleteEntry.properties : 
Collections.emptyMap();
     }
 
+    @Override
+    public boolean putProperty(String key, Long value) {
+        if (lastMarkDeleteEntry != null) {
+            MarkDeleteEntry currentLastMarkDeleteEntry = lastMarkDeleteEntry;
+            Map<String, Long> properties = 
currentLastMarkDeleteEntry.properties;
+            if (properties == null || properties.isEmpty()) {
+                Map<String, Long> newProperties = Maps.newHashMap();
+                newProperties.put(key, value);
+                lastMarkDeleteEntry = new 
MarkDeleteEntry(currentLastMarkDeleteEntry.newPosition, newProperties,
+                        currentLastMarkDeleteEntry.callback, 
currentLastMarkDeleteEntry.ctx);
+                lastMarkDeleteEntry.callbackGroup = 
currentLastMarkDeleteEntry.callbackGroup;
+            } else {
+                properties.put(key, value);
+            }
+            return true;
+        }
+        return false;

Review comment:
       Fixed to return an error response when `lastMarkDeleteEntry` is null. 
However, if an instance of `PersistentSubscription` exists, the cursor should 
have already been initialized and `lastMarkDeleteEntry` should be set to a 
non-null value. So the REST API won't actually return that error.




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


Reply via email to