6120b3d Make all backend operations transaction aware

Authored and Committed by rmeggins 12 years ago
    Make all backend operations transaction aware
    
    All backend functions will use the parent transaction (if any) to perform
    all database read/write operations, and for the creation of nested
    transactions.  The pseudocode looks like this:
    begin operation
    grab parent txn from pblock SLAPI_TXN and save to a local variable
    use this parent txn to perform any searches or other ops before the
      nested txn is created (if created - search ops do not do this)
    create the nested txn (if a write op) using the parent_txn
    stash the new txn in the pblock SLAPI_TXN
    call the betxnpreop plugins
    perform the backend ops inside the txn
    call the betxnpostop plugins
    commit the nested txn
    restore the saved parent_txn to the pblock SLAPI_TXN
    upon failure, abort the nested txn and restore the saved parent_txn
      to the pblock SLAPI_TXN
    
    There were a few api changes to allow the txn to be passed in wherever
    it is needed.
    The database lock was changed from a mutex to a monitor to allow plugins
    to call other plugins inside the same parent transaction.
    Reviewed by: nhosoi (Thanks!)