[MDEV-14165] mysql_fetch didn't end with MYSQL_NO_DATA from statement Created: 2017-10-27  Updated: 2017-12-20  Resolved: 2017-10-28

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Fix Version/s: 10.2.10

Type: Task Priority: Major
Reporter: Sergei Petrunia Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

Run this testcase with --ps-protocol

 
CREATE TABLE t1 (
  i INT ZEROFILL,
  i0 INT(0) ZEROFILL,
  i1 INT(1) ZEROFILL,
  i20 INT(20) ZEROFILL,
  t TINYINT ZEROFILL,
  t0 TINYINT(0) ZEROFILL,
  t1 TINYINT(1) ZEROFILL,
  t20 TINYINT(20) ZEROFILL,
  s SMALLINT ZEROFILL,
  s0 SMALLINT(0) ZEROFILL,
  s1 SMALLINT(1) ZEROFILL,
  s20 SMALLINT(20) ZEROFILL,
  m MEDIUMINT ZEROFILL,
  m0 MEDIUMINT(0) ZEROFILL,
  m1 MEDIUMINT(1) ZEROFILL,
  m20 MEDIUMINT(20) ZEROFILL,
  b BIGINT ZEROFILL,
  b0 BIGINT(0) ZEROFILL,
  b1 BIGINT(1) ZEROFILL,
  b20 BIGINT(20) ZEROFILL,
  pk INT AUTO_INCREMENT PRIMARY KEY
) ENGINE=myisam;
SHOW COLUMNS IN t1;
INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
 
drop table t1;

And you will get

CURRENT_TEST: main.a
mysqltest: At line 29: mysql_fetch didn't end with MYSQL_NO_DATA from statement: error: 101

Initially, I observed this when running rocksdb.col_opt_zerofil test with --ps-protocol.
There, I also get messages like this:

/home/psergey/dev-git/10.2-mariarocks-r4/client/mysqltest: Out of memory (Needed 2779097088 bytes)

THis is also repeatable with Facebook/MySQL-5.6, see
https://github.com/facebook/mysql-5.6/issues/750



 Comments   
Comment by Sergei Petrunia [ 2017-10-27 ]

Assigning to georg because I assume this is in his area. If I am wrong, please reassign

Comment by Sergei Petrunia [ 2017-10-27 ]

I observed this on 10.2, didn't try other versions

Comment by Georg Richter [ 2017-10-27 ]

The bug isn't in Connector/C, but in mysqltest:

mysql_stmt_fetch() returns MYSQL_DATA_TRUNCATED which is correct, since the buffer bound to column i20 (defined as int(20) zerofill) has a length of 12, which is too small.

Comment by Georg Richter [ 2017-10-27 ]

Found the problem

Connector/C (but also libmysql) doesn't update the max_length in stmt->metadata for a fixed length type with ZEROFILL flag set..

Comment by Georg Richter [ 2017-10-28 ]

Fix pushed into 10.2-server and master branch of Connector/C

Generated at Thu Feb 08 08:11:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.