简体   繁体   English

RDS中的Innodb memcached插件不会删除过期的行

[英]Innodb memcached plugin in RDS not deleting expired rows

I recently setup an RDS instance in AWS for MySQL 5.6 with the new Memcached InnoDB plugin. 我最近在AWS中使用新的Memcached InnoDB插件在MySQL 5.6中设置了RDS实例。 Everything works great and my app can store and retrieve cached items from the mapped table. 一切正常,我的应用程序可以从映射表中存储和检索缓存的项目。 When I store items I provide a timeout, and memcached correctly does not return the item once its TTL has expired. 当我存储项目时,我会提供一个超时,并且一旦其TTL过期,memcached不会正确返回该项目。 So far so good.... 到现在为止还挺好....

However when I look at the underlying table, it is full of rows which have already expired. 但是,当我查看基础表时,它充满了已经过期的行。

The MySQL documentation ( http://dev.mysql.com/doc/refman/5.6/en/innodb-memcached-intro.html ) indicates that item expiration has no effect when using the " innodb_only " caching policy (although it doesn't explicitly indicate which operation it is referring to). MySQL文档( http://dev.mysql.com/doc/refman/5.6/en/innodb-memcached-intro.html )指出,使用“ innodb_only ”缓存策略时,项目有效期无效(尽管它不会) t明确指出它指的是哪个操作)。 In any case my cache_policies table looks like this: 无论如何,我的cache_policies表如下所示:

mysql> select * from innodb_memcache.cache_policies;
+--------------+------------+------------+---------------+--------------+
| policy_name  | get_policy | set_policy | delete_policy | flush_policy |
+--------------+------------+------------+---------------+--------------+
| cache_policy | caching    | caching    | innodb_only   | innodb_only  | 
+--------------+------------+------------+---------------+--------------+
1 row in set (0.01 sec)

So, per the docs the expiration field should be respected. 因此,根据文档,应遵守到期字段。

For reference my containers table looks like this: 供参考,我的容器表如下所示:

mysql> select * from innodb_memcache.containers;
+---------+-----------+-----------+-------------+---------------+-------+------------+--------------------+------------------------+
| name    | db_schema | db_table  | key_columns | value_columns | flags | cas_column | expire_time_column | unique_idx_name_on_key |
+---------+-----------+-----------+-------------+---------------+-------+------------+--------------------+------------------------+
| default | sessions  | userData  | sessionID   | data          | c3    | c4         | c5                 | PRIMARY                | 
+---------+-----------+-----------+-------------+---------------+-------+------------+--------------------+------------------------+
2 rows in set (0.00 sec)

And the data table is: 数据表是:

mysql> desc sessions.userData;
+-----------+---------------------+------+-----+---------+-------+
| Field     | Type                | Null | Key | Default | Extra |
+-----------+---------------------+------+-----+---------+-------+
| sessionID | varchar(128)        | NO   | PRI | NULL    |       | 
| data      | blob                | YES  |     | NULL    |       | 
| c3        | int(11)             | YES  |     | NULL    |       | 
| c4        | bigint(20) unsigned | YES  |     | NULL    |       | 
| c5        | int(11)             | YES  |     | NULL    |       | 
+-----------+---------------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

One more detail, the MySQL docs state that after modifying caching policies you need to re-install the Memcached plugin, but I did not find a way to do this on RDS, so I removed the Memcached option group, rebooted, added the memcached option group again, rebooted again... but there was no apparent change in behavior. 更详细的说,MySQL文档指出,在修改缓存策略之后,您需要重新安装Memcached插件,但是我没有找到在RDS上执行此操作的方法,因此我删除了Memcached选项组,重新启动,添加了memcached选项组再次,再次重新启动...但是行为没有明显变化。

So, to conclude, am I missing some step or configuration here? 因此,总而言之,我是否在这里缺少一些步骤或配置? I would hate to have to create a separate process just to delete the expired rows from the table, since I was expecting the Memcached integration to do this for me. 我不希望不得不创建一个单独的过程只是为了删除表中的过期行,因为我期望Memcached集成能够为我做到这一点。

I'm by no means an expert, as I've just started to play around with memcached myself. 我绝不是专家,因为我刚刚开始尝试使用内存缓存。 However, this is from the MySQL documentation for the python tutorial. 但是,这来自python教程的MySQL文档。

It seems to be saying that if you use the InnoDB memcached plugin, MySQL will handle cache expiration, and it really doesn't matter what you enter for the cache expire time. 似乎是在说,如果您使用InnoDB memcached插件,MySQL将处理缓存过期,并且您为缓存过期时间输入的内容实际上并不重要。

And for the flags, expire, and CAS values, we specify corresponding columns based on the settings from the sample table demo.test. 对于标志,过期和CAS值,我们基于示例表demo.test中的设置指定相应的列。 These values are typically not significant in applications using the InnoDB memcached plugin, because MySQL keeps the data synchronized and there is no need to worry about data expiring or being stale. 在使用InnoDB memcached插件的应用程序中,这些值通常并不重要,因为MySQL保持数据同步,并且无需担心数据过期或过时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM