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

Fix column mismatch #2785

Merged
merged 4 commits into from
Jul 25, 2024
Merged

Conversation

shiyuhang0
Copy link
Member

@shiyuhang0 shiyuhang0 commented Jul 17, 2024

What problem does this PR solve?

close #2750

fix column mismatch reported by tikv. https://github.com/tikv/tikv/blob/254ceaaa654a70d78919ee5d85f5b4cbe3c444a3/components/tidb_query_executors/src/index_scan_executor.rs#L113

This occurs when the primary_column_ids number is more than columns number in the index scan of DAGRequest. Example:

start_ts_fallback: 451202703803809793
executors {
  tp: TypeIndexScan
  idx_scan {
    table_id: 93
    index_id: 2
    columns {
      column_id: 1
      tp: 15
      collation: -46
      columnLen: 64
      decimal: 0
      flag: 4107
      default_val: "\000"
      pk_handle: false
    }
    columns {
      column_id: 2
      tp: 8
      collation: -63
      columnLen: 20
      decimal: 0
      flag: 4099
      default_val: "\000"
      pk_handle: false
    }
    primary_column_ids: 3
    primary_column_ids: 1
    primary_column_ids: 2
  }
}
executors {
  tp: TypeLimit
  limit {
    limit: 21
  }
}
time_zone_offset: -25200
flags: 0
output_offsets: 1
output_offsets: 0
encode_type: TypeChunk

What is changed and how it works?

Add primary columns to columns in index scan of DAGRequest when pk is command handle.

Add this because TiDB also do like this. Ref: https://github.com/pingcap/tidb/blob/ddcaadbb856f0890e91e4c77991f0d2aa5aa93d0/pkg/planner/core/planbuilder.go#L1515

Check List

Tests

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

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to update the tidb-ansible repository
  • Need to be included in the release note

@ti-chi-bot ti-chi-bot bot added the size/L label Jul 17, 2024
@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

2 similar comments
@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

@shiyuhang0 shiyuhang0 added needs-cherry-pick-release-3.2 needs-cherry-pick-release-3.1 PR which needs to be cherry-picked to release-3.1 labels Jul 23, 2024
@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

3 similar comments
@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

@shiyuhang0
Copy link
Member Author

/run-all-tests tidb=release-6.1 tikv=release-6.1 pd=release-6.1

Copy link

ti-chi-bot bot commented Jul 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xuanyu66, zhangyangyu

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

ti-chi-bot bot commented Jul 25, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-23 11:56:33.072751912 +0000 UTC m=+959815.063693367: ☑️ agreed by xuanyu66.
  • 2024-07-25 03:34:16.270161046 +0000 UTC m=+1102478.261102516: ☑️ agreed by zhangyangyu.

@ti-chi-bot ti-chi-bot bot merged commit fb08132 into pingcap:master Jul 25, 2024
14 checks passed
ti-chi-bot pushed a commit to ti-chi-bot/tispark that referenced this pull request Jul 25, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

shiyuhang0 added a commit that referenced this pull request Jul 25, 2024
* fix column mismatch

* fix

* fix index look up fail

* opt

---------

Co-authored-by: shiyuhang <[email protected]>
shiyuhang0 added a commit that referenced this pull request Jul 25, 2024
* This is an automated cherry-pick of #2785

Signed-off-by: ti-chi-bot <[email protected]>

* Update IssueTestSuite.scala

* Update IssueTestSuite.scala

---------

Signed-off-by: ti-chi-bot <[email protected]>
Co-authored-by: shi yuhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The number of handle columns exceeds the length of columns_info
4 participants