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

executor: Add Global to SHOW INDEX output | tidb-test=pr/2391 #56028

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

samba-rgb
Copy link
Contributor

@samba-rgb samba-rgb commented Sep 11, 2024

What problem does this PR solve?

No info about index if its global or not , added in show index in this pr

Issue Number: close #55452

Problem Summary:

What changed and how does it work?

added Global index from index info

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

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

Release note

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

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels Sep 11, 2024
@sre-bot
Copy link
Contributor

sre-bot commented Sep 11, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

ti-chi-bot bot commented Sep 11, 2024

Welcome @samba-rgb!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

@ti-chi-bot ti-chi-bot bot added sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Sep 11, 2024
Copy link

ti-chi-bot bot commented Sep 11, 2024

Hi @samba-rgb. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

tiprow bot commented Sep 11, 2024

Hi @samba-rgb. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@samba-rgb samba-rgb changed the title Add Global to SHOW INDEXE output: show.go Add Global to SHOW INDEX output: show.go Sep 11, 2024
@lance6716
Copy link
Contributor

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Sep 12, 2024
@lance6716 lance6716 changed the title Add Global to SHOW INDEX output: show.go executor: Add Global to SHOW INDEX output Sep 12, 2024
Copy link

codecov bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.9314%. Comparing base (ebf3146) to head (efbca50).
Report is 46 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #56028         +/-   ##
=================================================
- Coverage   72.9003%   56.9314%   -15.9689%     
=================================================
  Files          1604       1783        +179     
  Lines        446755     640621     +193866     
=================================================
+ Hits         325686     364715      +39029     
- Misses       101023     250956     +149933     
- Partials      20046      24950       +4904     
Flag Coverage Δ
integration 39.5170% <62.5000%> (?)
unit 72.1813% <100.0000%> (+0.1770%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 61.9809% <ø> (+16.2097%) ⬆️

Copy link
Contributor

@mjonss mjonss left a comment

Choose a reason for hiding this comment

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

Looks good, with some comments.
There are also more tests that needs to update (since the SHOW INDEX output changed).
You can run all unit tests with make dev and you can run integration tests by first building the tidb-server binary with make and then (cd tests/integrationtest ; ./run-tests.sh -s ../../bin/tidb-server)

isPartitioned := pi != nil && pi.Type != pmodel.PartitionTypeNone

if isPartitioned && e.Ctx().GetSessionVars().EnableGlobalIndex {
isGlobalIndex = "YES"
Copy link
Contributor

Choose a reason for hiding this comment

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

If PKIsHandle, then it is by definition a LOCAL index, i.e. each partition will have the clustered index, and the PK column must be a part of the partitioning expression.

Test by:

set tidb_enable_global_index = 0;
create table t (a int primary key clustered, b int) partition by hash (a) partitions 2;
show create table t;
show index from t;
set tidb_enable_global_index = 1;
show index from t;

@@ -822,6 +832,7 @@ func (e *ShowExec) fetchShowIndex() error {
"YES", // Index_visible
nil, // Expression
"YES", // Clustered
isGlobalIndex, // Global_index
Copy link
Contributor

Choose a reason for hiding this comment

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

So here you can just use "NO"

Suggested change
isGlobalIndex, // Global_index
"NO", // Global_index

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, sorry, I had not indented it correctly :(

pkg/executor/show_test.go Outdated Show resolved Hide resolved
@mjonss
Copy link
Contributor

mjonss commented Sep 18, 2024

@samba-rgb I can fix the idc-jenkins-ci-tidb/mysql-test test failures. Can you fix the other failed tests?

@mjonss mjonss changed the title executor: Add Global to SHOW INDEX output executor: Add Global to SHOW INDEX output | tidb-test=pr/2391 Sep 18, 2024
@samba-rgb
Copy link
Contributor Author

samba-rgb commented Sep 18, 2024

@mjonss Thank you for helping with my SQL test fix. I will now resume working on the fixes for integration and unit tests, along with addressing the comments mentioned above.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 18, 2024
@samba-rgb
Copy link
Contributor Author

samba-rgb commented Sep 18, 2024

Hi @mjonss i added the Global column in the integrationtest/r//.result path
example : tidb/tests/integrationtest/r/session/clustered_index.result
but still in the check_dev its not reflecting
is their any place that i need to change/add

BTW when i ran make dev no test case is running for me
find: md5sum: No such file or directory

@mjonss
Copy link
Contributor

mjonss commented Sep 18, 2024

Hi @mjonss i added the Global column in the integrationtest/r//.result path example : tidb/tests/integrationtest/r/session/clustered_index.result but still in the check_dev its not reflecting is their any place that i need to change/add

BTW when i ran make dev no test case is running for me find: md5sum: No such file or directory

@samba-rgb
For the integration tests, you can simply re-record the result files, it seems like there is some formatting issues in your change, likely spaces instead of tabs. Try ./run-tests.sh -s ../../bin/tidb-server -r session/clustered_index and it will overwrite the .result file, and you can try with ./run-tests.sh -s ../../bin/tidb-server -t session/clustered_index to verify that it passes.

I assume you are using a mac? md5sum is md5 in macOs..., you can also run only the unit tests with make ut IIRC.
Also if there are a few integration tests that fails on mac, it is due to floating point difference between arm and i386, so leave them as-is.

I will try to find which unit tests still needing to be updated.

@mjonss
Copy link
Contributor

mjonss commented Sep 18, 2024

pkg/ddl/db_change_test.go:857
Error: Received unexpected error:
need [[t 0 PRIMARY 1 c1 A 0 BTREE YES NO]], but got [[t 0 PRIMARY 1 c1 A 0 BTREE YES NO NO]]
Test: TestShowIndex

To run the test you must also enable failpoints, make failpoint-enable, which you then can disable before committing, make failpoint-disable
Maybe this patch file could help?
56028.patch

Copy link
Contributor

@mjonss mjonss left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! Approved.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 19, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 19, 2024
Copy link

ti-chi-bot bot commented Sep 19, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-19 13:15:32.118205208 +0000 UTC m=+1139801.858629146: ☑️ agreed by mjonss.
  • 2024-09-19 13:30:09.190267371 +0000 UTC m=+1140678.930691310: ☑️ agreed by lance6716.

Copy link

ti-chi-bot bot commented Sep 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, mjonss, 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:

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 ti-chi-bot bot added the approved label Sep 19, 2024
@ti-chi-bot ti-chi-bot bot merged commit 66d8cdc into pingcap:master Sep 19, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Global" to SHOW INDEXES output
5 participants