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

information_schema.cluster_slow_query returns wrong result #56100

Open
mzhang77 opened this issue Sep 16, 2024 · 3 comments
Open

information_schema.cluster_slow_query returns wrong result #56100

mzhang77 opened this issue Sep 16, 2024 · 3 comments

Comments

@mzhang77
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

select time,query from information_schema.cluster_slow_query where time > '2024-09-16 00:00:01.000000' limit 1;
select time,query from information_schema.cluster_slow_query where time > '1970-01-01 00:00:01.000000';

2. What did you expect to see? (Required)

The second query should return result if the first query returns result

3. What did you see instead (Required)

mysql> select time,query from information_schema.cluster_slow_query where time > '2024-09-16 00:00:01.000000' limit 1;
+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| time                       | query                                                                                                                                                                                                                                                                                                       |
+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 2024-09-16 00:20:49.104160 | INSERT HIGH_PRIORITY INTO mysql.tidb VALUES ('tikv_gc_leader_lease', '20240916-00:22:44.100 -0400', 'Current GC worker leader lease. (DO NOT EDIT)')           ON DUPLICATE KEY           UPDATE variable_value = '20240916-00:22:44.100 -0400', comment = 'Current GC worker leader lease. (DO NOT EDIT)'; |
+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select time,query from information_schema.cluster_slow_query where time > '1970-01-01 00:00:01.000000';
Empty set (0.00 sec)

4. What is your TiDB version? (Required)

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v7.5.1
Edition: Community
Git Commit Hash: 7d16cc79e81bbf573124df3fd9351c26963f3e70
Git Branch: heads/refs/tags/v7.5.1
UTC Build Time: 2024-02-27 14:21:44
GoVersion: go1.21.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)
@jebter
Copy link

jebter commented Sep 17, 2024

Only return data for the same date

MySQL root@127.0.0.1:test> select time,query from information_schema.cluster_slow_query where time > '2024-09-06 00:00:01.000000' limit 1;
+----------------------------+-------------------------------------+
| time                       | query                               |
+----------------------------+-------------------------------------+
| 2024-09-06 14:54:33.064918 | CREATE DATABASE IF NOT EXISTS test; |
+----------------------------+-------------------------------------+
1 row in set
Time: 0.102s
MySQL root@127.0.0.1:test> select time,query from information_schema.cluster_slow_query where time > '2024-09-15 00:00:01.000000' limit 1;
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| time                       | query                                                                                                                                                                                                            |
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 2024-09-15 00:00:12.485027 | select job_meta, processing from mysql.tidb_ddl_job where job_id in   (select min(job_id) from mysql.tidb_ddl_job group by schema_ids, table_ids, processing)   and not reorg  order by processing desc, job_id; |
+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

1 row in set
Time: 0.017s
MySQL root@127.0.0.1:test> select time,query from information_schema.cluster_slow_query where time > '2024-09-16 00:00:01.000000' limit 1;
+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| time                       | query                                                                                                                                                                                                                                                                                                       |
+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 2024-09-16 00:04:56.937909 | INSERT HIGH_PRIORITY INTO mysql.tidb VALUES ('tikv_gc_leader_lease', '20240916-00:06:51.931 +0800', 'Current GC worker leader lease. (DO NOT EDIT)')           ON DUPLICATE KEY           UPDATE variable_value = '20240916-00:06:51.931 +0800', comment = 'Current GC worker leader lease. (DO NOT EDIT)'; |
+----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

@Benjamin2037 Benjamin2037 self-assigned this Sep 18, 2024
@joechenrh
Copy link
Contributor

/assign

@joechenrh joechenrh removed their assignment Sep 18, 2024
@fishiu
Copy link

fishiu commented Sep 18, 2024

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants