coderzc commented on code in PR #17164:
URL: https://github.com/apache/pulsar/pull/17164#discussion_r952435063
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedCursor.java:
##########
@@ -86,14 +86,20 @@ enum IndividualDeletedEntries {
*/
Map<String, String> getCursorProperties();
- /**
- * Updates the properties.
- * @param cursorProperties
- * @return a handle to the result of the operation
- */
- default CompletableFuture<Void> setCursorProperties(Map<String, String>
cursorProperties) {
- return CompletableFuture.completedFuture(null);
- }
+ /**
+ * Add a property associated with the cursor.
+ */
+ void putCursorProperty(String key, String value);
+
+ /**
+ * Set all properties associated with the cursor, internal properties are
still preserved.
+ */
+ void setAllCursorProperties(Map<String, String> properties);
+
+ /**
+ * Remove a property associated with the cursor.
+ */
+ void removeCursorProperty(String key);
Review Comment:
> > What's wrong with using the synchronous method?
>
> The main reason to avoid blocking methods in Pulsar is to prevent blocking
Netty IO threads. Netty uses a small number of IO threads to execute and using
blocking on these threads could cause the execution of work assigned to Netty
event loops to not proceed as expected (other unrelated connections might hang
/ timeout / get delayed etc.). There are also other reasons to avoid
synchronous methods such as "[PIP-149 Making the REST Admin API fully
async](https://github.com/apache/pulsar/issues/14365)". (cc @Technoboy- and
@mattisonchao)
I see, I think can keep `CompletableFuture<Void>
setCursorProperties(Map<String, String> cursorProperties)` asynchronous method,
but need first update variable before update store.
And add `CompletableFuture<Void> putCursorProperty(String key, String
value)`/`CompletableFuture<Void> removeCursorProperty(String key)` to
add/remove single key value
--
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]