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: ddl jobs microsecond #52930

Merged
merged 4 commits into from
May 13, 2024
Merged

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Apr 26, 2024

What problem does this PR solve?

Issue Number: close #52929

Problem Summary:

What changed and how does it work?

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.

The time columns in `information_schema.DDL_JOBS` now support microsecond information.

Test

Before:

mysql> SELECT JOB_ID,START_TIME,END_TIME,TIMEDIFF(END_TIME,START_TIME),TIMESTAMPDIFF(MICROSECOND,START_TIME,END_TIME),END_TIME=START_TIME,CONVERT(END_TIME USING utf8mb4) = CONVERT(START_TIME USING utf8mb4) FROM information_schema.DDL_JOBS ORDER BY TIMEDIFF(END_TIME,START_TIME) DESC LIMIT 20;
+--------+---------------------+---------------------+-------------------------------+------------------------------------------------+---------------------+---------------------------------------------------------------------+
| JOB_ID | START_TIME          | END_TIME            | TIMEDIFF(END_TIME,START_TIME) | TIMESTAMPDIFF(MICROSECOND,START_TIME,END_TIME) | END_TIME=START_TIME | CONVERT(END_TIME USING utf8mb4) = CONVERT(START_TIME USING utf8mb4) |
+--------+---------------------+---------------------+-------------------------------+------------------------------------------------+---------------------+---------------------------------------------------------------------+
|  10106 | 2024-04-26 11:20:02 | 2024-04-26 11:20:17 | 00:00:15                      |                                       15102000 |                   0 |                                                                   0 |
|  10108 | 2024-04-26 11:46:50 | 2024-04-26 11:47:05 | 00:00:15                      |                                       15069000 |                   0 |                                                                   0 |
|  10107 | 2024-04-26 11:45:41 | 2024-04-26 11:45:56 | 00:00:14                      |                                       14780000 |                   0 |                                                                   0 |
|   7455 | 2024-04-26 11:13:17 | 2024-04-26 11:13:17 | 00:00:00                      |                                          21000 |                   0 |                                                                   1 |
|   5105 | 2024-04-26 11:12:58 | 2024-04-26 11:12:58 | 00:00:00                      |                                          21000 |                   0 |                                                                   1 |
|   6653 | 2024-04-26 11:13:10 | 2024-04-26 11:13:10 | 00:00:00                      |                                          20000 |                   0 |                                                                   1 |
|   8723 | 2024-04-26 11:13:27 | 2024-04-26 11:13:27 | 00:00:00                      |                                          16000 |                   0 |                                                                   1 |
|   5877 | 2024-04-26 11:13:04 | 2024-04-26 11:13:04 | 00:00:00                      |                                          14000 |                   0 |                                                                   1 |
|   9125 | 2024-04-26 11:13:29 | 2024-04-26 11:13:29 | 00:00:00                      |                                          14000 |                   0 |                                                                   1 |
|   9959 | 2024-04-26 11:13:35 | 2024-04-26 11:13:35 | 00:00:00                      |                                          14000 |                   0 |                                                                   1 |
|   6767 | 2024-04-26 11:13:11 | 2024-04-26 11:13:11 | 00:00:00                      |                                          14000 |                   0 |                                                                   1 |
|   2851 | 2024-04-26 11:12:34 | 2024-04-26 11:12:34 | 00:00:00                      |                                          14000 |                   0 |                                                                   1 |
|   7679 | 2024-04-26 11:13:19 | 2024-04-26 11:13:19 | 00:00:00                      |                                          13000 |                   0 |                                                                   1 |
|   3953 | 2024-04-26 11:12:41 | 2024-04-26 11:12:41 | 00:00:00                      |                                          13000 |                   0 |                                                                   1 |
|   6267 | 2024-04-26 11:13:07 | 2024-04-26 11:13:07 | 00:00:00                      |                                          13000 |                   0 |                                                                   1 |
|   3579 | 2024-04-26 11:12:38 | 2024-04-26 11:12:38 | 00:00:00                      |                                          13000 |                   0 |                                                                   1 |
|   2455 | 2024-04-26 11:12:32 | 2024-04-26 11:12:32 | 00:00:00                      |                                          13000 |                   0 |                                                                   1 |
|   6149 | 2024-04-26 11:13:06 | 2024-04-26 11:13:06 | 00:00:00                      |                                          13000 |                   0 |                                                                   1 |
|   5491 | 2024-04-26 11:13:01 | 2024-04-26 11:13:01 | 00:00:00                      |                                          13000 |                   0 |                                                                   1 |
|   2863 | 2024-04-26 11:12:34 | 2024-04-26 11:12:34 | 00:00:00                      |                                          13000 |                   0 |                                                                   1 |
+--------+---------------------+---------------------+-------------------------------+------------------------------------------------+---------------------+---------------------------------------------------------------------+
20 rows in set (0.12 sec)

After:

mysql> SELECT JOB_ID,START_TIME,END_TIME,TIMEDIFF(END_TIME,START_TIME),TIMESTAMPDIFF(MICROSECOND,START_TIME,END_TIME),END_TIME=START_TIME,CONVERT(END_TIME USING utf8mb4) = CONVERT(START_TIME USING utf8mb4) FROM information_schema.DDL_JOBS ORDER BY TIMEDIFF(END_TIME,START_TIME) DESC LIMIT 20;
+--------+----------------------------+----------------------------+-------------------------------+------------------------------------------------+---------------------+---------------------------------------------------------------------+
| JOB_ID | START_TIME                 | END_TIME                   | TIMEDIFF(END_TIME,START_TIME) | TIMESTAMPDIFF(MICROSECOND,START_TIME,END_TIME) | END_TIME=START_TIME | CONVERT(END_TIME USING utf8mb4) = CONVERT(START_TIME USING utf8mb4) |
+--------+----------------------------+----------------------------+-------------------------------+------------------------------------------------+---------------------+---------------------------------------------------------------------+
|  10106 | 2024-04-26 11:20:02.297000 | 2024-04-26 11:20:17.399000 | 00:00:15                      |                                       15102000 |                   0 |                                                                   0 |
|  10108 | 2024-04-26 11:46:50.526000 | 2024-04-26 11:47:05.595000 | 00:00:15                      |                                       15069000 |                   0 |                                                                   0 |
|  10107 | 2024-04-26 11:45:41.498000 | 2024-04-26 11:45:56.278000 | 00:00:14                      |                                       14780000 |                   0 |                                                                   0 |
|   7455 | 2024-04-26 11:13:17.589000 | 2024-04-26 11:13:17.610000 | 00:00:00                      |                                          21000 |                   0 |                                                                   0 |
|   5105 | 2024-04-26 11:12:58.775000 | 2024-04-26 11:12:58.796000 | 00:00:00                      |                                          21000 |                   0 |                                                                   0 |
|   6653 | 2024-04-26 11:13:10.826000 | 2024-04-26 11:13:10.846000 | 00:00:00                      |                                          20000 |                   0 |                                                                   0 |
|   8723 | 2024-04-26 11:13:27.420000 | 2024-04-26 11:13:27.436000 | 00:00:00                      |                                          16000 |                   0 |                                                                   0 |
|   5877 | 2024-04-26 11:13:04.647000 | 2024-04-26 11:13:04.661000 | 00:00:00                      |                                          14000 |                   0 |                                                                   0 |
|   9125 | 2024-04-26 11:13:29.984000 | 2024-04-26 11:13:29.998000 | 00:00:00                      |                                          14000 |                   0 |                                                                   0 |
|   9959 | 2024-04-26 11:13:35.580000 | 2024-04-26 11:13:35.594000 | 00:00:00                      |                                          14000 |                   0 |                                                                   0 |
|   6767 | 2024-04-26 11:13:11.778000 | 2024-04-26 11:13:11.792000 | 00:00:00                      |                                          14000 |                   0 |                                                                   0 |
|   2851 | 2024-04-26 11:12:34.460000 | 2024-04-26 11:12:34.474000 | 00:00:00                      |                                          14000 |                   0 |                                                                   0 |
|   7679 | 2024-04-26 11:13:19.542000 | 2024-04-26 11:13:19.555000 | 00:00:00                      |                                          13000 |                   0 |                                                                   0 |
|   3953 | 2024-04-26 11:12:41.114000 | 2024-04-26 11:12:41.127000 | 00:00:00                      |                                          13000 |                   0 |                                                                   0 |
|   6267 | 2024-04-26 11:13:07.737000 | 2024-04-26 11:13:07.750000 | 00:00:00                      |                                          13000 |                   0 |                                                                   0 |
|   3579 | 2024-04-26 11:12:38.800000 | 2024-04-26 11:12:38.813000 | 00:00:00                      |                                          13000 |                   0 |                                                                   0 |
|   2455 | 2024-04-26 11:12:32.181000 | 2024-04-26 11:12:32.194000 | 00:00:00                      |                                          13000 |                   0 |                                                                   0 |
|   6149 | 2024-04-26 11:13:06.778000 | 2024-04-26 11:13:06.791000 | 00:00:00                      |                                          13000 |                   0 |                                                                   0 |
|   5491 | 2024-04-26 11:13:01.644000 | 2024-04-26 11:13:01.657000 | 00:00:00                      |                                          13000 |                   0 |                                                                   0 |
|   2863 | 2024-04-26 11:12:34.545000 | 2024-04-26 11:12:34.558000 | 00:00:00                      |                                          13000 |                   0 |                                                                   0 |
+--------+----------------------------+----------------------------+-------------------------------+------------------------------------------------+---------------------+---------------------------------------------------------------------+
20 rows in set (0.14 sec)

@dveeden dveeden requested a review from mjonss April 26, 2024 10:52
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 26, 2024
Copy link

tiprow bot commented Apr 26, 2024

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/test-infra repository.

@dveeden
Copy link
Contributor Author

dveeden commented Apr 26, 2024

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Apr 26, 2024
@dveeden
Copy link
Contributor Author

dveeden commented Apr 26, 2024

The only thing I don't understand is why TIMEDIFF(END_TIME,START_TIME) isn't returning microsecond info

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.

LGTM.
Are there any risk of breaking existing usage of this table?

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Apr 26, 2024
@mjonss
Copy link
Contributor

mjonss commented Apr 26, 2024

Also is it possible to create either test for this, maybe an integration test and using --replace_regex to make sure there are a microsecond part?

@dveeden
Copy link
Contributor Author

dveeden commented Apr 26, 2024

LGTM.
Are there any risk of breaking existing usage of this table?

Not that I'm aware

Copy link

codecov bot commented Apr 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.0201%. Comparing base (3750495) to head (8a3b372).

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #52930        +/-   ##
================================================
+ Coverage   72.4505%   74.0201%   +1.5695%     
================================================
  Files          1493       1493                
  Lines        429363     429363                
================================================
+ Hits         311076     317815      +6739     
+ Misses        99028      91636      -7392     
- Partials      19259      19912       +653     
Flag Coverage Δ
integration 28.2664% <100.0000%> (?)
unit 71.2516% <100.0000%> (-0.0928%) ⬇️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 50.1572% <ø> (+8.7170%) ⬆️

@dveeden dveeden requested review from cfzjywxk and wjhuang2016 April 30, 2024 06:37
@dveeden
Copy link
Contributor Author

dveeden commented Apr 30, 2024

/retest

1 similar comment
@dveeden
Copy link
Contributor Author

dveeden commented Apr 30, 2024

/retest

Copy link

ti-chi-bot bot commented May 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mjonss, tangenta

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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 10, 2024
Copy link

ti-chi-bot bot commented May 10, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-04-26 11:14:35.736683931 +0000 UTC m=+10229.493819513: ☑️ agreed by mjonss.
  • 2024-05-10 07:11:27.170357594 +0000 UTC m=+1205240.927493160: ☑️ agreed by tangenta.

@dveeden
Copy link
Contributor Author

dveeden commented May 10, 2024

/retest

@ti-chi-bot ti-chi-bot bot merged commit 78549f3 into pingcap:master May 13, 2024
23 checks passed
terry1purcell pushed a commit to terry1purcell/tidb that referenced this pull request May 17, 2024
RidRisR pushed a commit to RidRisR/tidb that referenced this pull request May 23, 2024
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 Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

information_schema.DDL_JOBS improvements
3 participants