Skip to content

SPM: the update time is inconsistent with the time zone  #27641

Open
@ChenPeng2013

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)


use test;
drop table if exists t;

set @@global.time_zone=UTC;
set @@time_zone=UTC;
select now();
create table t(a int);
create global binding for select * from t using select * from t;
select sleep(3);
show global bindings;
show status like 'last_plan_binding_update_time';
select now();

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

mysql> show global bindings;
+----------------------------+--------------------------+------------+--------+-------------------------+-------------------------+---------+-------------+--------+
| Original_sql               | Bind_sql                 | Default_db | Status | Create_time             | Update_time             | Charset | Collation   | Source |
+----------------------------+--------------------------+------------+--------+-------------------------+-------------------------+---------+-------------+--------+
| select * from `test` . `t` | SELECT * FROM `test`.`t` | test       | using  | 2021-08-27 19:00:01.711 | 2021-08-27 11:00:01.711 | utf8mb4 | utf8mb4_bin | manual |
+----------------------------+--------------------------+------------+--------+-------------------------+-------------------------+---------+-------------+--------+
1 row in set (0.01 sec)

mysql> show status like 'last_plan_binding_update_time';
+-------------------------------+-------------------------+
| Variable_name                 | Value                   |
+-------------------------------+-------------------------+
| last_plan_binding_update_time | 2021-08-27 11:00:01.711 |
+-------------------------------+-------------------------+
1 row in set (0.02 sec)

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2021-08-27 11:00:04 |
+---------------------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> show global bindings;
+----------------------------+--------------------------+------------+--------+-------------------------+-------------------------+---------+-------------+--------+
| Original_sql               | Bind_sql                 | Default_db | Status | Create_time             | Update_time             | Charset | Collation   | Source |
+----------------------------+--------------------------+------------+--------+-------------------------+-------------------------+---------+-------------+--------+
| select * from `test` . `t` | SELECT * FROM `test`.`t` | test       | using  | 2021-08-27 19:00:01.711 | 2021-08-27 19:00:01.711 | utf8mb4 | utf8mb4_bin | manual |
+----------------------------+--------------------------+------------+--------+-------------------------+-------------------------+---------+-------------+--------+
1 row in set (0.01 sec)

mysql> show status like 'last_plan_binding_update_time';
+-------------------------------+-------------------------+
| Variable_name                 | Value                   |
+-------------------------------+-------------------------+
| last_plan_binding_update_time | 2021-08-27 19:00:01.711 |
+-------------------------------+-------------------------+
1 row in set (0.02 sec)

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2021-08-27 11:00:04 |
+---------------------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

Release Version: v5.2.0-alpha-744-g46da3ba55
Edition: Community
Git Commit Hash: 46da3ba5572f90f8b8473f6a87de10056935e65a
Git Branch: master
UTC Build Time: 2021-08-26 06:32:21
GoVersion: go1.16.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

Activity

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

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions