Skip to content

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #10341

What problem does this PR solve?

Issue Number: close #10340

Problem Summary:

When there are multiple NULL rows of Strings-like column or vector-like column, TiFlash may save some "empty blocks" into the DMFile. And it happen to be the "empty blocks" are stored at the end of the DMFile.

When TiFlash try to read data from disk, DMFileReader::readFromDisk will first call FramedChecksumReadBuffer::doSeek and seek to the "empty block" at the file end. The working_buffer will be release because we read to the end of the file. When TiFlash try to seek to the next "empty block", pos move forward the released working_buffer, leading to reading random data and cause random failure.

type_on_disk->deserializeBinaryBulkWithMultipleStreams( //
*mutable_col,
[&](const IDataType::SubstreamPath & substream_path) {
const auto substream_name = DMFile::getFileNameBase(cd.id, substream_path);
auto & sub_stream = column_streams.at(substream_name);
sub_stream->buf->seek(
sub_stream->getOffsetInFile(start_pack_id),
sub_stream->getOffsetInDecompressedBlock(start_pack_id));
return sub_stream->buf.get();
},
read_rows,
top_stream->avg_size_hint,
true,
{});

if (target_frame == current_frame)
{
pos = working_buffer.begin() + target_offset;
return offset;
}

What is changed and how it works?

1. In `FramedChecksumReadBuffer::doSeek`, add guard check for `working_buffer` size and `target_offset`. If the working_buffer is cleared, then re-seek the working buffer according to the offset and load data from the underlying file again.
2. In order to support the behavior above, `S3RandomAccessFile::seekImpl` support seek backward, which is implemented by reopening the file again
3. Add retry when reading from S3 meet errno=115, EINPROGRESS

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 possible read fail when column data contains lots of "NULL" values.

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.1 This PR is cherry-picked to release-8.1 from a source PR. labels Aug 20, 2025
@ti-chi-bot ti-chi-bot mentioned this pull request Aug 20, 2025
12 tasks
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 20, 2025

This cherry pick PR is for a release branch and has not yet been approved by triage owners.
Adding the do-not-merge/cherry-pick-not-approved label.

To merge this cherry pick:

  1. It must be approved by the approvers firstly.
  2. AFTER it has been approved by approvers, please wait for the cherry-pick merging approval from triage owners.
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 kubernetes-sigs/prow repository.

@ti-chi-bot
Copy link
Member Author

@Lloyd-Pottiger 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 Aug 20, 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 assign littlefall for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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
Copy link
Contributor

ti-chi-bot bot commented Aug 20, 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
Copy link
Contributor

ti-chi-bot bot commented Aug 20, 2025

@ti-chi-bot: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-integration-test 79e4c09 link true /test pull-integration-test
pull-unit-test 79e4c09 link true /test pull-unit-test

Full PR test history. Your PR dashboard.

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/cherry-pick-not-approved 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.1 This PR is cherry-picked to release-8.1 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants