codelipenghui commented on code in PR #17164:
URL: https://github.com/apache/pulsar/pull/17164#discussion_r972118230
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -350,21 +356,48 @@ public void operationComplete(Void result, Stat stat) {
public void operationFailed(MetaStoreException e) {
log.error("[{}] Error while updating ledger cursor: {}
properties {}", ledger.getName(),
name, cursorProperties, e);
- updateCursorPropertiesResult.completeExceptionally(e);
+ // if resource is updated by other operate then we
will get bad-version exception
+ // so, retry the operation.
+ if (e instanceof
ManagedLedgerException.BadVersionException) {
+
asyncReadAndUpdateCursorProperties(updateFunction).whenComplete((__, ex) -> {
Review Comment:
For example:
If we want to update the key A to value 1 (current is 0)
Another operation removed the key A
After the retry, we will put key A back
We'd better expose the Exception to the callers? they might need to read the
properties again and reorganize what to modify
--
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]