Skip Menu |
 

This queue is for tickets about the BerkeleyDB CPAN distribution.

Report information
The Basics
Id: 5855
Status: resolved
Priority: 0/
Queue: BerkeleyDB

People
Owner: pmqs [...] cpan.org
Requestors: barborak [...] mode20.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.25
Fixed in: 0.35



Subject: "get db's current transaction" method desirable
Download (untitled) / with headers
text/plain 505b
When working with transactions, it's necessary to associate the Txn object with not only the primary table (via the Txn() method) but also any secondary tables that are associated (via the associate() method) with it. When opening and associating this secondary table then, it seems natural to want to be able to look at the primary table object to see if there is currently a transaction object associated with it. Currently, there doesn't seem to be a method to do that. P.S. Thanks for a great module.
Download (untitled) / with headers
text/plain 725b
[guest - Wed Mar 31 10:51:36 2004]: Show quoted text
> When working with transactions, it's necessary to associate the Txn > object with not only the primary table (via the Txn() method) but > also any secondary tables that are associated (via the associate() > method) with it. When opening and associating this secondary table > then, it seems natural to want to be able to look at the primary > table object to see if there is currently a transaction object > associated with it. Currently, there doesn't seem to be a method to > do that.
Good suggestion. I'll see if I can get the Txn() method to do the right thing when the database has one (or more) secondary tables. Paul ps sorry for the delay inresponding.
From: barborak [...] basikgroup.com
Download (untitled) / with headers
text/plain 1.1k
Hi, So I ran into this issue again and wanted to run my solution by you in case it seemed correct. What I did was change this line in BerkeleyDB.xs: (db->Status = ((db->dbp)->associate)(db->dbp, NULL, sec->dbp, &cb, flags)) to this: (db->Status = ((db->dbp)->associate)(db->dbp, db->txn, sec->dbp, &cb, flags)) The problem I had occurred when in a transaction I updated a database and then created a secondary index for it. Both the database and the secondary index were stored in the same file. Because Berkeley DB creates a transaction for the associate call if none is specified, the scenario resulted in two transactions competing for a write lock on page 0 of the database resulting in a self deadlock. The change above just means that the associate is run in the same transaction as the update so no deadlock. I can't see any problems with this change - it appears to be an optimization - but perhaps it's adding a limitation that I don't see. My alternate approach was going to be to add a transaction argument to the Perl associate interface which would certainly be more general though maybe unnecessarily so. Best, Mike
Download (untitled) / with headers
text/plain 163b
Hi Mike, thanks for the patch. I will need to check that it doesn't have any undesirable side-effects before I apply it. So fingers crossed. :-) cheers Paul


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.