coderzc commented on code in PR #17164:
URL: https://github.com/apache/pulsar/pull/17164#discussion_r972556310
##########
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
I think the zookeeper will guarantee that the task execution sequence and
all callbacks are executed serially in the same thread, so it conforms to
linearizable semantics.
--
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]