### DB_ENV->rep_stat

`

###

    #include <db.h>

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

    int
    DB_ENV->rep_stat_print(DB_ENV *env, u_int32_t flags);

### Description: DB_ENV->rep_stat

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

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 stored 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 standard C library malloc(3) 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_status;
  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, 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 log record we have after missing log records 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_egen;
  The current election 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.
int st_nsites;
  The number of sites believed to be in the replication group.
u_int32_t st_outdated;
  The number of outdated conditions detected.
u_int32_t st_next_pg;
  The next page number we expect to receive.
u_int32_t st_waiting_pg;
  The page number of the first page we have after missing pages being waited for, or 0 if no pages are currently missing.
u_int32_t st_pg_duplicated;
  The number of duplicate pages received.
u_int32_t st_pg_records;
  The number of pages received and stored.
u_int32_t st_pg_requested;
  The number of pages missed and requested from the master.
u_int32_t st_startup_complete;
  The client site has completed its startup procedures and is now handling live records from the master.
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_election_nvotes;
  The number of votes required to complete the election.
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.

### Parameters

flags
  The flags parameter must be set to 0 or the following value:
  DB_STAT_CLEAR
    Reset statistics after returning their values.
statp
  The statp parameter references memory into which a pointer to the allocated statistics structure is copied.

### Errors

The DB_ENV->rep_stat method may fail and return one of the following non-zero errors:

EINVAL
  An invalid flag value or parameter was specified.

### Description: DB_ENV->rep_stat_print

The DB_ENV->rep_stat_print method returns the replication subsystem statistical information, as described for the DB_ENV->rep_stat method. The information is printed to a specified output channel (see the DB_ENV->set_msgfile method for more information), or passed to an application callback function (see the DB_ENV->set_msgcall method for more information).

The DB_ENV->rep_stat_print method may not be called before the DB_ENV->open method has been called.

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

### Parameters

flags
  The flags parameter must be set to 0 or the following value:
  DB_STAT_ALL
    Display all available information.

### Class

DB_ENV

### See Also

Replication and Related Methods`

Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.