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

table: don't compare different types of handles #29600

Merged
merged 1 commit into from
Nov 11, 2021

Conversation

ekexium
Copy link
Contributor

@ekexium ekexium commented Nov 9, 2021

Signed-off-by: ekexium ekexium@gmail.com

What problem does this PR solve?

Issue Number: close #29520

Problem Summary:

What is changed and how it works?

A workaround: just don't compare different types of handles.

Check List

Tests

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

Documentation

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

Release note

None

Signed-off-by: ekexium <ekexium@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 9, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • MyonKeminta
  • cfzjywxk

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-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 Nov 9, 2021
@ekexium
Copy link
Contributor Author

ekexium commented Nov 9, 2021

/run-check_dev

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 10, 2021
@@ -136,7 +136,8 @@ func checkHandleConsistency(rowInsertion mutation, indexMutations []mutation, in
if err != nil {
return errors.Trace(err)
}
if indexHandle.Compare(insertionHandle) != 0 {
// NOTE: handle type can be different, see issue 29520
if indexHandle.IsInt() == insertionHandle.IsInt() && indexHandle.Compare(insertionHandle) != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about the common handle type?

Copy link
Contributor Author

@ekexium ekexium Nov 10, 2021

Choose a reason for hiding this comment

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

indexHandle.IsInt() == insertionHandle.IsInt()
will evaluate to
false == false

Copy link
Contributor

@cfzjywxk cfzjywxk Nov 10, 2021

Choose a reason for hiding this comment

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

Do we need to compare and check if indexHandle.IsCommon() == insertionHandle.IsCommon() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no such a method. I think we are only using IsInt() to distinguish handle types.

Copy link
Contributor

@MyonKeminta MyonKeminta Nov 10, 2021

Choose a reason for hiding this comment

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

I just notice there is an Equal method in the Handle interface which checks the type:

func (ih IntHandle) Equal(h Handle) bool {
	return h.IsInt() && int64(ih) == h.IntValue()
}

@ekexium Can we use this instead?

In this way the third kind of handle i.e. PartitionHandle (which is not used currently) can also be handled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then the problem is what we should do if Equal returns false. We can't tell if it's type mismatch or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have only two kind of handles that are usable now, I think indexHandle.IsInt() == insertionHandle.IsInt() is enough.
Maybe a better way is to add a method to get the kind, and check something like indexHandle.Kind() == insertionHandle.Kind().

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems we check the handle content if it's int type, if it's clustered index handle type or common type do we need to check if the content does match?

Copy link
Contributor

@MyonKeminta MyonKeminta Nov 10, 2021

Choose a reason for hiding this comment

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

@cfzjywxk The expression indexHandle.IsInt() == insertionHandle.IsInt() checks equality of two bools, rather than AND. Two falses evaluates to true.

Copy link
Contributor

Choose a reason for hiding this comment

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

This adds some implicit dependencies that there are two types of handle, as this constraint will not change very much seems it's fine.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 10, 2021
@ekexium ekexium merged commit 7849fd9 into pingcap:ft-data-inconsistency Nov 11, 2021
@guo-shaoge guo-shaoge added the needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 label Feb 14, 2022
@guo-shaoge
Copy link
Collaborator

@ekexium could you please continue work on this pr to cherry pick to v5.3. Thanks!

@ti-srebot
Copy link
Contributor

cherry pick to release-5.3 failed

@ekexium
Copy link
Contributor Author

ekexium commented Feb 14, 2022

@ekexium could you please continue work on this pr to cherry pick to v5.3. Thanks!

@guo-shaoge The feature is not contained in v5.3, not even in v5.4. Note this PR fixes in a separate feature branch :).

@guo-shaoge
Copy link
Collaborator

@ekexium could you please continue work on this pr to cherry pick to v5.3. Thanks!

@guo-shaoge The feature is not contained in v5.3, not even in v5.4. Note this PR fixes in a separate feature branch :).

Got it. Thx!

@ekexium ekexium removed the needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 label Feb 14, 2022
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/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants