Search before reporting
Motivation
See #25016 (comment)
Since #24622, when a managed ledger does not inherit ManagedLedgerImpl, the expiration check will use a different method, which is hard to test without a custom implementation.
if (managedLedger instanceof ManagedLedgerImpl ml) {
checkMessageExpiryWithSharedPosition(ml, messageTtlInSeconds);
} else {
// Fallback to the slower solution if managed ledger is not an instance of ManagedLedgerImpl: each
// subscription find position and handle expiring itself.
checkMessageExpiryWithoutSharedPosition(messageTtlInSeconds);
}
However, in checkMessageExpiryWithSharedPosition, the only operation is getting the cursor with oldest position:
private void checkMessageExpiryWithSharedPosition(ManagedLedgerImpl ml, int messageTtlInSeconds) {
// Find the target position at one time, then expire all subscriptions and replicators.
final var cursorWithOldestPosition = ml.getCursors().getCursorWithOldestPosition();
This should be a general operation that if the ManagedLedger#getCursors returns a correct cursor container, it should also work even if it's not a ManagedLedgerImpl.
Solution
No response
Alternatives
No response
Anything else?
No response
Are you willing to submit a PR?
Search before reporting
Motivation
See #25016 (comment)
Since #24622, when a managed ledger does not inherit
ManagedLedgerImpl, the expiration check will use a different method, which is hard to test without a custom implementation.However, in
checkMessageExpiryWithSharedPosition, the only operation is getting the cursor with oldest position:This should be a general operation that if the
ManagedLedger#getCursorsreturns a correct cursor container, it should also work even if it's not aManagedLedgerImpl.Solution
No response
Alternatives
No response
Anything else?
No response
Are you willing to submit a PR?