-
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
[Broker] Async read entries with max size bytes #9532
Conversation
…ies with max size bytes.
/pulsarbot run-failure-checks |
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.
LGTM
@Test(timeOut = 20000) | ||
void testAsyncReadWithMaxSizeByte() throws Exception { | ||
ManagedLedger ledger = factory.open("testAsyncReadWithMaxSizeByte"); | ||
ManagedCursor cursor = ledger.openCursor("c1"); |
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.
we aren't closing this resources.
Do you think we can add @cleanup annotations in this file in all of the tests ?
(not blocker for me)
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 ok in these tests, the factory gets re-created after each test and it automatically closes everything in the shutdown.
Motivation
Currently, we could specify the param
maxSizeBytes
when reading entries by the methodasyncReadEntriesOrWait
, but this method will be blocked when there are no entries to read. So I want to add a new method to read entries with parammaxSizeBytes
and return data immediately if there are no entries to read.Modifications
asyncReadEntries(int numberOfEntriesToRead, long maxSizeBytes, ReadEntriesCallback callback, Object ctx, PositionImpl maxPosition)
in the interfaceManagedCursor
.asyncReadEntries(int numberOfEntriesToRead, long maxSizeBytes, ReadEntriesCallback callback, Object ctx, PositionImpl maxPosition)
in the interfaceReadOnlyCursor
.Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changes