Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

advice about 'stale' data --> Ima, shared dbh handles, and txns

by water (Deacon)
Ima, shared dbh handles, and txns NODE.owner = 336353 N.title = monktitlebar sitedoclet N.owner = 17342 -->
on May 26, 2004 at 01:29 UTC ( [id://356426]=perlquestion: print w/replies, xml ) Need Help??

water has asked for the wisdom of the Perl Monks concerning the following question:

We're trying to make sense of some external code that was given to us. The code is a Mason web front-end to some mysql INNODB tables. Access to the tables is through Class::DBI (hence Ima). The code is running from mod_perl 1.99 on Apache 2. The code uses transactions.

Here's the semi-mystery: within one browser window, the app changes the DB, and those changes are seen. From a different browser window, however, those changes are sometimes not seen -- the other window (be it on a different client box, or a different browser on the same client box), it is as if the database doesn't see the txn, or the commit.

Anyone have any clues as to what this might be, as we explore the code and start ex-post-facto building tests for it? There do appear to be  Table->dbi_commit in the right places, but, we're just diving into this morass....

Replies are listed 'Best First'.
Re: advice about 'stale' data --> Ima, shared dbh handles, and txns
by perrin (Chancellor) on May 26, 2004 at 02:22 UTC
    This is happening because of the isolation level that InnoDB tables use by default. If you change the isolation level to "repeatable read", the problem will go away. See my message about this on the mod_perl list for more. I'm planning to add this to the mod_perl documentation, since it seems like something that others will get bitten by.
Re: advice about 'stale' data --> Ima, shared dbh handles, and txns
by eclark (Scribe) on May 26, 2004 at 02:45 UTC

    Are your Mason components caching output?

Re: advice about 'stale' data --> Ima, shared dbh handles, and txns
by water (Deacon) on May 26, 2004 at 09:37 UTC
    The knowledge in this community is simply amazing.
    Many many thanks, Perrin, and thanks eclark -- it looks like both mason caching and innodb 'stale data' were occurring -- we're not mason experts, but the mason issue seemed to revolve around the difference between code in <once> blocks vs. <init> block, and yes, also, innodb was showing 'old' data to the second client as it hadn't committed in a while.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://356426]
Approved by fglock
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-23 12:50 GMT
Sections?
Ima, shared dbh handles, and txns NODE.owner = 336353 N.title = Sections sitedoclet N.owner = 17342 -->
Information?
Ima, shared dbh handles, and txns NODE.owner = 336353 N.title = Information sitedoclet N.owner = 17342 -->
Find Nodes?
Ima, shared dbh handles, and txns NODE.owner = 336353 N.title = Find Nodes sitedoclet N.owner = 17342 -->
Leftovers?
    Ima, shared dbh handles, and txns NODE.owner = 336353 N.title = Leftovers sitedoclet N.owner = 17342 -->
    Voting Booth?

    No recent polls found