-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed readers backlog stats after data is skipped #7236
Fixed readers backlog stats after data is skipped #7236
Conversation
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Outdated
Show resolved
Hide resolved
PositionImpl highestPositionToDelete = new PositionImpl(firstNonDeletedLedger, -1); | ||
|
||
cursors.forEach(cursor -> { | ||
if (highestPositionToDelete.compareTo((PositionImpl) cursor.getMarkDeletedPosition()) > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we need to add check for non-durable cursor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for that, a durable cursor would have been already moved ahead, otherwise we wouldn't be trimming that ledger.
assertEquals(nonDurableCursor.getNumberOfEntries(), 6); | ||
assertEquals(nonDurableCursor.getNumberOfEntriesInBacklog(true), 6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why durable cursor has 5 backlogs, non-durable cursor has 6 backlogs? Shouldn't they be the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because the other cursor is positioned at the end of the 5th ledger, but not on the 6th. That means that only 4 ledgers are deleted. That cursor would move forward on the next mark-delete.
When advancing the non-durable cursor, we advance to the first available ledger and that might be before the durable cursor mark-delete position, but that's ok.
…l/ManagedLedgerImpl.java Co-authored-by: lipenghui <penghui@apache.org>
### Motivation The metrics for the reader backlog keep increasing when data is dropped because the reader cursor only moves on the next read attempt. Instead we should proactively move the cursor forward on the first valid ledger. (cherry picked from commit 6b9c90f)
### Motivation The metrics for the reader backlog keep increasing when data is dropped because the reader cursor only moves on the next read attempt. Instead we should proactively move the cursor forward on the first valid ledger. (cherry picked from commit 6b9c90f)
### Motivation The metrics for the reader backlog keep increasing when data is dropped because the reader cursor only moves on the next read attempt. Instead we should proactively move the cursor forward on the first valid ledger.
Motivation
The metrics for the reader backlog keep increasing when data is dropped because the reader cursor only moves on the next read attempt.
Instead we should proactively move the cursor forward on the first valid ledger.