Skip to content

IO: Fix infinity retries when meet network partition with S3 (#10447)#10449

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:release-8.5from
ti-chi-bot:cherry-pick-10447-to-release-8.5
Sep 22, 2025
Merged

IO: Fix infinity retries when meet network partition with S3 (#10447)#10449
ti-chi-bot[bot] merged 3 commits intopingcap:release-8.5from
ti-chi-bot:cherry-pick-10447-to-release-8.5

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #10447

What problem does this PR solve?

Issue Number: close #10424

Problem Summary:

S3RandomAccessFile may return S3StreamError(-2) as return value in read / seek. However, ReadBufferFromRandomAccessFile only check whether the return value of read is -1. This will lead to infinity retries when we happen to create a S3RandomAccessFile successfully, but later can not read from S3.

size_t bytes_read = 0;
while (!bytes_read)
{
ProfileEvents::increment(ProfileEvents::ReadBufferFromFileDescriptorRead);
ssize_t res = 0;
{
res = file->read(internal_buffer.begin(), internal_buffer.size());
}
if (!res)
break;
if (-1 == res && errno != EINTR)
{
ProfileEvents::increment(ProfileEvents::ReadBufferFromFileDescriptorReadFailed);
throwFromErrno("Cannot read from file " + getFileName(), ErrorCodes::CANNOT_READ_FROM_FILE_DESCRIPTOR);
}
if (res > 0)
bytes_read += res;
}

What is changed and how it works?

* `S3RandomAccessFile::initialize` now directly throw an exception when exceed the max retries time
* Change the return value check of seek, read from `!= -1` to `< 0`
* Add attribute `[[nodiscard]]` for seek, read, write, pread, pwrite
* Tune the AWS error level logging to warning level

Check List

Tests

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

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

Fix the issue that TiFlash may retries infinity when meet network partition with S3

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Sep 19, 2025
@ti-chi-bot
Copy link
Member Author

@JaySon-Huang This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 19, 2025

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 19, 2025
Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cherry-pick-approved Cherry pick PR approved by release team. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. do-not-merge/cherry-pick-not-approved labels Sep 19, 2025
Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 22, 2025
Copy link
Member

@CalvinNeo CalvinNeo left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 22, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CalvinNeo, JaySon-Huang

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [CalvinNeo,JaySon-Huang]

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 22, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 22, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-09-22 02:23:48.901734011 +0000 UTC m=+237038.972227699: ☑️ agreed by JaySon-Huang.
  • 2025-09-22 02:57:44.489852548 +0000 UTC m=+239074.560346223: ☑️ agreed by CalvinNeo.

@JaySon-Huang
Copy link
Contributor

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 22, 2025
@JaySon-Huang
Copy link
Contributor

/test pull-unit-test

@ti-chi-bot ti-chi-bot bot merged commit 496ffee into pingcap:release-8.5 Sep 22, 2025
4 checks passed
@ti-chi-bot ti-chi-bot bot deleted the cherry-pick-10447-to-release-8.5 branch September 22, 2025 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants