lhotari commented on code in PR #15067:
URL: https://github.com/apache/pulsar/pull/15067#discussion_r849125281
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -1793,6 +1830,34 @@ protected void internalAsyncMarkDelete(final
PositionImpl newPosition, Map<Strin
}
void internalMarkDelete(final MarkDeleteEntry mdEntry) {
+ if (persistentMarkDeletePosition != null
+ && mdEntry.newPosition.compareTo(persistentMarkDeletePosition)
< 0) {
+ if (log.isInfoEnabled()) {
+ log.info("Skipping updating mark delete position to {}. The
persisted mark delete position {} "
+ + "is latest.", mdEntry.newPosition,
persistentMarkDeletePosition);
+ }
+ mdEntry.triggerComplete();
+ return;
+ }
+
+ PositionImpl inProgressLatest =
INPROGRESS_MARKDELETE_PERSIST_POSITION_UPDATER.updateAndGet(this, current -> {
+ if (current != null && current.compareTo(mdEntry.newPosition) > 0)
{
+ return current;
+ } else {
+ return mdEntry.newPosition;
+ }
+ });
+
+ // if there's a newer or equal mark delete update in progress, skip it.
+ if (inProgressLatest != mdEntry.newPosition) {
+ if (log.isInfoEnabled()) {
+ log.info("Skipping updating mark delete position to {}. The
mark delete position update "
+ + "in progress {} is latest.", mdEntry.newPosition,
inProgressLatest);
+ }
+ mdEntry.triggerComplete();
Review Comment:
You are right that it would seem like the correct solution. It would add
more complexity to solve it in that way.
I doubt that there would be an actual benefit. I'd rather solve this later
in a way where concurrency is eliminated by using a single threaded model
similar to an actor model.
--
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]