Skip to content
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

[BP-62] Refactor read op, and introduce batchReadOp. #4190

Merged
merged 7 commits into from
Feb 5, 2024

Conversation

horizonzy
Copy link
Member

@horizonzy horizonzy commented Jan 27, 2024

Motivation

This is the fourth PR for the batch read(#4051) feature.

Refactor read op, extract ReadOpBase. Introduce batchedReadOp.

this.requestTimeNanos = MathUtils.nowInNano();
List<BookieId> ensemble = getLedgerMetadata().getEnsembleAt(startEntryId);
if (parallelRead) {
LOG.info("Batch read unsupported the parallelRead, fail back to sequence read.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fallback

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BatchedReadOp extends ReadOpBase implements BatchedReadEntryCallback {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd better add a test for BatchedReadOp and PendingReadOp to cover this change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class TestParallelRead already covers the PendingReadOp. And I will cover the BatchedReadOp at the next PR. At the next PR, I will introduce the batch read API in LedgerHandle.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a unit test to ensure the bytebuf ref count is correct and the request is handled correctly, like how the ParallelRead test did?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a unit test to ensure the bytebuf ref count is correct and the request is handled correctly, like how the ParallelRead test did?

That makes sense. We would better rely on the LedgerHandle to test it. This PR just refactors the code, we should ensure the PendingReadOp works as well as before.

At the next PR, I will introduce tests to cover BatchedReadOP.

@hangc0276
Copy link
Contributor

@merlimat @lhotari @eolivelli Please help take a look, thanks.

@horizonzy
Copy link
Member Author

rerun failure checks

@hangc0276 hangc0276 merged commit e1d72cf into apache:master Feb 5, 2024
16 checks passed
hangc0276 pushed a commit that referenced this pull request Feb 5, 2024
### Motivation
This is the fifth PR for the batch read(#4051) feature.

LedgerHandle introduces batch read API.

This PR is based on #4190, please merge it firstly.
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
### Motivation
This is the fourth PR for the batch read(apache#4051) feature.

Refactor read op, extract ReadOpBase. Introduce batchedReadOp.
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
### Motivation
This is the fifth PR for the batch read(apache#4051) feature.

LedgerHandle introduces batch read API.

This PR is based on apache#4190, please merge it firstly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants