summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2022-03-21 16:42:58 +0400
committerAlexander Barkov <bar@mariadb.com>2022-03-21 16:42:58 +0400
commit0812d0de8dcb1f76d4a03cea3f20bfa30345b83b (patch)
tree12743c7afede53228938a6d8e7e817c0417b8550
parentfbc1cc974e433ad4ee77ef19a2ea199537686a98 (diff)
downloadmariadb-git-0812d0de8dcb1f76d4a03cea3f20bfa30345b83b.tar.gz
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.
-rw-r--r--mysql-test/main/processlist.result20
-rw-r--r--mysql-test/main/processlist.test35
-rw-r--r--sql/sql_show.cc10
3 files changed, 65 insertions, 0 deletions
diff --git a/mysql-test/main/processlist.result b/mysql-test/main/processlist.result
index 2d3228a6d91..d99160f5c74 100644
--- a/mysql-test/main/processlist.result
+++ b/mysql-test/main/processlist.result
@@ -40,3 +40,23 @@ utf8mb4_string xxx😎yyy
#
# End of 10.1 tests
#
+#
+# Start of 10.3 tests
+#
+#
+# MDEV-28131 Unexpected warning while selecting from information_schema.processlist
+#
+connect conn1, localhost, root,,;
+connection conn1;
+SELECT SLEEP(1000);
+connection default;
+SELECT progress FROM information_schema.processlist WHERE info='SELECT SLEEP(1000)';
+progress
+0.000
+connection conn1;
+Got one of the listed errors
+connection default;
+disconnect conn1;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/processlist.test b/mysql-test/main/processlist.test
index 8e98701459a..f419f57ea2f 100644
--- a/mysql-test/main/processlist.test
+++ b/mysql-test/main/processlist.test
@@ -70,3 +70,38 @@ SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA
--echo #
--echo # End of 10.1 tests
--echo #
+
+--echo #
+--echo # Start of 10.3 tests
+--echo #
+
+--echo #
+--echo # MDEV-28131 Unexpected warning while selecting from information_schema.processlist
+--echo #
+
+connect (conn1, localhost, root,,);
+connection conn1;
+let $ID= `select connection_id()`;
+send SELECT SLEEP(1000);
+connection default;
+let $wait_timeout= 10;
+let $wait_condition=select count(*)=1 from information_schema.processlist
+where state='User sleep' and info='SELECT SLEEP(1000)';
+--source include/wait_condition.inc
+SELECT progress FROM information_schema.processlist WHERE info='SELECT SLEEP(1000)';
+disable_query_log;
+eval kill $ID;
+enable_query_log;
+let $wait_timeout= 10;
+let $wait_condition=select count(*)=0 from information_schema.processlist
+where state='User sleep' and info='SELECT SLEEP(1000)';
+--source include/wait_condition.inc
+connection conn1;
+--error 2013,ER_CONNECTION_KILLED
+reap;
+connection default;
+disconnect conn1;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index e1090d450e8..439cad1c858 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3351,6 +3351,16 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[11]->store((double) tmp->progress.counter /
(double) max_counter*100.0);
}
+ else
+ {
+ /*
+ This is a DECIMAL column without DEFAULT.
+ restore_record() fills its Field::ptr to zero bytes,
+ according to pack_length(). But an array of zero bytes
+ is not a valid decimal. Set it explicitly to 0.
+ */
+ table->field[11]->store((longlong) 0, true);
+ }
mysql_mutex_unlock(&tmp->LOCK_thd_data);
}