Skip to content

Commit 0812d0d

Browse files
committed
MDEV-28131 Unexpected warning while selecting from information_schema.processlist
Problem: DECIMAL columns in I_S must be explicitly set of some value. I_S columns do not have `DEFAULT 0` (after MDEV-18918), so during restore_record() their record fragments pointed by Field::ptr are initialized to zero bytes 0x00. But an array of 0x00's is not a valid binary DECIMAL value. So val_decimal() called for such Field_new_decimal generated a warning when seeing a wrong binary encoded DECIMAL value in the record. Fix: Explicitly setting INFORMATION_SCHEMA.PROCESSLIST.PROGRESS to the decimal value of 0 if no progress information is available.
1 parent fbc1cc9 commit 0812d0d

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

mysql-test/main/processlist.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,23 @@ utf8mb4_string xxx😎yyy
4040
#
4141
# End of 10.1 tests
4242
#
43+
#
44+
# Start of 10.3 tests
45+
#
46+
#
47+
# MDEV-28131 Unexpected warning while selecting from information_schema.processlist
48+
#
49+
connect conn1, localhost, root,,;
50+
connection conn1;
51+
SELECT SLEEP(1000);
52+
connection default;
53+
SELECT progress FROM information_schema.processlist WHERE info='SELECT SLEEP(1000)';
54+
progress
55+
0.000
56+
connection conn1;
57+
Got one of the listed errors
58+
connection default;
59+
disconnect conn1;
60+
#
61+
# End of 10.3 tests
62+
#

mysql-test/main/processlist.test

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,38 @@ SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA
7070
--echo #
7171
--echo # End of 10.1 tests
7272
--echo #
73+
74+
--echo #
75+
--echo # Start of 10.3 tests
76+
--echo #
77+
78+
--echo #
79+
--echo # MDEV-28131 Unexpected warning while selecting from information_schema.processlist
80+
--echo #
81+
82+
connect (conn1, localhost, root,,);
83+
connection conn1;
84+
let $ID= `select connection_id()`;
85+
send SELECT SLEEP(1000);
86+
connection default;
87+
let $wait_timeout= 10;
88+
let $wait_condition=select count(*)=1 from information_schema.processlist
89+
where state='User sleep' and info='SELECT SLEEP(1000)';
90+
--source include/wait_condition.inc
91+
SELECT progress FROM information_schema.processlist WHERE info='SELECT SLEEP(1000)';
92+
disable_query_log;
93+
eval kill $ID;
94+
enable_query_log;
95+
let $wait_timeout= 10;
96+
let $wait_condition=select count(*)=0 from information_schema.processlist
97+
where state='User sleep' and info='SELECT SLEEP(1000)';
98+
--source include/wait_condition.inc
99+
connection conn1;
100+
--error 2013,ER_CONNECTION_KILLED
101+
reap;
102+
connection default;
103+
disconnect conn1;
104+
105+
--echo #
106+
--echo # End of 10.3 tests
107+
--echo #

sql/sql_show.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3351,6 +3351,16 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
33513351
table->field[11]->store((double) tmp->progress.counter /
33523352
(double) max_counter*100.0);
33533353
}
3354+
else
3355+
{
3356+
/*
3357+
This is a DECIMAL column without DEFAULT.
3358+
restore_record() fills its Field::ptr to zero bytes,
3359+
according to pack_length(). But an array of zero bytes
3360+
is not a valid decimal. Set it explicitly to 0.
3361+
*/
3362+
table->field[11]->store((longlong) 0, true);
3363+
}
33543364
mysql_mutex_unlock(&tmp->LOCK_thd_data);
33553365
}
33563366

0 commit comments

Comments
 (0)