# DbEnv.txn_stat

`

###

    import com.sleepycat.db.*;

    public DbTxnStat txn_stat(int flags)
        throws DbException;

# Description

The DbEnv.txn_stat method returns the transaction subsystem statistics.

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

Db.DB_STAT_CLEAR
  Reset statistics after returning their values.

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

public DbLsn st_last_ckp;
  The LSN of the last checkpoint.
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 of the transaction.
  public int parentid;
    The transaction ID of the parent transaction (or 0, if no parent).
  public DbLsn lsn;
    The current log sequence number when the transaction was begun.

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

Transaction Subsystem and Related Methods`

Copyright Sleepycat Software