Berkeley DB: DbEnv.txn_stat
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++

# DbEnv.txn_stat |

`

###

    import com.sleepycat.db.*;

    public DbTxnStat txn_stat()
    	throws DbException;

# Description

The DbEnv.txn_stat method creates a DbTxnStat object encapsulating a statistical structure. The transaction region statistics are stored in a DbTxnStat object. The following data fields are available from the DbTxnStat object:

Statistical structures are created in allocated memory. If db_malloc is non-NULL, it is called to allocate the memory, otherwise, the library function malloc(3) is used. The function db_malloc must match the calling conventions of the malloc(3) library routine. Regardless, the caller is responsible for deallocating the returned memory. To deallocate returned memory, free the returned memory reference, references inside the returned memory do not need to be individually freed.

The transaction region statistics are stored in a structure of type DB_TXN_STAT. The following DB_TXN_STAT fields will be filled in:

public DbLsn st_last_ckp;
  The LSN of the last checkpoint.
public DbLsn st_pending_ckp;
  The LSN of any checkpoint that is currently in progress. If st_pending_ckp is the same as st_last_ckp there is no checkpoint in progress.
public long st_time_ckp;
  The time the last completed checkpoint finished (as the number of seconds since the Epoch, returned by the IEEE/ANSI Std 1003.1 (POSIX) time interface).
public int st_last_txnid;
  The last transaction ID allocated.
public int st_maxtxns;
  The maximum number of active transactions possible.
public int st_nactive;
  The number of transactions that are currently active.
public int st_maxnactive;
  The maximum number of active transactions at any one time.
public int st_nbegins;
  The number of transactions that have begun.
public int st_naborts;
  The number of transactions that have aborted.
public int st_ncommits;
  The number of transactions that have committed.
public int st_regsize;
  The size of the region.
public int st_region_wait;
  The number of times that a thread of control was forced to wait before obtaining the region lock.
public int st_region_nowait;
  The number of times that a thread of control was able to obtain the region lock without waiting.
public Active st_txnarray[];
  The array of active transactions. Each element of the array is an object of type DbTxnStat.Active, a top level inner class, that has the following fields:

  public int txnid;
    The Transaction ID.
  public DbLsn lsn;
    The Lsn of the begin record.

The DbEnv.txn_stat method throws an exception that encapsulates a non-zero error value on failure.

# Errors

The DbEnv.txn_stat method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the DbEnv.txn_stat method may fail and throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.

### Classes

DbEnv, DbTxn

# See Also

DbEnv.set_tx_max, DbEnv.set_tx_timestamp, DbTxn.abort, DbEnv.txn_begin, DbEnv.txn_checkpoint, DbTxn.commit, DbTxn.id, DbTxn.prepare and DbEnv.txn_stat.`

Copyright Sleepycat Software