# DB_ENV->rep_stat |

`

###

    #include <db.h>

    int
    DB_ENV->rep_stat(DB_ENV *env, DB_REP_STAT **statp, u_int32_t flags);

# Description

The DB_ENV->rep_stat method returns the replication subsystem statistics.

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

DB_STAT_CLEAR
  Reset statistics after returning their values.

The DB_ENV->rep_stat method creates a statistical structure of type DB_REP_STAT and copies a pointer to it into a user-specified memory location.

Statistical structures are created in allocated memory. If application-specific allocation routines have been declared (see DB_ENV->set_alloc for more information), they are used to allocate the memory; otherwise, the library malloc(3) interface is used. The caller is responsible for deallocating the memory. To deallocate the memory, free the memory reference; references inside the returned memory need not be individually freed.

The following DB_REP_STAT fields will be filled in:

u_int32_t st_stat;
  The current replication mode. Set to DB_REP_MASTER if the environment is a replication master, DB_REP_CLIENT if the environment is a replication client, DB_REP_LOGSONLY if the environment is a log-files-only replica, or 0 if replication is not configured.
DB_LSN st_next_lsn;
  In replication environments configured as masters, the next LSN expected. In replication environments configured as clients, the next LSN to be used.
DB_LSN st_waiting_lsn;
  The LSN of the first missed log record being waited for, or 0 if no log records are currently missing.
u_int32_t st_dupmasters;
  The number of duplicate master conditions detected.
u_int32_t st_env_id;
  The current environment ID.
u_int32_t st_env_priority;
  The current environment priority.
u_int32_t st_gen;
  The current generation number.
u_int32_t st_log_duplicated;
  The number of duplicate log records received.
u_int32_t st_log_queued;
  The number of log records currently queued.
u_int32_t st_log_queued_max;
  The maximum number of log records ever queued at once.
u_int32_t st_log_queued_total;
  The total number of log records queued.
u_int32_t st_log_records;
  The number of log records received and appended to the log.
u_int32_t st_log_requested;
  The number of log records missed and requested.
u_int32_t st_master;
  The current master environment ID.
u_int32_t st_master_changes;
  The number of times the master has changed.
u_int32_t st_msgs_badgen;
  The number of messages received with a bad generation number.
u_int32_t st_msgs_processed;
  The number of messages received and processed.
u_int32_t st_msgs_recover;
  The number of messages ignored due to pending recovery.
u_int32_t st_msgs_send_failures;
  The number of failed message sends.
u_int32_t st_msgs_sent;
  The number of messages sent.
u_int32_t st_newsites;
  The number of new site messages received.
u_int32_t st_outdated;
  The number of outdated conditions detected.
u_int32_t st_txns_applied;
  The number of transactions applied.
u_int32_t st_elections;
  The number of elections held.
u_int32_t st_elections_won;
  The number of elections won.
u_int32_t st_election_status;
  The current election phase (0 if no election is in progress).
u_int32_t st_election_cur_winner;
  The election winner.
u_int32_t st_election_gen;
  The election generation number.
DB_LSN st_election_lsn;
  The maximum LSN of election winner.
u_int32_t st_election_nsites;
  The number sites expected to participate in elections.
u_int32_t st_nthrottles;
  Transmission limited. This indicates the number of times that data transmission was stopped to limit the amount of data sent in response to a single call to DB_ENV->rep_process_message.
u_int32_t st_election_priority;
  The election priority.
u_int32_t st_election_tiebreaker;
  The election tiebreaker value.
u_int32_t st_election_votes;
  The votes received this election round.

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

# Errors

The DB_ENV->rep_stat method 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->rep_stat method may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

# Class

DB_ENV

# See Also

Replication and Related Methods`

Copyright Sleepycat Software