#include <db_cxx.h> int DB_ENV->txn_applied(DB_ENV *env, DB_TXN_TOKEN *token, db_timeout_t timeout, u_int32_t flags);
The DbEnv::txn_applied()
method checks to
see if a specified transaction has been replicated from the master
of a replication group. It may be called by applications using
either the Base API or the Replication Manager.
If the transaction has not yet arrived, this method will block for
the amount of time specified on the timeout
parameter while it waits for the result to be determined. For more
information, please refer to the
Read your writes consistency
section in the Berkeley DB Programmer's Reference Guide.
The DbEnv::txn_applied()
method may not be
called before the
DbEnv::open()
method.
The DbEnv::txn_applied()
method returns a
non-zero error on failure and 0 to indicate that the specified
transaction has been applied at the local site. It may also return
one of the following non-zero return codes:
DB_TIMEOUT
Returned if the specified transaction has not yet arrived
at the calling site, but can be expected to arrive soon.
If a non-zero timeout parameter is given, the this method
always waits for the specified amount of time before
returning DB_TIMEOUT
.
DB_NOTFOUND
Returned if the transaction is expected to never arrive. This occurs if the transaction has not been applied at the local site because the transaction has been rolled back due to a change of master.
A pointer to a buffer containing a copy of a commit token previously generated at the replication group's master environment. Commit tokens are created using the DbTxn::set_commit_token() method.
Specifies the maximum time to wait for the transaction to arrive by replication, expressed in microseconds. To check the status of the transaction without waiting, provide a timeout value of 0.
The DbEnv::txn_applied()
method may fail and throw a DbException
exception, encapsulating one of the following non-zero errors, or return one
of the following non-zero errors:
The specified token was generated by a transaction that did not modify the database environment (for example, a read-only transaction).
While waiting for the result to be determined, the API became locked out due to replication role change and/or master/client synchronization. The application should abort in-flight transactions, pause briefly, and then retry.
DbDeadlockException is thrown if
your Berkeley DB API is configured to throw exceptions.
Otherwise, DB_LOCK_DEADLOCK
is returned.