tidb icon indicating copy to clipboard operation
tidb copied to clipboard

executor,infoschema: Add pad_attribute to collation info | tidb-test=pr/2354

Open dveeden opened this issue 1 year ago • 10 comments

What problem does this PR solve?

Issue Number: close #54250

Problem Summary:

What changed and how does it work?

Check List

Tests

  • [x] Unit test
  • [x] Integration test
  • [x] 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.

A `pad_attribute` column has been included in the `information_schema.collations` table and in the output of `SHOW COLLATION` to improve MySQL compatibility.

dveeden avatar Jun 27 '24 08:06 dveeden

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

ti-chi-bot[bot] avatar Jun 27 '24 08:06 ti-chi-bot[bot]

Hi @dveeden. 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.

tiprow[bot] avatar Jun 27 '24 08:06 tiprow[bot]

/ok-to-test

dveeden avatar Jun 27 '24 08:06 dveeden

Codecov Report

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

Project coverage is 57.0857%. Comparing base (184b010) to head (49e4f77). Report is 115 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54282         +/-   ##
=================================================
- Coverage   74.7619%   57.0857%   -17.6762%     
=================================================
  Files          1523       1672        +149     
  Lines        361410     628800     +267390     
=================================================
+ Hits         270197     358955      +88758     
- Misses        71584     246260     +174676     
- Partials      19629      23585       +3956     
Flag Coverage Δ
integration 39.3275% <100.0000%> (?)
unit 71.8014% <86.6666%> (-1.8516%) :arrow_down:

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

Components Coverage Δ
dumpling 52.9656% <ø> (-2.2339%) :arrow_down:
parser ∅ <ø> (∅)
br 52.7049% <ø> (+4.7412%) :arrow_up:

codecov[bot] avatar Jun 27 '24 09:06 codecov[bot]

/test mysql-test

dveeden avatar Jun 27 '24 10:06 dveeden

@dveeden: The specified target(s) for /test were not found. The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test mysql-test

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.

tiprow[bot] avatar Jun 27 '24 10:06 tiprow[bot]

/retest

dveeden avatar Jun 27 '24 13:06 dveeden

Sortlen in MySQL is defined as "related to the amount of memory required to sort strings expressed in the character set", but the meaning of the value is never explained. According to https://dba.stackexchange.com/questions/281360/whats-sortlen-of-mysql-collation

After 20 years of using MySQL, I have found no end-user use for Sortlen. Ignore it.

If we need to copy the result exactly from MySQL then many of the filled in sortlen are wrongly set to 1 in this PR:

mysql> select any_value(collation_name), sortlen, count(*) from information_schema.collations group by sortlen;
+---------------------------+---------+----------+
| any_value(collation_name) | sortlen | count(*) |
+---------------------------+---------+----------+
| armscii8_general_ci       |       1 |       98 |
| cp1250_czech_cs           |       2 |        3 |
| gb18030_unicode_520_ci    |       8 |      121 |
| latin2_czech_cs           |       4 |        2 |
| utf8mb4_0900_ai_ci        |       0 |       61 |
| utf8mb4_ja_0900_as_cs_ks  |      24 |        1 |
+---------------------------+---------+----------+
6 rows in set (0.02 sec)

OTOH if we accept sortlen is meaningless then keeping them as 1 should be good enough.

kennytm avatar Jun 27 '24 16:06 kennytm

I adjusted the sortlen for the collations in the new framework only and kept the rest to 1 as previously reported by show collations.

Don't think it is used anywhere.

dveeden avatar Jun 27 '24 17:06 dveeden

@hawkingrei @lcwangchao

D3Hunter avatar Jul 10 '24 07:07 D3Hunter

[LGTM Timeline notifier]

Timeline:

  • 2024-07-09 16:04:22.240637097 +0000 UTC m=+373559.475871211: :ballot_box_with_check: agreed by tiancaiamao.
  • 2024-07-10 07:11:58.047769831 +0000 UTC m=+428015.283003944: :ballot_box_with_check: agreed by hawkingrei.

ti-chi-bot[bot] avatar Jul 10 '24 07:07 ti-chi-bot[bot]

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, tangenta, tiancaiamao

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[bot] avatar Jul 10 '24 07:07 ti-chi-bot[bot]

/retest

hawkingrei avatar Jul 10 '24 08:07 hawkingrei

/retest

dveeden avatar Jul 10 '24 09:07 dveeden