Jason918 commented on code in PR #17164:
URL: https://github.com/apache/pulsar/pull/17164#discussion_r972547777
##########
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:
> 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
From caller's perspective, if they calls `set` and `remove` concurrently,
the resulting order should be undefined.
Maybe the operating order should be maintained by caller.
--
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]