### DbEnv::rep_stat

`

###

    #include <db_cxx.h>

    int
    DbEnv::rep_stat(DB_REP_STAT **statp, u_int32_t flags);

    int
    DbEnv::rep_stat_print(u_int32_t flags);

### Description: DbEnv::rep_stat

The DbEnv::rep_stat method returns the replication subsystem statistics.

The DbEnv::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 DbEnv::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_bulk_fills;
  The number of times the bulk buffer filled up, forcing the buffer content to be sent.
u_int32_t st_bulk_overflows;
  The number of times a record was bigger than the entire bulk buffer, and therefore had to be sent as a singleton.
u_int32_t st_bulk_records;
  The number of records added to a bulk buffer.
u_int32_t st_bulk_transfers;
  The number of bulk buffers transferred (via a call to the application's send function).
u_int32_t st_client_rerequests;
  The number of times this client site received a "re-request" message, indicating that a request it previously sent to another client could not be serviced by that client. (Compare to st_client_svc_miss.)
u_int32_t st_client_svc_miss;
  The number of "request" type messages received by this client that could not be processed, forcing the originating requester to try sending the request to the master (or another client).
u_int32_t st_client_svc_req;
  The number of "request" type messages received by this client. ("Request" messages are usually sent from a client to the master, but a message marked with the DB_REP_ANYWHERE flag in the invocation of the application's send function may be sent to another client instead.)
u_int32_t st_dupmasters;
  The number of duplicate master conditions detected.
u_int32_t st_egen;
  The current election generation number.
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 responding to this site during the last election.
u_int32_t st_election_nvotes;
  The number of votes required in the last election.
u_int32_t st_election_priority;
  The election priority.
u_int32_t st_election_sec;
  The number of seconds the last election took (the total election time is st_election_sec plus st_election_usec).
u_int32_t st_election_status;
  The current election phase (0 if no election is in progress).
u_int32_t st_election_tiebreaker;
  The election tiebreaker value.
u_int32_t st_election_usec;
  The number of microseconds the last election took (the total election time is st_election_sec plus st_election_usec).
u_int32_t st_election_votes;
  The number of votes received in the last election.
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_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.
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.
u_int32_t st_next_pg;
  The next page number we expect to receive.
int st_nsites;
  The number of sites used in the last 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 DbEnv::rep_process_message.
u_int32_t st_outdated;
  The number of outdated conditions detected.
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_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.
u_int32_t st_txns_applied;
  The number of transactions applied.
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_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.

The DbEnv::rep_stat method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 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 DbEnv::rep_stat method may fail and throw DbException, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

EINVAL
  An invalid flag value or parameter was specified.

### Description: DbEnv::rep_stat_print

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

The DbEnv::rep_stat_print method may not be called before the DbEnv::open method has been called.

The DbEnv::rep_stat_print method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 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

DbEnv

### See Also

Replication and Related Methods`

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