Bug #73014 get key1 key2 multiple command, cannot get right value of key1
Submitted: 16 Jun 2014 10:36 Modified: 24 Jul 2014 3:48
Reporter: 徹 赤松 Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Memcached Severity:S2 (Serious)
Version:mysql-5.7.4-m14 OS:Linux
Assigned to: CPU Architecture:Any
Tags: get, keys, memcached, multiple

[16 Jun 2014 10:36] 徹 赤松
Description:
i am reading memcached socecode,
plugin/innodb_memcached/daemon_memcached/daemon/memcached.c
of mysql-5.7.4.

get key1 command, can replay right value of key1.
get key2 command, can replay right value of key2.

get key1 key2
But get multiple keys command, replay wrong value of key1.

How to repeat:
# telnet localhost 11211
Trying ::1...
Connected to localhost.
Escape character is '^]'.
get AA 
VALUE AA 8 12
HELLO, HELLO *right value of key AA 
END

get BB
VALUE BB 0 10
abcdefghij *right value of key BB
END

get BB AA *multitiple get
VALUE BB 0 10
HELLO, HEL *value of key AA 10 char, not value of key BB
VALUE AA 8 12
HELLO, HELLO *value of key AA Good!
END
quit
Connection closed by foreign host.

Suggested fix:
memcached.c file, line 4084 get_item_info()function get a right value.
line 4138(has cas), line 4150 add_iov()function,
 info.value[0].iov_base has a right value,
 but multiple keys get,
 last value is always replay.

So i copied each time, info.value[0].iov_base to char array,
and set char array to add_iov()function.

After compiles, i get a right value of multiple keys get.

# telnet localhost 11211
Trying ::1...
Connected to localhost.
Escape character is '^]'.
get BB AA *multiple get
VALUE BB 0 10
abcdefghij *value of key BB Good!
VALUE AA 8 12
HELLO, HELLO *value of key AA Good!
END
quit
Connection closed by foreign host.

i am pleased if you can reply.
[11 Jul 2014 13:17] MySQL Verification Team
Thank you for the report.
Could you please share how you are setting BB or exact repeatable test case? I'm not seeing any issues here at my end:

mysql> select * from demo_test;
+----+--------------+------+------+------------+
| c1 | c2           | c3   | c4   | c5         |
+----+--------------+------+------+------------+
| AA | HELLO, HELLO |    8 |    0 |          0 |
| BB | Hello, Hello |    0 |    5 | 1405227608 |
+----+--------------+------+------+------------+
2 rows in set (0.00 sec)

mysql> select version();
+---------------+
| version()     |
+---------------+
| 5.7.4-m14-log |
+---------------+
1 row in set (0.00 sec)

//
$ telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
get AA
VALUE AA 8 12
HELLO, HELLO
END
get BB
END
set BB 0 3600 12
Hello, Hello
STORED
get AA
VALUE AA 8 12
HELLO, HELLO
END
get BB
VALUE BB 0 12
Hello, Hello
END
get BB AA
VALUE BB 0 12
HELLO, HELLO
VALUE AA 8 12
HELLO, HELLO
END
get AA BB
VALUE AA 8 12
Hello, Hello
VALUE BB 0 12
Hello, Hello
END
get BB AA
VALUE BB 0 12
HELLO, HELLO
VALUE AA 8 12
HELLO, HELLO
END

gets BB AA
VALUE BB 0 12 5
HELLO, HELLO
VALUE AA 8 12 0
HELLO, HELLO
END
[12 Jul 2014 9:06] MySQL Verification Team
Also, see Bug #73226
[14 Jul 2014 20:15] 徹 赤松
Thank you for your replay, dir Umesh.
In this your check,
 VALUE AA is "HELLO, HELLO" and
 VALUE BB is "Hello, Hello".

get AA BB
VALUE AA 8 12
Hello, Hello  *Wrong result!
VALUE BB 0 12
Hello, Hello
END
get BB AA
VALUE BB 0 12
HELLO, HELLO  *Wrong result!
VALUE AA 8 12
HELLO, HELLO
END
[16 Jul 2014 4:24] MySQL Verification Team
Thank you for the feedback.
[24 Jul 2014 3:48] Erlend Dahl
Duplicate of Bug#72453 InnoDB Memcached Plugin "gets" command