Weird MySQL+Gearman issue

From: Date: Fri, 14 Dec 2012 05:38:50 +0000
Subject: Weird MySQL+Gearman issue
Groups: php.general 
Request: Send a blank email to php-general+get-319883@lists.php.net to get a copy of this message
Hi all, I have a typical web application that does some basic CRUD operations. Operations that modify the database (inserts, updates, deletes) trigger a background gearman job to refresh the cache that is used for another application. The problem is that when I do an update the gearman worker script (which has its own database connection) does not pick up the updates. For example if I were to update a row: UPDATE table SET rowname = 'updated value' WHERE rowid = 1, the respective row is updated correctly, but when the worker gets around to handle the job of refreshing the cache for that row the SELECT FROM table WHERE rowid = 1 picks up the older value (the one before the update). I activated the mysql log and the queries are definitely run in the correct order (first the update and the select on a another connection). Has anybody encountered this issue before? I should also mention that the worker is setup to run a certain number of cache refreshing jobs after which it will die, but it will use the same connection to do those jobs. If I force the worker to use a new connection for each job everything works fine, otherwise the update is picked up only for the first job but not for the subsequent jobs. Any ideas? Thanks in advance.

« previous php.general (#319883) next »