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

expression: fix substring_index crash tiflash in some case #9137

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

wshwsh12
Copy link
Contributor

@wshwsh12 wshwsh12 commented Jun 11, 2024

What problem does this PR solve?

Issue Number: close #9116

Problem Summary:

What is changed and how it works?

Fix tiflash crash caused by function `substring_index` in some corner cases

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 tiflash crash caused by function `substring_index` in some corner cases

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 11, 2024
Copy link
Contributor

@windtalker windtalker 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 ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jun 11, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 11, 2024
Copy link
Contributor

ti-chi-bot bot commented Jun 11, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-06-11 08:21:06.073455064 +0000 UTC m=+452820.126766987: ☑️ agreed by windtalker.
  • 2024-06-11 08:26:12.780667263 +0000 UTC m=+453126.833979189: ☑️ agreed by solotzg.

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 assert(count != 0); after line 5214, or it may cause something wrong when it comes to the following branch with count == 0

if (count <= static_cast<Int64>(delim_pos.size()))
{
auto delim_count = delim_pos.size();
const UInt8 * match = delim_pos[delim_count - count];
begin = match + delim_size;
}

It is OK for now because count == 0 has some shortcuts in the upper level.

Copy link
Contributor

ti-chi-bot bot commented Jun 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described here

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

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jun 11, 2024
@ti-chi-bot ti-chi-bot bot merged commit 7d7622e into pingcap:master Jun 11, 2024
5 checks passed
@wshwsh12 wshwsh12 added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. labels Jun 11, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #9139.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #9140.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #9141.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #9142.

@ti-chi-bot ti-chi-bot added needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. labels Jun 11, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #9143.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-5.4: #9144.

ti-chi-bot bot pushed a commit that referenced this pull request Jun 12, 2024
…9141)

close #9116

Fix tiflash crash caused by function `substring_index` in some corner cases

Co-authored-by: wshwsh12 <793703860@qq.com>
ti-chi-bot bot pushed a commit that referenced this pull request Jun 12, 2024
…9143)

close #9116

Fix tiflash crash caused by function `substring_index` in some corner cases

Co-authored-by: wshwsh12 <793703860@qq.com>
ti-chi-bot bot pushed a commit that referenced this pull request Jun 12, 2024
…9139)

close #9116

Fix tiflash crash caused by function `substring_index` in some corner cases

Co-authored-by: wshwsh12 <793703860@qq.com>
ti-chi-bot bot pushed a commit that referenced this pull request Jun 12, 2024
…9142)

close #9116

Fix tiflash crash caused by function `substring_index` in some corner cases

Co-authored-by: wshwsh12 <793703860@qq.com>
ti-chi-bot bot added a commit that referenced this pull request Jun 13, 2024
…9140)

close #9116

Fix tiflash crash caused by function `substring_index` in some corner cases

Co-authored-by: wshwsh12 <793703860@qq.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
@ti-chi-bot ti-chi-bot removed the needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. label Jun 18, 2024
JaySon-Huang pushed a commit to JaySon-Huang/tiflash that referenced this pull request Aug 2, 2024
) (pingcap#9140)

close pingcap#9116

Fix tiflash crash caused by function `substring_index` in some corner cases

Co-authored-by: wshwsh12 <793703860@qq.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

substring_index may lead tiflash crash in some corner cases
5 participants