--- BDB/BDB.pm 2007/09/13 21:34:00 1.15 +++ BDB/BDB.pm 2007/09/16 18:17:58 1.16 @@ -181,21 +181,22 @@ =head4 db_txn_finish (DB_TXN *txn, U32 flags = 0, SV *callback = &PL_sv_undef) -This is not a Berkeley DB function but a BDB module extension. It is very -annoying to have to check every single BDB function for error returns and -provide a codepath out of your transaction. While the BDB module still -makes this possible, it contains the following extensions: +This is not actually a Berkeley DB function but a BDB module +extension. The background for this exytension is: It is very annoying to +have to check every single BDB function for error returns and provide a +codepath out of your transaction. While the BDB module still makes this +possible, it contains the following extensions: When a transaction-protected function returns any operating system error (errno > 0), BDB will set the C flag on the -transaction. This flag is also set by Berkeley DB functions externally +transaction. This flag is also set by Berkeley DB functions themselves when an operation fails with LOCK_DEADLOCK, and it causes all further operations on that transaction (including C) to fail. The C request will look at this flag, and, if it is set, will automatically call C (setting errno to C -if it isn't set). If it isn't set, it will call C and -return the error normally. +if it isn't set to something else yet). If it isn't set, it will call +C and return the error normally. How to use this? Easy: just write your transaction normally: @@ -210,7 +211,7 @@ requests (db_put in this case) will simply be skipped (they will fail with LOCK_DEADLOCK) and the transaction will be aborted. -You cna use the C<< $txn->failed >> method to check wether a transaction +You can use the C<< $txn->failed >> method to check wether a transaction has failed in this way and abort further processing (excluding C).