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

prefetch: fix underlying unexpected-eof taken as EOF #59752

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

D3Hunter
Copy link
Contributor

@D3Hunter D3Hunter commented Feb 25, 2025

What problem does this PR solve?

Issue Number: ref #59495

Problem Summary:

What changed and how does it work?

the underlying reader might also return unexpected-eof, we need different between them, introduced in #59496

  • add rangeSize to prefetch.Reader to determine where UnexpectedEOF comes from
  • check error equals using goerrors.Is instead of ==. we might add stack to the error to help debug
    • Note: for the implementation of io.Reader, we still follow the API definition to return the io.EOF directly without stack, our byteReader doesn't follow the API of io.Reader, so it's ok to add stack to the error
    • And to unify code, we always use goerrors.Is to check io.EOF even for errors from io.Reader
  • avoid retry when context cancel

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

same test in #50451, before it will fail with unexpected-eof, now success

  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Feb 25, 2025
Copy link

ti-chi-bot bot commented Feb 25, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from d3hunter, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 25, 2025
Copy link

tiprow bot commented Feb 25, 2025

Hi @D3Hunter. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@@ -87,13 +86,7 @@ func (r *concurrentFileReader) read(bufs [][]byte) ([][]byte, error) {
buf,
)
if err != nil {
log.FromContext(r.ctx).Error(
Copy link
Contributor Author

@D3Hunter D3Hunter Feb 25, 2025

Choose a reason for hiding this comment

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

it prints too many logs when context cancel due to some goroutine in the same group failed, it's not needed, there is no further usefully info in it.

@@ -977,7 +983,7 @@ func (r *s3ObjectReader) Read(p []byte) (n int, err error) {
n, err = r.reader.Read(p[:maxCnt])
// TODO: maybe we should use !errors.Is(err, io.EOF) here to avoid error lint, but currently, pingcap/errors
// doesn't implement this method yet.
for err != nil && errors.Cause(err) != io.EOF && retryCnt < maxErrorRetries { //nolint:errorlint
for err != nil && errors.Cause(err) != io.EOF && r.ctx.Err() == nil && retryCnt < maxErrorRetries { //nolint:errorlint
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need to retry on context cancel

Copy link

codecov bot commented Feb 25, 2025

Codecov Report

Attention: Patch coverage is 80.59701% with 13 lines in your changes missing coverage. Please review.

Project coverage is 74.6646%. Comparing base (a5d433a) to head (4d4b432).
Report is 13 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59752        +/-   ##
================================================
+ Coverage   72.9537%   74.6646%   +1.7109%     
================================================
  Files          1697       1743        +46     
  Lines        468912     478514      +9602     
================================================
+ Hits         342089     357281     +15192     
+ Misses       105752      98695      -7057     
- Partials      21071      22538      +1467     
Flag Coverage Δ
integration 48.8150% <0.0000%> (?)
unit 72.1729% <80.5970%> (+0.0239%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 61.3519% <50.0000%> (+16.2525%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant