DB_ENV->txn_applied()

#include <db.h>

int
DB_ENV->txn_applied(DB_ENV *env, DB_TXN_TOKEN *token, 
                    db_timeout_t timeout, u_int32_t flags);  

The DB_ENV->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 DB_ENV->txn_applied() method may not be called before the DB_ENV->open() method.

The DB_ENV->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:

Parameters

token

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 DB_TXN->set_commit_token() method.

timeout

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.

flags

The flags parameter is currently unused, and must be set to 0.

Errors

The DB_ENV->txn_applied() method may fail and return one of the following non-zero errors:

DB_KEYEMPTY

The specified token was generated by a transaction that did not modify the database environment (for example, a read-only transaction).

DB_LOCK_DEADLOCK

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.

EINVAL

If the database environment was not already opened; or if the specified token was generated from a non-replicated database environment.

Class

DB_ENV

See Also

Transaction Subsystem and Related Methods, Replication and Related Methods