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://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.4k stars 5.73k forks source link

statistics: fix wrong behavior for primary key' non-lite init stats #53298

Closed hawkingrei closed 1 month ago

hawkingrei commented 1 month ago

What problem does this PR solve?

Issue Number: ref #37548

Problem Summary:

What changed and how does it work?

primary key's is_index is false. so it cannot load the topn. it's stats cannon be set as AllFull.

Check List

Tests

according to https://github.com/pingcap/tidb/issues/37548, it's result is right.

Side effects

Documentation

Release note

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

None
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 74.2138%. Comparing base (76133dc) to head (c9fbfa5). Report is 6 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #53298 +/- ## ================================================ + Coverage 72.4355% 74.2138% +1.7783% ================================================ Files 1494 1497 +3 Lines 429347 432892 +3545 ================================================ + Hits 311000 321266 +10266 + Misses 99066 91416 -7650 - Partials 19281 20210 +929 ``` | [Flag](https://app.codecov.io/gh/pingcap/tidb/pull/53298/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/53298/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `47.4137% <0.0000%> (?)` | | 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/53298/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/53298/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `53.9957% <ø> (ø)` | | | [parser](https://app.codecov.io/gh/pingcap/tidb/pull/53298/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/53298/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `50.0881% <ø> (+8.6579%)` | :arrow_up: |
ti-chi-bot[bot] commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qw4990, winoros

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: - ~~[pkg/statistics/OWNERS](https://github.com/pingcap/tidb/blob/master/pkg/statistics/OWNERS)~~ [qw4990,winoros] 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 1 month ago

[LGTM Timeline notifier]

Timeline:

hawkingrei commented 1 month ago

/cherrypick release-8.1

ti-chi-bot commented 1 month ago

@hawkingrei: new pull request created to branch release-8.1: #53304.

In response to [this](https://github.com/pingcap/tidb/pull/53298#issuecomment-2112867158): >/cherrypick release-8.1 Instructions for interacting with me using PR comments are available [here](https://prow.tidb.net/command-help). If you have questions or suggestions related to my behavior, please file an issue against the [ti-community-infra/tichi](https://github.com/ti-community-infra/tichi/issues/new?title=Prow%20issue:) repository.
hawkingrei commented 3 weeks ago

/cherrypick release-7.5

ti-chi-bot commented 3 weeks ago

@hawkingrei: new pull request created to branch release-7.5: #53418.

In response to [this](https://github.com/pingcap/tidb/pull/53298#issuecomment-2121487647): >/cherrypick release-7.5 Instructions for interacting with me using PR comments are available [here](https://prow.tidb.net/command-help). If you have questions or suggestions related to my behavior, please file an issue against the [ti-community-infra/tichi](https://github.com/ti-community-infra/tichi/issues/new?title=Prow%20issue:) repository.
ti-chi-bot commented 2 weeks ago

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