Skip to content

Commit f46fe72

Browse files
gkodinovdahlerlend
authored andcommitted
Bug #27629719: SET PERSIST STORES TRUNCATED TIMESTAMPS
Increased the resolution of the peristed variables timestams to the maximum allowed. Increased the delcared resoltion of performance_schema.variables_info.set_time used to display these. Added a test to make sure the fractional seconds are operational. Bumped the pfs version
1 parent 7948b75 commit f46fe72

10 files changed

+68
-11
lines changed

mysql-test/r/persisted_variables_bugs.result

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,21 @@ innodb_max_dirty_pages_pct = default, init_connect = default,
136136
max_join_size = default;
137137
Warnings:
138138
Warning 1230 Default value is not defined for this set option. Please specify correct counter or module name.
139+
#
140+
# Bug #27629719: SET PERSIST STORES TRUNCATED TIMESTAMPS
141+
#
142+
# Set one variable in the mysqld-auto.cnf
143+
SET PERSIST max_join_size= 10000000;
144+
# Set another variable in the mysqld-auto.cnf
145+
SET PERSIST init_connect='';
146+
# Restart the server so it sets the variable time from mysqld-auto.cnf
147+
# restart
148+
# Check the microseconds of set_time: must be 2 (i.e. different for the two vars)
149+
SELECT COUNT(DISTINCT MICROSECOND(set_time)) FROM performance_schema.variables_info
150+
WHERE variable_name IN ('max_join_size', 'init_connect');
151+
COUNT(DISTINCT MICROSECOND(set_time))
152+
2
153+
# Cleanup
154+
SET GLOBAL max_join_size=DEFAULT, init_connect=DEFAULT;
155+
RESET PERSIST;
139156
# End of the 8.0 tests

mysql-test/r/persisted_variables_extended.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ variables_info CREATE TABLE "variables_info" (
261261
"VARIABLE_PATH" varchar(1024) DEFAULT NULL,
262262
"MIN_VALUE" varchar(64) DEFAULT NULL,
263263
"MAX_VALUE" varchar(64) DEFAULT NULL,
264-
"SET_TIME" timestamp NULL DEFAULT NULL,
264+
"SET_TIME" timestamp(6) NULL DEFAULT NULL,
265265
"SET_USER" char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
266266
"SET_HOST" char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
267267
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"Checking the data dictionary properties ..."
22
SUBSTRING_INDEX(SUBSTRING(properties, LOCATE('PS_VERSION', properties), 30), ';', 1)
3-
PS_VERSION=80004
3+
PS_VERSION=80011
44
"Checking the performance schema database structure ..."
55
CHECK STATUS
6-
The tables in the performance_schema were last changed in MySQL 8.0.4-rc
6+
The tables in the performance_schema were last changed in MySQL 8.0.11

mysql-test/suite/perfschema/r/idx_variables_info.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ variables_info CREATE TABLE `variables_info` (
66
`VARIABLE_PATH` varchar(1024) DEFAULT NULL,
77
`MIN_VALUE` varchar(64) DEFAULT NULL,
88
`MAX_VALUE` varchar(64) DEFAULT NULL,
9-
`SET_TIME` timestamp NULL DEFAULT NULL,
9+
`SET_TIME` timestamp(6) NULL DEFAULT NULL,
1010
`SET_USER` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
1111
`SET_HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
1212
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8

mysql-test/suite/perfschema/r/table_schema.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ def performance_schema variables_info VARIABLE_SOURCE 2 COMPILED YES enum 12 36
13531353
def performance_schema variables_info VARIABLE_PATH 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select,insert,update,references NULL
13541354
def performance_schema variables_info MIN_VALUE 4 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references NULL
13551355
def performance_schema variables_info MAX_VALUE 5 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references NULL
1356-
def performance_schema variables_info SET_TIME 6 NULL YES timestamp NULL NULL NULL NULL 0 NULL NULL timestamp select,insert,update,references NULL
1356+
def performance_schema variables_info SET_TIME 6 NULL YES timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) select,insert,update,references NULL
13571357
def performance_schema variables_info SET_USER 7 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references NULL
13581358
def performance_schema variables_info SET_HOST 8 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NULL
13591359
select count(*) from information_schema.columns

mysql-test/suite/perfschema/t/dd_version_check.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ create table test.pfs_published_schema
6060
#
6161

6262
insert into test.pfs_published_schema
63-
values("MySQL 8.0.4-rc",
64-
"aa77743b47ba8ce22bc3ceaa8136dbc5244f3f37c15f60923bbea0b8317fdbf5");
63+
values("MySQL 8.0.11",
64+
"b6dd7571b1e0cd932692c8eb00e5d41aa9bfa7d4b38cca0c9a2e2458633f258a");
6565

6666
create table test.pfs_check_table
6767
(id int(11) NOT NULL AUTO_INCREMENT,

mysql-test/t/persisted_variables_bugs.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,26 @@ SET GLOBAL optimizer_trace_offset = default, activate_all_roles_on_login = defau
135135
innodb_max_dirty_pages_pct = default, init_connect = default,
136136
max_join_size = default;
137137

138+
--echo #
139+
--echo # Bug #27629719: SET PERSIST STORES TRUNCATED TIMESTAMPS
140+
--echo #
141+
142+
--echo # Set one variable in the mysqld-auto.cnf
143+
SET PERSIST max_join_size= 10000000;
144+
--echo # Set another variable in the mysqld-auto.cnf
145+
SET PERSIST init_connect='';
146+
147+
--echo # Restart the server so it sets the variable time from mysqld-auto.cnf
148+
--source include/restart_mysqld.inc
149+
150+
--echo # Check the microseconds of set_time: must be 2 (i.e. different for the two vars)
151+
SELECT COUNT(DISTINCT MICROSECOND(set_time)) FROM performance_schema.variables_info
152+
WHERE variable_name IN ('max_join_size', 'init_connect');
153+
154+
--echo # Cleanup
155+
SET GLOBAL max_join_size=DEFAULT, init_connect=DEFAULT;
156+
RESET PERSIST;
157+
158+
138159
--echo # End of the 8.0 tests
139160

sql/persisted_variable.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ Persisted_variables_cache *Persisted_variables_cache::m_instance = NULL;
158158

159159
st_persist_var::st_persist_var() {
160160
if (current_thd) {
161-
timeval tv = current_thd->query_start_timeval_trunc(0);
161+
timeval tv = current_thd->query_start_timeval_trunc(DATETIME_MAX_DECIMALS);
162162
timestamp = tv.tv_sec * 1000000ULL + tv.tv_usec;
163163
} else
164164
timestamp = my_micro_time();
165165
}
166166

167167
st_persist_var::st_persist_var(THD *thd) {
168-
timeval tv = thd->query_start_timeval_trunc(0);
168+
timeval tv = thd->query_start_timeval_trunc(DATETIME_MAX_DECIMALS);
169169
timestamp = tv.tv_sec * 1000000ULL + tv.tv_usec;
170170
user = thd->security_context()->user().str;
171171
host = thd->security_context()->host().str;

storage/perfschema/pfs_dd_version.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,26 @@
6767
- metadata_locks (modified, added column COLUMN_NAME)
6868
- replication_connection_configuration (modified)
6969
- instance_log_resource (created)
70+
71+
80005:
72+
73+
performance_schema tables changed in MySQL 8.0.5 are
74+
- all, changed UTF8 (aka UTF8MB3) to UTF8MB4.
75+
76+
80006:
77+
78+
performance_schema tables changed in MySQL 8.0.6 are
79+
- variables_info.set_time precision changed from 0 to 6.
80+
81+
80011:
82+
83+
Reverted UTF8MB4 changes.
84+
Version bump from 8.0.6 to 8.0.11,
85+
versions [8.0.5 - 8.0.10] inclusive are abandoned.
86+
87+
Version published is now 80011.
88+
7089
*/
71-
static const uint PFS_DD_VERSION = 80004;
90+
static const uint PFS_DD_VERSION = 80011;
7291

7392
#endif /* PFS_DD_VERSION_H */

storage/perfschema/table_variables_info.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Plugin_table table_variables_info::m_table_def(
5858
" VARIABLE_PATH varchar(1024),\n"
5959
" MIN_VALUE varchar(64),\n"
6060
" MAX_VALUE varchar(64),\n"
61-
" SET_TIME TIMESTAMP(0) default null,\n"
61+
" SET_TIME TIMESTAMP(6) default null,\n"
6262
" SET_USER CHAR(32) collate utf8_bin default null,\n"
6363
" SET_HOST CHAR(60) collate utf8_bin default null\n",
6464
/* Options */

0 commit comments

Comments
 (0)