poorbarcode commented on code in PR #19737:
URL: https://github.com/apache/pulsar/pull/19737#discussion_r1155091377
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1008,17 +1029,15 @@ private CompletableFuture<? extends Subscription>
getNonDurableSubscription(Stri
}
Position startPosition = new PositionImpl(ledgerId, entryId);
- ManagedCursor cursor = null;
try {
- cursor = ledger.newNonDurableCursor(startPosition,
subscriptionName, initialPosition,
- isReadCompacted);
+ final ManagedCursor cursor =
ledger.newNonDurableCursor(startPosition, subscriptionName,
+ initialPosition, isReadCompacted);
+ subscriptions.computeIfAbsent(subscriptionName, k ->
+ new PersistentSubscription(this, subscriptionName,
cursor, false,
+ subscriptionProperties));
} catch (ManagedLedgerException e) {
return FutureUtil.failedFuture(e);
}
-
Review Comment:
Just guarantee the operation `create new sub` and `unload sub` will not be
executed concurrently. see
https://github.com/apache/pulsar/pull/19737#discussion_r1155090950
--
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]