# DbEnv.txn_stat

`

###

    import com.sleepycat.db.*;

    public DbTxnStat txn_stat(int flags)
        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:

The flags value must be set to 0 or the following value:

Db.DB_STAT_CLEAR
  Reset statistics after returning their values.

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_nrestores;
  The number of transactions that have been restored.
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.

# Class

DbEnv, DbTxn

# See Also

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

Copyright Sleepycat Software