Gearman and $dbh/DBI cache

3 views
Skip to first unread message

Josh803316

unread,
Nov 7, 2009, 3:12:25 PM11/7/09
to gea...@googlegroups.com
Let me preface this question by stating that I have also posted the same question here: http://perlmonks.org/?node_id=805598

My problem:
I connect (cgi)gearman::xs client through gearmand to a database worker daemon(gearman::xs::worker) that is constantly running.  This worker opens a database handle and keeps it open. I use this worker to return my database queries.  Now, sometimes outside of that worker I connect to the database and create entries. For some reason, the db  is never updated with anything that is done outside of the gearmand database worker.  Which means this seems like a cacheing issue.  I tried setting the RowCacheSize to 1 when I $dbh->connect......but that didn't change anything.  I know this isn't exactly a gearman issue but I figured that some of you on the list might have faced something like this before.

Thanks in advance for any help or advice on how to go about solving this.!

dormando

unread,
Nov 7, 2009, 3:36:25 PM11/7/09
to gea...@googlegroups.com

What database/driver? Sounds like you have autocommit off and aren't
committing your changes. You need to commit between reads too, in order to
see updates since that read transaction started.

-Dormando

Josh803316

unread,
Nov 7, 2009, 3:43:26 PM11/7/09
to gea...@googlegroups.com
Dormando,

Thanks, I can't believe I left that information out:

use DBI;
use DBD::mysql;

Yes, that must be the problem.....I do have Autocommit off and I'm not committing between reads since I only commit when I do a create and that commit would be outside of gearman....

Josh803316

unread,
Nov 7, 2009, 3:59:36 PM11/7/09
to gea...@googlegroups.com
Dormondo,

Thanks so much for your help that did it. I just had to $dbh->commit; after my selects and it fixed the issue!!!  You rock!
Reply all
Reply to author
Forward
0 new messages