Bug #81512 innodb_memcached can't add entry after a previous entry with same key expires
Submitted: 19 May 2016 18:57 Modified: 29 Jun 2016 9:57
Reporter: James Smith Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Memcached Severity:S3 (Non-critical)
Version:5.7, 5.7.13 OS:Linux (red hat)
Assigned to: CPU Architecture:Any
Tags: memcached

[19 May 2016 18:57] James Smith
Description:
If you add an entry with expiry set using:

add key 0 5 1
A

Then wait 5 seconds and run

get key

You get no result BUT the entry is still in the underlying MySQL table (with expiry in past)

Now try

add key 0 5 1
B

which should work - doesn't as the entry is still in the MySQL table even if is not valid

How to repeat:
See above

Suggested fix:
Entry should be able to be added if the previous incarnation has expired.
[28 Jun 2016 13:12] MySQL Verification Team
Hello James Smith,

Thank you for the report.
Observed this with 5.7.13 build.

Thanks,
Umesh
[28 Jun 2016 13:15] MySQL Verification Team
Alternatively, you can try 'set' instead of 'add' to overwrite.
[29 Jun 2016 9:57] James Smith
The point of using add rather than set was to manage cache locks in innodb - setting would over-write the lock - but adding and checking would allow me to make sure the lock hadn't been over-written. And this works in our pure memcached implementation.

I was hoping to just re-implement this in innodb_memcache without re-writting and getting into issues with race conditions.

  * thread_a get <- not there
  * thread_b get <- not there
  * thread_a set <- value set
  * thread_b set <- value overwritten

whereas I would just need to do...

  * thread_a add <- value set
  * thread_b add <- value not set lock failed.

James