pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://tidbcloud.com/free-trial
https://pingcap.com
Apache License 2.0
36.27k stars 5.72k forks source link

*: check delete unique key's handle to handle corner case #52975

Closed wjhuang2016 closed 2 days ago

wjhuang2016 commented 2 weeks ago

What problem does this PR solve?

Issue Number: close #52914

Problem Summary: Take the case from the issue, if an insert is executed during delete only, there is no record on the temporary index. Before the merge process, a delete operation may delete the index key value(generated by ingest) unexpectedly. To avoid this problem, we need to check if the delete value's handle is the same as we want to delete. If not, it means that the value we want to delete is covered by another value already, which shouldn't be deleted again.

What changed and how does it work?

Check List

Tests

Side effects

Documentation

Release note

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

fix a bug which may cause data consistency problem when adding unique index 
codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 67.85714% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 74.4875%. Comparing base (cc127c1) to head (70c4447). Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #52975 +/- ## ================================================ + Coverage 74.4290% 74.4875% +0.0584% ================================================ Files 1497 1518 +21 Lines 356920 447126 +90206 ================================================ + Hits 265652 333053 +67401 - Misses 71938 93665 +21727 - Partials 19330 20408 +1078 ``` | [Flag](https://app.codecov.io/gh/pingcap/tidb/pull/52975/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/pingcap/tidb/pull/52975/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `49.3421% <67.8571%> (?)` | | | [unit](https://app.codecov.io/gh/pingcap/tidb/pull/52975/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `71.3687% <28.5714%> (-1.8315%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap#carryforward-flags-in-the-pull-request-comment) to find out more. | [Components](https://app.codecov.io/gh/pingcap/tidb/pull/52975/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | Coverage Δ | | |---|---|---| | [dumpling](https://app.codecov.io/gh/pingcap/tidb/pull/52975/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `53.9957% <ø> (-2.3014%)` | :arrow_down: | | [parser](https://app.codecov.io/gh/pingcap/tidb/pull/52975/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `∅ <ø> (∅)` | | | [br](https://app.codecov.io/gh/pingcap/tidb/pull/52975/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `47.0120% <ø> (+4.0533%)` | :arrow_up: |
wjhuang2016 commented 2 weeks ago

/retest

wjhuang2016 commented 5 days ago

/retest

ti-chi-bot[bot] commented 2 days ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Benjamin2037, tangenta

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](https://github.com/pingcap/tidb/blob/master/OWNERS)~~ [Benjamin2037,tangenta] - ~~[pkg/ddl/OWNERS](https://github.com/pingcap/tidb/blob/master/pkg/ddl/OWNERS)~~ [Benjamin2037,tangenta] - ~~[pkg/table/OWNERS](https://github.com/pingcap/tidb/blob/master/pkg/table/OWNERS)~~ [Benjamin2037,tangenta] 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[bot] commented 2 days ago

[LGTM Timeline notifier]

Timeline:

wjhuang2016 commented 2 days ago

/retest

ti-chi-bot commented 2 days ago

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