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

runaway: change RUNAWAY_WATCHES time type to UTC #54768

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

HuSharp
Copy link
Contributor

@HuSharp HuSharp commented Jul 19, 2024

What problem does this PR solve?

Issue Number: Close #54770, Ref #54434

Problem Summary: runaway: change tidb_runaway_watch to UTC

What changed and how does it work?

Currently tidb_runaway_watch relies on struct QuarantineRecord to store time as UTC, while RUNAWAY_WATCHES directly selects tidb_runaway_watch to convert to local time. Let's change RUNAWAY_WATCHES to UTC as well.

why not change tidb_runaway_watch to local time?
because tidb_runaway_watch is datetime, which is different from timestamp, and can not convert UTC to local time automatically.

CreateRunawayWatchTable = `CREATE TABLE IF NOT EXISTS mysql.tidb_runaway_watch (
id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
resource_group_name varchar(32) not null,
start_time datetime(6) NOT NULL,
end_time datetime(6),
watch bigint(10) NOT NULL,
watch_text TEXT NOT NULL,
source varchar(512) NOT NULL,
action bigint(10),
INDEX sql_index(resource_group_name,watch_text(700)) COMMENT "accelerate the speed when select quarantined query",
INDEX time_index(end_time) COMMENT "accelerate the speed when querying with active watch"
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;`

This means the timezone information will be lost, and the user will not know which timezone to switch to when in crossing time zones (the user needs to confirm the local time zone on the server side).

before

mysql> SELECT * FROM mysql.tidb_runaway_watch limit 1\G
*************************** 1. row ***************************
                 id: 1
resource_group_name: default
         start_time: 2024-07-16 07:34:14.137009
           end_time: 2024-07-16 07:44:14.137009
              watch: 1
         watch_text: select  count(*) from orders where o_orderdate = '1994-11-12'
             source: 127.0.0.1:4000
             action: 3
1 row in set (0.00 sec)

mysql> SELECT * FROM INFORMATION_SCHEMA.RUNAWAY_WATCHES where id =1\G
*************************** 1. row ***************************
                 ID: 1
RESOURCE_GROUP_NAME: default
         START_TIME: 2024-07-16 15:34:14
           END_TIME: 2024-07-16 15:44:14
              WATCH: Exact
         WATCH_TEXT: select  count(*) from orders where o_orderdate = '1994-11-12'
             SOURCE: 127.0.0.1:4000
             ACTION: Kill
1 row in set (0.01 sec)

After

mysql> SELECT * FROM mysql.tidb_runaway_watch limit 1\G
*************************** 1. row ***************************
                 id: 1
resource_group_name: default
         start_time: 2024-07-19 07:18:36.572748
           end_time: 2024-07-19 07:28:36.572748
              watch: 1
         watch_text: select  count(*) from orders where o_orderdate = '1992-07-03'
             source: 127.0.0.1:4000
             action: 3
1 row in set (0.00 sec)

mysql> SELECT * FROM INFORMATION_SCHEMA.RUNAWAY_WATCHES where id =1\G
*************************** 1. row ***************************
                 ID: 1
RESOURCE_GROUP_NAME: default
         START_TIME: 2024-07-19 07:18:36
           END_TIME: 2024-07-19 07:28:36
              WATCH: Exact
         WATCH_TEXT: select  count(*) from orders where o_orderdate = '1992-07-03'
             SOURCE: 127.0.0.1:4000
             ACTION: Kill
1 row in set (0.00 sec)

Check List

Tests

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

Release note

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

runaway: change runaway_watch time type to UTC

Signed-off-by: husharp <jinhao.hu@pingcap.com>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 19, 2024
Copy link

tiprow bot commented Jul 19, 2024

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

@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. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jul 19, 2024
@HuSharp
Copy link
Contributor Author

HuSharp commented Jul 19, 2024

@nolouch @glorv @JmPotato PTAL, thx!

Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 56.7604%. Comparing base (cb6f913) to head (d4c801d).
Report is 27 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54768         +/-   ##
=================================================
- Coverage   72.7971%   56.7604%   -16.0367%     
=================================================
  Files          1553       1681        +128     
  Lines        437399     618212     +180813     
=================================================
+ Hits         318414     350900      +32486     
- Misses        99376     244008     +144632     
- Partials      19609      23304       +3695     
Flag Coverage Δ
integration 37.4237% <0.0000%> (?)
unit 72.5652% <50.0000%> (+0.7465%) ⬆️

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

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 52.3899% <ø> (+6.5119%) ⬆️

Signed-off-by: husharp <jinhao.hu@pingcap.com>
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 19, 2024
@glorv
Copy link
Contributor

glorv commented Jul 19, 2024

BTW, I think we better cherry-pick this PR to v8.1 and 7.5 as it's more like a bug than enhancement.

@HuSharp
Copy link
Contributor Author

HuSharp commented Jul 19, 2024

BTW, I think we better cherry-pick this PR to v8.1 and 7.5 as it's more like a bug than enhancement.

I have created an issue #54770, please help me add labels to cp :)

@glorv
Copy link
Contributor

glorv commented Jul 19, 2024

BTW, I think we better cherry-pick this PR to v8.1 and 7.5 as it's more like a bug than enhancement.

I created an issue #54770, please help me add label to cp :)

Done

@glorv
Copy link
Contributor

glorv commented Jul 19, 2024

/check-issue-triage-complete

@glorv glorv added needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. labels Jul 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 Jul 20, 2024
Copy link

ti-chi-bot bot commented Jul 20, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-19 08:17:25.170971055 +0000 UTC m=+601067.161912524: ☑️ agreed by glorv.
  • 2024-07-20 09:35:06.419607791 +0000 UTC m=+692128.410549265: ☑️ agreed by JmPotato.

Copy link

tiprow bot commented Jul 20, 2024

@HuSharp: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow d4c801d link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@HuSharp
Copy link
Contributor Author

HuSharp commented Jul 20, 2024

/test fast_test_tiprow

Copy link

ti-chi-bot bot commented Jul 20, 2024

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

  • /test build
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pull-br-integration-test
  • /test pull-integration-ddl-test
  • /test pull-lightning-integration-test
  • /test pull-mysql-client-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test canary-notify-when-compatibility-sections-changed
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-nodejs-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test
  • pingcap/tidb/pull_integration_ddl_test
  • pingcap/tidb/pull_mysql_client_test

In response to this:

/test fast_test_tiprow

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 Jul 20, 2024

@HuSharp: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test fast_test_tiprow

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.

@HuSharp
Copy link
Contributor Author

HuSharp commented Jul 20, 2024

@JmPotato Can you help to add an approved label? :)

@JmPotato
Copy link
Member

@JmPotato Can you help to add an approved label? :)

You have to ask for an approval from the owners of domain pkg: https://github.com/pingcap/tidb/blob/master/pkg/domain/OWNERS

@HuSharp
Copy link
Contributor Author

HuSharp commented Jul 20, 2024

@JmPotato Can you help to add an approved label? :)

You have to ask for an approval from the owners of domain pkg: master/pkg/domain/OWNERS

got it.

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Jul 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: glorv, GMHDBJD, JmPotato

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 Jul 23, 2024
@ti-chi-bot ti-chi-bot bot merged commit 560e92e into pingcap:master Jul 23, 2024
22 of 23 checks passed
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jul 23, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jul 23, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@HuSharp HuSharp deleted the unify_runaway_time branch July 23, 2024 08:21
ti-chi-bot bot pushed a commit that referenced this pull request Aug 5, 2024
@HuSharp HuSharp changed the title runaway: change tidb_runaway_watch time type to UTC runaway: change RUNAWAY_WATCHES time type to UTC Aug 6, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

runaway: change RUNAWAY_WATCHES time type to UTC
5 participants