i am using memcache on a fairly high traffic drupal site, and watchdog is showing me a bunch of php warnings (and they get dumped out to the user as well!) of the type: Duplicate entry 'foobar' for key 1 query: cache_set INSERT INTO cache (data, created, expire, headers, serialized, cid) VALUES, and this seems to be coming from memcache.db.inc, in the cache_set() function.

i notice that the analogous cache_set() in the drupal core cache.inc has a db_lock_table() around the update of the cache table.

is there any reason why memcache.db.inc is *not* doing the lock on the table?

what i am assuming is happening is that the multiple processes are doing the delete/insert in cache_set() and one deletes, the other deletes, then the first inserts, and the second one tries also, and gets the warning.

has anyone else seen this problem? btw, i am sure its this insert in memcache.db.inc causing the error cuz i changed the case of the "INSERT INTO" and the case changes in the watchdog message, heh.

thanks!
-jon

Comments

fumanchu182’s picture

Hello we are having the same issue. What I think is going on is that this was written primarily for the MySQL crowd but not tested in the PostgreSQL environment. What database are you using and have you come up with a fix other than adding db_lock_table() into memcache.db.inc? (FYI we are also on a high volume production website as well.)

fumanchu182’s picture

StatusFileSize
new1.12 KB

We have patched memcache.db.inc to include locking and unlocking functionality. This has been tested against PostgreSQL.

jaydub’s picture

Status: Active » Needs review
mrfelton’s picture

subs

mkalkbrenner’s picture

Status: Needs review » Closed (duplicate)