Berkeley DB: DB_ENV->set_timeout
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

# DB_ENV->set_timeout |

`

###

    #include <db.h>

    int
    DB_ENV->set_timeout(DB_ENV *dbenv, db_timeout_t timeout, u_int32_t flags);

# Description

The DB_ENV->set_timeout function sets timeout values for locks or transactions in the database environment. The timeout value is currently specified as an unsigned 32-bit number of microseconds, limiting the maximum timeout to roughly 71 minutes.

The flags value must be set to one of the following values:

DB_SET_LOCK_TIMEOUT
  Set the timeout value for locks in this database environment.

  The database environment's transaction timeout value may also be set using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "set_txn_timeout", one or more whitespace characters, and the transaction timeout value. Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.

DB_SET_TXN_TIMEOUT
  Set the timeout value for transactions in this database environment.

  The database environment's lock timeout value may also be set using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "set_lock_timeout", one or more whitespace characters, and the lock timeout value. Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.

Timeouts are checked whenever a thread of control blocks on a lock or when deadlock detection is performed. (In the case of DB_SET_LOCK_TIMEOUT, the lock is one requested explicitly through the Lock subsystem interfaces. In the case of DB_SET_TXN_TIMEOUT, the lock is one requested on behalf of a transaction. In either case, it may be a lock requested by the database access methods underlying the application.) As timeouts are only checked when the lock request first blocks or when deadlock detection is performed, the accuracy of the timeout depends on how often deadlock detection is performed.

Timeout values specified for the database environment may be overridden on a per-lock or per-transaction basis. See DB_ENV->lock_vec and DB_TXN->set_timeout for more information.

The DB_ENV->set_timeout interface may be used only to configure Berkeley DB before the DB_ENV->open interface is called.

The DB_ENV->set_timeout function returns a non-zero error value on failure and 0 on success.

# Errors

The DB_ENV->set_timeout function may fail and return a non-zero error for the following conditions:

EINVAL
  An invalid flag value or parameter was specified.

  Called after DB_ENV->open was called.

The DB_ENV->set_timeout function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the DB_ENV->set_timeout function may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

# See Also

db_env_create, DB_ENV->close, DB_ENV->err, DB_ENV->errx DB_ENV->open, DB_ENV->remove, DB_ENV->set_alloc, DB_ENV->set_cachesize, DB_ENV->set_data_dir, DB_ENV->set_errcall, DB_ENV->set_errfile, DB_ENV->set_errpfx, DB_ENV->set_feedback, DB_ENV->set_flags, DB_ENV->set_paniccall, DB_ENV->set_recovery_init, DB_ENV->set_rpc_server, DB_ENV->set_shm_key, DB_ENV->set_tas_spins, DB_ENV->set_tmp_dir, DB_ENV->set_timeout, DB_ENV->set_verbose, db_strerror and db_version.`

Copyright Sleepycat Software