Bug #95032 memcached plugin multi-get issue when specify table_id for the first key
Submitted: 15 Apr 2019 23:40 Modified: 23 Apr 2021 13:38
Reporter: Maksym Matiukhin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Memcached Severity:S3 (Non-critical)
Version:8.0.15 OS:Linux
Assigned to: CPU Architecture:Any

[15 Apr 2019 23:40] Maksym Matiukhin
Description:
Documentation https://dev.mysql.com/doc/refman/8.0/en/innodb-memcached-multiple-get-range-query.html says:
---
When retrieving multiple values in a single get command, you can switch tables (using @@containers.name notation) to retrieve the value for the first key, but you cannot switch tables for subsequent keys. 
---

It seems it doesn't work

How to repeat:
I have 2 tables:

CREATE TABLE `auth` (
  `email` varchar(96) COLLATE utf8_unicode_ci NOT NULL,
  `password` char(64) COLLATE utf8_unicode_ci NOT NULL,
  `type` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

CREATE TABLE `numbers` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `counter` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

These tables are described in innodb_memcache.containers:
select * from innodb_memcache.containers where name in('auth','numbers');
+---------+------------------+----------+-------------+---------------+-------+------------+--------------------+------------------------+
| name    | db_schema        | db_table | key_columns | value_columns | flags | cas_column | expire_time_column | unique_idx_name_on_key |
+---------+------------------+----------+-------------+---------------+-------+------------+--------------------+------------------------+
| auth    | db | auth     | email       | password|type | 0     | 0          | 0                  | PRIMARY                |
| numbers | db | numbers  | id          | counter       | 0     | 0          | 0                  | PRIMARY                |
+---------+------------------+----------+-------------+---------------+-------+------------+--------------------+------------------------+

Here is the content for these tables:
MySQL> select * from auth;
+------------------+----------+------+
| email            | password | type |
+------------------+----------+------+
| ivan@example.com | qwerty   | xxx  |
| max@example.com  | 1234567  | 99   |
+------------------+----------+------+
2 rows in set (0.00 sec)

MySQL> select * from numbers;
+----+---------+
| id | counter |
+----+---------+
|  1 |      12 |
|  2 |      13 |
+----+---------+
2 rows in set (0.00 sec)

Here is my telnet session with memcached plugin:

get @@auth.ivan@example.com
VALUE @@auth.ivan@example.com 0 68
qwerty                                                          |xxx
END
get @@numbers.1
VALUE @@numbers.1 0 2
12
END
get @@auth
VALUE @@auth 0 21
CompromizedUsers/auth
END
get @@numbers.1 ivan@example.com
VALUE @@numbers.1 0 2
12
VALUE ivan@example.com 0 2
12
END

Value for the second key is not correct.
[22 Apr 2019 10:20] MySQL Verification Team
Hello Maksym,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[9 Apr 2021 16:41] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.25 release, and here's the proposed changelog entry from the documentation team:

Using the InnoDB memcached plugin, attempting to retrieve multiple values
in a single get command returned an incorrect value.
[23 Apr 2021 13:38] Daniel Price
Posted by developer:
 
Changelog entry moved to 8.0.26 Release Notes.