<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>DbEnv::rep_stat()</title> <link rel="stylesheet" href="apiReference.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> <link rel="up" href="rep.html" title="Chapter 11. Replication Methods" /> <link rel="prev" href="repstart.html" title="DbEnv::rep_start()" /> <link rel="next" href="repstat_print.html" title="DbEnv::rep_stat_print()" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">DbEnv::rep_stat()</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="repstart.html">Prev</a> </td> <th width="60%" align="center">Chapter 11. Replication Methods </th> <td width="20%" align="right"> <a accesskey="n" href="repstat_print.html">Next</a></td> </tr> </table> <hr /> </div> <div class="sect1" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="repstat"></a>DbEnv::rep_stat()</h2> </div> </div> </div> <pre class="programlisting">#include <db_cxx.h> int DbEnv::rep_stat(DB_REP_STAT **statp, u_int32_t flags); </pre> <p> The <code class="methodname">DbEnv::rep_stat()</code> method returns the replication subsystem statistics. </p> <p> The <code class="methodname">DbEnv::rep_stat()</code> method creates a statistical structure of type <code class="literal">DB_REP_STAT</code> and copies a pointer to it into a user-specified memory location. </p> <p> Statistical structures are stored in allocated memory. If application-specific allocation routines have been declared (see <a class="xref" href="envset_alloc.html" title="DbEnv::set_alloc()">DbEnv::set_alloc()</a> for more information), they are used to allocate the memory; otherwise, the standard C library <span class="bold"><strong>malloc</strong></span>(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. </p> <p> The following <code class="literal">DB_REP_STAT</code> fields will be filled in: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> <span class="bold"><strong>uintmax_t st_bulk_fills;</strong></span> </p> <p> The number of times the bulk buffer filled up, forcing the buffer content to be sent. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_bulk_overflows;</strong></span> </p> <p> The number of times a record was bigger than the entire bulk buffer, and therefore had to be sent as a singleton. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_bulk_records;</strong></span> </p> <p> The number of records added to a bulk buffer. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_bulk_transfers;</strong></span> </p> <p> The number of bulk buffers transferred (via a call to the application's <span class="bold"><strong>send</strong></span> function). </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_client_rerequests;</strong></span> </p> <p> 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 <span class="bold"><strong>st_client_svc_miss</strong></span>.) </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_client_svc_miss;</strong></span> </p> <p> 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). </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_client_svc_req;</strong></span> </p> <p> 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 <a class="link" href="reptransport.html#transport_DB_REP_ANYWHERE">DB_REP_ANYWHERE</a> flag in the invocation of the application's <span class="bold"><strong>send</strong></span> function may be sent to another client instead.) </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_dupmasters;</strong></span> </p> <p> The number of duplicate master conditions originally detected at this site. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_egen;</strong></span> </p> <p> The election generation number for the current or next election. </p> </li> <li> <p> <span class="bold"><strong>int st_election_cur_winner;</strong></span> </p> <p> The environment ID of the winner of the current or last election. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_election_gen;</strong></span> </p> <p> The master generation number of the winner of the current or last election. </p> </li> <li> <p> <span class="bold"><strong>DB_LSN st_election_lsn;</strong></span> </p> <p> The maximum LSN of the winner of the current or last election. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_election_nsites;</strong></span> </p> <p> The number of sites responding to this site during the current election. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_election_nvotes;</strong></span> </p> <p> The number of votes required in the current or last election. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_election_priority;</strong></span> </p> <p> The priority of the winner of the current or last election. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_election_sec;</strong></span> </p> <p> The number of seconds the last election took (the total election time is <span class="bold"><strong>st_election_sec</strong></span> plus <span class="bold"><strong>st_election_usec</strong></span>). </p> </li> <li> <p> <span class="bold"><strong>int st_election_status;</strong></span> </p> <p> The current election phase (0 if no election is in progress). </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_election_tiebreaker;</strong></span> </p> <p> The tiebreaker value of the winner of the current or last election. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_election_usec;</strong></span> </p> <p> The number of microseconds the last election took (the total election time is <span class="bold"><strong>st_election_sec</strong></span> plus <span class="bold"><strong>st_election_usec</strong></span>). </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_election_votes;</strong></span> </p> <p> The number of votes received during the current election. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_elections;</strong></span> </p> <p> The number of elections held. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_elections_won;</strong></span> </p> <p> The number of elections won. </p> </li> <li> <p> <span class="bold"><strong>int st_env_id;</strong></span> </p> <p> The current environment ID. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_env_priority;</strong></span> </p> <p> The current environment priority. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_gen;</strong></span> </p> <p> The current master generation number. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_log_duplicated;</strong></span> </p> <p> The number of duplicate log records received. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_log_queued;</strong></span> </p> <p> The number of log records currently queued. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_log_queued_max;</strong></span> </p> <p> The maximum number of log records ever queued at once. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_log_queued_total;</strong></span> </p> <p> The total number of log records queued. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_log_records;</strong></span> </p> <p> The number of log records received and appended to the log. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_log_requested;</strong></span> </p> <p> The number of times log records were missed and requested. </p> </li> <li> <p> <span class="bold"><strong>int st_master;</strong></span> </p> <p> The current master environment ID. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_master_changes;</strong></span> </p> <p> The number of times the master has changed. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_max_lease_sec;</strong></span> </p> <p> The number of seconds of the longest lease (the total lease time is <span class="bold"><strong>st_max_lease_sec</strong></span> plus <span class="bold"><strong>st_max_lease_usec</strong></span>). </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_max_lease_usec;</strong></span> </p> <p> The number of microseconds of the longest lease (the total lease time is <span class="bold"><strong>st_max_lease_sec</strong></span> plus <span class="bold"><strong>st_max_lease_usec</strong></span>). </p> </li> <li> <p> <span class="bold"><strong>DB_LSN st_max_perm_lsn;</strong></span> </p> <p> The LSN of the maximum permanent log record, or 0 if there are no permanent log records. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_msgs_badgen;</strong></span> </p> <p> The number of messages received with a bad generation number. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_msgs_processed;</strong></span> </p> <p> The number of messages received and processed. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_msgs_recover;</strong></span> </p> <p> The number of messages ignored due to pending recovery. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_msgs_send_failures;</strong></span> </p> <p> The number of failed message sends. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_msgs_sent;</strong></span> </p> <p> The number of messages sent. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_newsites;</strong></span> </p> <p> The number of new site messages received. </p> </li> <li> <p> <span class="bold"><strong>DB_LSN st_next_lsn;</strong></span> </p> <p> In replication environments configured as masters, the next LSN to be used. In replication environments configured as clients, the next LSN expected. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_next_pg;</strong></span> </p> <p> The next page number we expect to receive. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_nsites;</strong></span> </p> <p> The number of sites used in the last election. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_nthrottles;</strong></span> </p> <p> 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 <a class="xref" href="repmessage.html" title="DbEnv::rep_process_message()">DbEnv::rep_process_message()</a>. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_outdated;</strong></span> </p> <p> The number of outdated conditions detected. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_pg_duplicated;</strong></span> </p> <p> The number of duplicate pages received. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_pg_records;</strong></span> </p> <p> The number of pages received and stored. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_pg_requested;</strong></span> </p> <p> The number of pages missed and requested from the master. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_startsync_delayed;</strong></span> </p> <p> The number of times the client had to delay the start of a cache flush operation (initiated by the master for an impending checkpoint) because it was missing some previous log record(s). </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_startup_complete;</strong></span> </p> <p> The client site has completed its startup procedures and is now handling live records from the master. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_status;</strong></span> </p> <p> The current replication mode. Set to <a class="link" href="repmgrstart.html#repmgrstart_DB_REP_MASTER">DB_REP_MASTER</a> if the environment is a replication master, <a class="link" href="repmgrstart.html#repmgrstart_DB_REP_CLIENT">DB_REP_CLIENT</a> if the environment is a replication client, or 0 if replication is not configured. </p> </li> <li> <p> <span class="bold"><strong>uintmax_t st_txns_applied;</strong></span> </p> <p> The number of transactions applied. </p> </li> <li> <p> <span class="bold"><strong>DB_LSN st_waiting_lsn;</strong></span> </p> <p> 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. </p> </li> <li> <p> <span class="bold"><strong>u_int32_t st_waiting_pg;</strong></span> </p> <p> The page number of the first page we have after missing pages being waited for, or 0 if no pages are currently missing. </p> </li> </ul> </div> <p> The <code class="methodname">DbEnv::rep_stat()</code> method may not be called before the <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is called. </p> <p> The <code class="methodname">DbEnv::rep_stat()</code> <span> <span> 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. </span> </span> </p> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id1705537"></a>Parameters</h3> </div> </div> </div> <div class="sect3" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h4 class="title"><a id="id1705411"></a>flags</h4> </div> </div> </div> <p> The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 or the following value: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> <code class="literal">DB_STAT_CLEAR</code> </p> <p> Reset statistics after returning their values. </p> </li> </ul> </div> </div> <div class="sect3" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h4 class="title"><a id="id1706745"></a>statp</h4> </div> </div> </div> <p> The <span class="bold"><strong>statp</strong></span> parameter references memory into which a pointer to the allocated statistics structure is copied. </p> </div> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id1706599"></a>Errors</h3> </div> </div> </div> <p> The <code class="methodname">DbEnv::rep_stat()</code> <span> <span> method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors: </span> </span> </p> <div class="sect3" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h4 class="title"><a id="id1705312"></a>EINVAL</h4> </div> </div> </div> <p> If the database environment was not already opened; or if an invalid flag value or parameter was specified. </p> </div> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id1706356"></a>Class</h3> </div> </div> </div> <p> <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> </p> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id1706380"></a>See Also</h3> </div> </div> </div> <p> <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> </p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="repstart.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="rep.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="repstat_print.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">DbEnv::rep_start() </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> DbEnv::rep_stat_print()</td> </tr> </table> </div> </body> </html>