| Bug #75864 | Incorrect handling of unsigned not null integers in innodb_memcached | ||
|---|---|---|---|
| Submitted: | 11 Feb 2015 17:55 | Modified: | 1 Jun 2015 15:18 |
| Reporter: | Piotr Jurkiewicz (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Memcached | Severity: | S3 (Non-critical) |
| Version: | 5.6.23, 5.6.24 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Contribution, memcached | ||
[11 Feb 2015 17:56]
Piotr Jurkiewicz
Patch fixing this bug (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: unsigned.diff (text/plain), 3.09 KiB.
[13 Feb 2015 7:42]
MySQL Verification Team
Hello Piotr Jurkiewicz, Thank you for the report and contribution. Thanks, Umesh
[13 Feb 2015 7:43]
MySQL Verification Team
// 5.6.24 // Build used, setup followed - http://dev.mysql.com/doc/refman/5.6/en/innodb-memcached-installing.html commit: caae6b64ef613df007609b569b8368c599d5c995 date: 2015-02-03 12:05:54 +0100 build-date: 2015-02-03 18:45:47 +0100 short: caae6b6 branch: mysql-5.6 MySQL source 5.6.24 scripts/mysql_install_db --basedir=/export/umesh/mysql-5.6.24 --datadir=/export/umesh/mysql-5.6.24/75864 bin/mysqld --basedir=/export/umesh/mysql-5.6.24 --datadir=/export/umesh/mysql-5.6.24/75864 --core-file --socket=/tmp/mysql_ushastry.sock --port=15000 --log-error=/export/umesh/mysql-5.6.24/75864/log.err 2>&1 & // [umshastr@hod03]/export/umesh/mysql-5.7.6: telnet localhost 11211 Trying ::1... Connected to localhost. Escape character is '^]'. .. get @@int_test VALUE @@int_test 0 13 test/int_test END set somekey 0 0 3 543 STORED get somekey VALUE somekey 0 5 32573 END ## from CLI session mysql> select * from int_test; +---------+-----+ | k | v | +---------+-----+ | somekey | 543 | +---------+-----+ 1 row in set (0.00 sec) ## uninstalled/installed memcached plugin to see if that helps mysql> uninstall plugin daemon_memcached; Query OK, 0 rows affected (2.00 sec) mysql> install plugin daemon_memcached soname "libmemcached.so"; Query OK, 0 rows affected (0.00 sec) // [umshastr@hod03]~: telnet localhost 11211 Trying ::1... Connected to localhost. Escape character is '^]'. get @@int_test VALUE @@int_test 0 13 test/int_test END set somekey 0 0 3 543 STORED get somekey VALUE somekey 0 1 0 END ## from CLI session mysql> select * from int_test; +---------+-----+ | k | v | +---------+-----+ | somekey | 543 | +---------+-----+ 1 row in set (0.00 sec)
[1 Jun 2015 15:18]
Daniel Price
Posted by developer: Fixed as of the upcoming 5.6.26, 5.7.8, 5.8.0 releases, and here's the changelog entry: The "InnoDB" "memcached" plugin handled unsigned NOT NULL integer columns incorrectly. Thanks to Piotr Jurkiewicz for the patch. Thank you for the bug report.

Description: Memcached plugin handles unsigned integer value columns incorrectly. Column attributes are in several places compared to IB_COL_UNSIGNED: if (m_col->attr == IB_COL_UNSIGNED) However, in case when there are any other flags (like IB_COL_NOT_NULL) set on the column this comparison fails. How to repeat: SQL commands to prepare a database: USE innodb_memcache; INSERT INTO containers VALUES ("int_test", "test", "int_test", "k", "v", "", "", "", "PRIMARY"); CREATE DATABASE IF NOT EXISTS test; USE test CREATE TABLE int_test (k varchar(32), v int unsigned NOT NULL, PRIMARY KEY (k)) ENGINE=InnoDB; --- Inside a telnet connection to memcached: get @@int_test VALUE @@int_test 0 13 test/int_test END set somekey 0 0 3 543 STORED get somekey VALUE somekey 0 3 0 END --- GET returns zero, despite being 543 (it can be checked using SQL). Suggested fix: Existence of IB_COL_UNSIGNED flag should be always determined by using binary & operator: if (m_col->attr & IB_COL_UNSIGNED)