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

Move timeout to read task #18623

Open
wants to merge 2 commits into
base: master-2.x
Choose a base branch
from

Conversation

Haoning-Sun
Copy link
Contributor

What changes are proposed in this pull request?

Move timeout to read task. Make the task cancel when it times out.

Why are the changes needed?

Currently, the buffer will be released when the task times out, but the task is not cancelled. The buffer may continue to be used. The buffer is used by multiple tasks, which may cause some exceptions.

Copy link
Contributor

@jja725 jja725 left a comment

Choose a reason for hiding this comment

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

LGTM, @ccy00808 what do you think

@@ -339,8 +337,6 @@ public CompletableFuture<List<BlockStatus>> load(List<Block> blocks, UfsReadOpti
() -> manager.read(buf, block.getOffsetInFile(), blockSize, blockId,
block.getUfsPath(), options),
new ExponentialBackoffRetry(1000, 5000, 5))
// use orTimeout in java 11
.applyToEither(timeoutAfter(LOAD_TIMEOUT, TimeUnit.MILLISECONDS), d -> d)
Copy link
Contributor

Choose a reason for hiding this comment

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

mDelayer and LOAD_TIMEOUT are not used and deleted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants