coderzc commented on code in PR #21940:
URL: https://github.com/apache/pulsar/pull/21940#discussion_r1473754516
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java:
##########
@@ -100,6 +105,35 @@ public boolean expireMessages(int messageTTLInSeconds) {
}
}
+ private boolean checkExpiryByLedgerClosureTime(ManagedCursor cursor, int
messageTTLInSeconds) {
+ if (cursor instanceof ManagedCursorImpl managedCursor) {
+ ManagedLedgerImpl managedLedger = (ManagedLedgerImpl)
managedCursor.getManagedLedger();
+ Position deletedPosition = managedCursor.getMarkDeletedPosition();
+ SortedMap<Long, MLDataFormats.ManagedLedgerInfo.LedgerInfo>
ledgerInfoSortedMap =
+ managedLedger.getLedgersInfo()
+ .subMap(deletedPosition.getLedgerId(),
managedLedger.getLedgersInfo().lastKey());
+ MLDataFormats.ManagedLedgerInfo.LedgerInfo info = null;
+ for (MLDataFormats.ManagedLedgerInfo.LedgerInfo ledgerInfo :
ledgerInfoSortedMap.values()) {
+ if (!ledgerInfo.hasTimestamp() ||
!MessageImpl.isEntryExpired(messageTTLInSeconds,
+ ledgerInfo.getTimestamp())) {
+ break;
+ }
+ info = ledgerInfo;
+ }
+ if (info != null && info.getLedgerId() > -1) {
+ PositionImpl position = PositionImpl.get(info.getLedgerId(),
info.getEntries() - 1);
+ PositionImpl newPosition =
managedLedger.getNextValidPosition(position);
Review Comment:
Why mark delete next position? The next position may not have expired yet.
--
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]