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) #2786

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #2785

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

Copy link

ti-chi-bot bot commented Jul 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shiyuhang0

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-25 03:41:27.127348647 +0000 UTC m=+1102909.118290116: ☑️ agreed by shiyuhang0.

@shiyuhang0 shiyuhang0 merged commit ac3b26a into pingcap:release-3.1 Jul 25, 2024
5 of 6 checks passed
@shiyuhang0 shiyuhang0 deleted the cherry-pick-2785-to-release-3.1 branch July 25, 2024 08:02
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.

2 participants