I just had a blast investigating some troublesome DB behavior and
wanted to get it down in writing. This also may affect the way
DataMapper handles transactions, or atleast the way I'm using them.
Yesterday I noticed certain update queries were hanging indefinitely.
Doing a "SELECT * FROM pg_stat_activity;" would show the query in a
waiting state. I assumed this was do to a locking issue. I couldn't
find any processes that were holding a lock, so I tried restarting the
Postgresql server to no avail. After much Googling I found this
little gem "SELECT * FROM pg_prepared_xacts;".
What I gather happened is that because my DataMapper
`dm_instance.transaction { #awesome stuff }` uses prepared
transactions, if a process dies in the middle of one of these
transactions there isn't an ensure block rolling back the transaction.
This leaves rouge transaction ids floating around which much be
removed manually using "ROLLBACK PREPARED
id_from_the_pg_prepared_xacts_table;". Is there a way to force
DataMapper to use regular transactions?
At least now I know if random update statements start hanging, "SELECT
* FROM pg_prepared_xacts;" is your saving grace.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---