尝试从memcached检索过期对象时出错

时间:2014-01-24 05:31:16

标签: mysql memcached innodb

我正在尝试学习如何在MySQL 5.6中使用memcached插件。我使用telnet获取并设置值为memcached。当我尝试从memcache获取过期值时,它会显示“连接被外部主机关闭”。更多详情如下:

数据库名称:测试

表名:演示

我的表格描述

+-------+---------------------+------+-----+---------+-------+
| Field | Type                | Null | Key | Default | Extra |
+-------+---------------------+------+-----+---------+-------+
| c1    | varchar(32)         | NO   | PRI | NULL    |       |
| c21   | varchar(1024)       | YES  |     | NULL    |       |
| c22   | varchar(1024)       | YES  |     | NULL    |       |
| c3    | int(11)             | YES  |     | NULL    |       |
| c4    | bigint(20) unsigned | YES  |     | NULL    |       |
| c5    | int(11)             | YES  |     | NULL    |       |
+-------+---------------------+------+-----+---------+-------+

我的表格内容

+----+------+------+------+------+------------+
| c1 | c21  | c22  | c3   | c4   | c5         |
+----+------+------+------+------+------------+
| a  | aaaa | aaaa |    0 |    1 |          0 |
| b  | aa   | aa   |    0 |    2 | 1390372227 |
+----+------+------+------+------+------------+

容器表

+------+-----------+-----------+-------------+---------------+-------+------------+--------------------+------------------------+
| name | db_schema | db_table  | key_columns | value_columns | flags | cas_column | expire_time_column | unique_idx_name_on_key |
+------+-----------+-----------+-------------+---------------+-------+------------+--------------------+------------------------+
| aaa  | test      | demo_test | c1          | c2            | c3    | c4         | c5                 | PRIMARY                |
| bb   | test      | demo      | c1          | c21,c22       | c3    | c4         | c5                 | PRIMARY                |
+------+-----------+-----------+-------------+---------------+-------+------------+--------------------+------------------------+

缓存政策表

+--------------+-------------+-------------+---------------+--------------+
| policy_name  | get_policy  | set_policy  | delete_policy | flush_policy |
+--------------+-------------+-------------+---------------+--------------+
| cache_policy | innodb_only | innodb_only | innodb_only   | innodb_only  |
+--------------+-------------+-------------+---------------+--------------+

telnet连接

 ~ ⮀ telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
get @@bb
VALUE @@bb 0 9
test/demo
END
get a
VALUE a 0 9
aaaa|aaaa
END
get c
END
get d
END
get b
Connection closed by foreign host.

当我尝试获取memcached中不存在的值时,或者当我尝试获取未过期的值时,没有问题。此外,只有具有多个值列的表(此处为c21和c22)才会发生这种情况。如果我对只有一个值列的表执行相同操作,则没有问题。

关闭连接后,如果我尝试查询数据库,则会显示以下错误:

mysql> select * from innodb_memcache.cache_policies;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: test

有时会显示以下错误:

*** glibc detected *** /opt/mysql/server-5.6/bin/mysqld: free(): invalid pointer: 0x00007f053c008827 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f0596f39b96]
/opt/mysql/server-5.6/lib/plugin//innodb_engine.so(+0xb170)[0x7f0547df3170]
/opt/mysql/server-5.6/lib/plugin/libmemcached.so(+0x10bbb)[0x7f0569475bbb]
/opt/mysql/server-5.6/lib/plugin/libmemcached.so(+0x157b0)[0x7f056947a7b0]
/opt/mysql/server-5.6/lib/plugin/libmemcached.so(+0x16cec)[0x7f056947bcec]
/opt/mysql/server-5.6/lib/plugin/libmemcached.so(conn_parse_cmd+0x11)[0x7f056947c931]
/opt/mysql/server-5.6/lib/plugin/libmemcached.so(+0x9bdc)[0x7f056946ebdc]
/opt/mysql/server-5.6/lib/plugin/libmemcached.so(event_base_loop+0x286)[0x7f05694810d6]
/opt/mysql/server-5.6/lib/plugin/libmemcached.so(+0x19bb2)[0x7f056947ebb2]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a)[0x7f05982dbe9a]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f0596faf3fd]
======= Memory map: ========
00400000-00f6f000 r-xp 00000000 08:03 21495897                           /opt/mysql/server-5.6/bin/mysqld
0116f000-0131a000 rw-p 00b6f000 08:03 21495897                           /opt/mysql/server-5.6/bin/mysqld
0131a000-0136d000 rw-p 00000000 00:00 0 
01a44000-021a0000 rw-p 00000000 00:00 0                                  [heap]
7f0534000000-7f0534021000 rw-p 00000000 00:00 0 
7f0534021000-7f0538000000 ---p 00000000 00:00 0 
7f053c000000-7f053c021000 rw-p 00000000 00:00 0 
7f053c021000-7f0540000000 ---p 00000000 00:00 0 
7f0540000000-7f05402dd000 rw-p 00000000 00:00 0 
7f05402dd000-7f0544000000 ---p 00000000 00:00 0 
7f05445e1000-7f05445e2000 ---p 00000000 00:00 0 
7f05445e2000-7f0544de2000 rw-p 00000000 00:00 0                          [stack:30166]
7f0544de2000-7f0544de3000 ---p 00000000 00:00 0 
7f0544de3000-7f05455e3000 rw-p 00000000 00:00 0                          [stack:30160]
7f05455e3000-7f05455e4000 ---p 00000000 00:00 0 
7f05455e4000-7f0545de4000 rw-p 00000000 00:00 0                          [stack:30161]
7f0545de4000-7f0545de5000 ---p 00000000 00:00 0 
7f0545de5000-7f05465e5000 rw-p 00000000 00:00 0                          [stack:30162]
7f05465e5000-7f05465e6000 ---p 00000000 00:00 0 
7f05465e6000-7f0546de6000 rw-p 00000000 00:00 0                          [stack:30163]
7f0546de6000-7f0546de7000 ---p 00000000 00:00 0 
7f0546de7000-7f05475e7000 rw-p 00000000 00:00 0                          [stack:30165]
7f05475e7000-7f05475e8000 ---p 00000000 00:00 0 
7f05475e8000-7f0547de8000 rw-p 00000000 00:00 0                          [stack:30164]
7f0547de8000-7f0547e00000 r-xp 00000000 08:03 21505464                   /opt/mysql/server-5.6/lib/plugin/innodb_engine.so
7f0547e00000-7f0547fff000 ---p 00018000 08:03 21505464                   /opt/mysql/server-5.6/lib/plugin/innodb_engine.so
7f0547fff000-7f0548000000 rw-p 00017000 08:03 21505464                   /opt/mysql/server-5.6/lib/plugin/innodb_engine.so
7f0548000000-7f0548022000 rw-p 00000000 00:00 0 
7f0548022000-7f054c000000 ---p 00000000 00:00 0 
7f054c000000-7f054c021000 rw-p 00000000 00:00 0 
7f054c021000-7f0550000000 ---p 00000000 00:00 0 
7f0550000000-7f0550021000 rw-p 00000000 00:00 0 
7f0550021000-7f0554000000 ---p 00000000 00:00 0 
7f0554000000-7f0554021000 rw-p 00000000 00:00 0 
7f0554021000-7f0558000000 ---p 00000000 00:00 0 
7f0558000000-7f0558021000 rw-p 00000000 00:00 0 
7f0558021000-7f055c000000 ---p 00000000 00:00 0 
7f055c000000-7f055c07a000 rw-p 00000000 00:00 0 
7f055c07a000-7f0560000000 ---p 00000000 00:00 0 
7f0560000000-7f0560021000 rw-p 00000000 00:00 0 
7f0560021000-7f0564000000 ---p 00000000 00:00 0 
7f0564041000-7f0564042000 ---p 00000000 00:00 0 
7f0564042000-7f0564842000 rw-p 00000000 00:00 0 
7f0564842000-7f0564843000 ---p 00000000 00:00 0 
7f0564843000-7f0565043000 rw-p 00000000 00:00 0                          [stack:19202]
7f0565043000-7f0565044000 ---p 00000000 00:00 0 
7f0565044000-7f0565844000 rw-p 00000000 00:00 0                          [stack:19201]
7f0565844000-7f0565845000 ---p 00000000 00:00 0 
7f0565845000-7f0566045000 rw-p 00000000 00:00 0                          [stack:19200]
7f0566045000-7f0566046000 ---p 00000000 00:00 0 
7f0566046000-7f0566846000 rw-p 00000000 00:00 0                          [stack:19199]
7f0566846000-7f0566847000 ---p 00000000 00:00 0 
7f0566847000-7f0567047000 rw-p 00000000 00:00 0                          [stack:19198]
7f0567047000-7f0567048000 ---p 00000000 00:00 0 
7f0567048000-7f0567848000 rw-p 00000000 00:00 0                          [stack:19197]
7f0567848000-7f0567849000 ---p 00000000 00:00 0 
7f0567849000-7f0568049000 rw-p 00000000 00:00 0                          [stack:19196]
7f0568049000-7f056804a000 ---p 00000000 00:00 0 
7f056804a000-7f056884a000 rw-p 00000000 00:00 0                          [stack:19195]
7f056884a000-7f056884b000 ---p 00000000 00:00 0 
7f056884b000-7f05692d8000 rw-p 00000000 00:00 0                          [stack:19194]
7f0569465000-7f056948f000 r-xp 00000000 08:03 21505461                   /opt/mysql/server-5.6/lib/plugin/libmemcached.so
7f056948f000-7f056968f000 ---p 0002a000 08:03 21505461                   /opt/mysql/server-5.6/lib/plugin/libmemcached.so
7f056968f000-7f0569691000 rw-p 0002a000 08:03 21505461                   /opt/mysql/server-5.6/lib/plugin/libmemcached.so
7f0569691000-7f0569694000 rw-p 00000000 00:00 0 
7f0569694000-7f0569695000 ---p 00000000 00:00 0 
7f0569695000-7f05696c5000 rw-p 00000000 00:00 0                          [stack:20139]
7f05696c5000-7f05696c6000 ---p 00000000 00:00 0 
7f05696c6000-7f05696f6000 rw-p 00000000 00:00 0                          [stack:19203]
7f05696f6000-7f05696f7000 ---p 00000000 00:00 0 
7f05696f7000-7f0569ef7000 rw-p 00000000 00:00 0                          [stack:19192]
7f0569ef7000-7f0569ef8000 ---p 00000000 00:00 0 
7f0569ef8000-7f056a6f8000 rw-p 00000000 00:00 0                          [stack:19191]
7f056a6f8000-7f056a6f9000 ---p 00000000 00:00 0 
7f056a6f9000-7f056aef9000 rw-p 00000000 00:00 0                          [stack:19190]
7f056aef9000-7f056aefa000 ---p 00000000 00:00 0 
7f056aefa000-7f056b6fa000 rw-p 00000000 00:00 0                          [stack:19189]
7f056b6fa000-7f056b6fb000 ---p 00000000 00:00 0 
7f056b6fb000-7f056befb000 rw-p 00000000 00:00 0                          [stack:19188]
7f056befb000-7f056befc000 ---p 00000000 00:00 0 
7f056befc000-7f056c6fc000 rw-p 00000000 00:00 0                          [stack:19187]
7f056c6fc000-7f056c6fd000 ---p 00000000 00:00 0 
7f056c6fd000-7f056cefd000 rw-p 00000000 00:00 0                          [stack:19186]
7f056cefd000-7f056cefe000 ---p 00000000 00:00 0 
7f056cefe000-7f056d6fe000 rw-p 00000000 00:00 0                          [stack:19185]

1 个答案:

答案 0 :(得分:1)

这是一个错误,由于您发布的服务器崩溃日志,您的连接正在关闭。

这个问题是已知的,希望在将来的版本中修复,同时你可以避免使用表格前缀(@@ bb),因为这是问题的关键。