rep_stat.html   [plain text]


<!--$Id: rep_stat.so,v 10.46 2007/12/05 13:39:41 sue Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DbEnv::rep_stat</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<b>DbEnv::rep_stat</b>
</td>
<td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include &lt;db_cxx.h&gt;
<p>
int
DbEnv::rep_stat(DB_REP_STAT **statp, u_int32_t flags);
<p>
int
DbEnv::rep_stat_print(u_int32_t flags);
</pre></b>
<hr size=1 noshade>
<b>Description: DbEnv::rep_stat</b>
<p>The DbEnv::rep_stat method returns the replication subsystem statistics.</p>
<p>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.</p>
<p>Statistical structures are stored in allocated memory.  If application-specific allocation
routines have been declared (see <a href="../api_cxx/env_set_alloc.html">DbEnv::set_alloc</a> for more
information), they are used to allocate the memory; otherwise, the
standard C library <b>malloc</b>(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 DB_REP_STAT fields will be filled in:</p>
<br>
<b>u_int32_t st_bulk_fills;</b><ul compact><li>The number of times the bulk buffer filled up, forcing the buffer content
to be sent.</ul>
<b>u_int32_t st_bulk_overflows;</b><ul compact><li>The number of times a record was bigger than the entire bulk buffer,
and therefore had to be sent as a singleton.</ul>
<b>u_int32_t st_bulk_records;</b><ul compact><li>The number of records added to a bulk buffer.</ul>
<b>u_int32_t st_bulk_transfers;</b><ul compact><li>The number of bulk buffers transferred (via a call to the
application's <b>send</b> function).</ul>
<b>u_int32_t st_client_rerequests;</b><ul compact><li>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
<b>st_client_svc_miss</b>.)</ul>
<b>u_int32_t st_client_svc_miss;</b><ul compact><li>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).</ul>
<b>u_int32_t st_client_svc_req;</b><ul compact><li>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 href="../api_cxx/rep_transport.html#DB_REP_ANYWHERE">DB_REP_ANYWHERE</a> flag in the invocation
of the application's <b>send</b> function may be sent to another client
instead.)</ul>
<b>u_int32_t st_dupmasters;</b><ul compact><li>The number of duplicate master conditions originally detected at this site.</ul>
<b>u_int32_t st_egen;</b><ul compact><li>The current election generation number.</ul>
<b>u_int32_t st_election_cur_winner;</b><ul compact><li>The election winner.</ul>
<b>u_int32_t st_election_gen;</b><ul compact><li>The election generation number.</ul>
<b>DB_LSN st_election_lsn;</b><ul compact><li>The maximum LSN of election winner.</ul>
<b>u_int32_t st_election_nsites;</b><ul compact><li>The number sites responding to this site during the last election.</ul>
<b>u_int32_t st_election_nvotes;</b><ul compact><li>The number of votes required in the last election.</ul>
<b>u_int32_t st_election_priority;</b><ul compact><li>The election priority.</ul>
<b>u_int32_t st_election_sec;</b><ul compact><li>The number of seconds the last election took (the total election time
is <b>st_election_sec</b> plus <b>st_election_usec</b>).</ul>
<b>u_int32_t st_election_status;</b><ul compact><li>The current election phase (0 if no election is in progress).</ul>
<b>u_int32_t st_election_tiebreaker;</b><ul compact><li>The election tiebreaker value.</ul>
<b>u_int32_t st_election_usec;</b><ul compact><li>The number of microseconds the last election took (the total election
time is <b>st_election_sec</b> plus <b>st_election_usec</b>).</ul>
<b>u_int32_t st_election_votes;</b><ul compact><li>The number of votes received in the last election.</ul>
<b>u_int32_t st_elections;</b><ul compact><li>The number of elections held.</ul>
<b>u_int32_t st_elections_won;</b><ul compact><li>The number of elections won.</ul>
<b>u_int32_t st_env_id;</b><ul compact><li>The current environment ID.</ul>
<b>u_int32_t st_env_priority;</b><ul compact><li>The current environment priority.</ul>
<b>u_int32_t st_gen;</b><ul compact><li>The current generation number.</ul>
<b>u_int32_t st_log_duplicated;</b><ul compact><li>The number of duplicate log records received.</ul>
<b>u_int32_t st_log_queued;</b><ul compact><li>The number of log records currently queued.</ul>
<b>u_int32_t st_log_queued_max;</b><ul compact><li>The maximum number of log records ever queued at once.</ul>
<b>u_int32_t st_log_queued_total;</b><ul compact><li>The total number of log records queued.</ul>
<b>u_int32_t st_log_records;</b><ul compact><li>The number of log records received and appended to the log.</ul>
<b>u_int32_t st_log_requested;</b><ul compact><li>The number of times log records were missed and requested.</ul>
<b>u_int32_t st_master;</b><ul compact><li>The current master environment ID.</ul>
<b>u_int32_t st_master_changes;</b><ul compact><li>The number of times the master has changed.</ul>
<b>u_int32_t st_max_lease_sec;</b><ul compact><li>The number of seconds of the longest lease (the total lease time
is <b>st_max_lease_sec</b> plus <b>st_max_lease_usec</b>).</ul>
<b>u_int32_t st_max_lease_usec;</b><ul compact><li>The number of microseconds of the longest lease (the total lease
time is <b>st_max_lease_sec</b> plus <b>st_max_lease_usec</b>).</ul>
<b>DB_LSN st_max_perm_lsn;</b><ul compact><li>The LSN of the maximum permanent log record, or 0 if there are no
permanent log records.</ul>
<b>u_int32_t st_msgs_badgen;</b><ul compact><li>The number of messages received with a bad generation number.</ul>
<b>u_int32_t st_msgs_processed;</b><ul compact><li>The number of messages received and processed.</ul>
<b>u_int32_t st_msgs_recover;</b><ul compact><li>The number of messages ignored due to pending recovery.</ul>
<b>u_int32_t st_msgs_send_failures;</b><ul compact><li>The number of failed message sends.</ul>
<b>u_int32_t st_msgs_sent;</b><ul compact><li>The number of messages sent.</ul>
<b>u_int32_t st_newsites;</b><ul compact><li>The number of new site messages received.</ul>
<b>DB_LSN st_next_lsn;</b><ul compact><li>In replication environments configured as masters, the next LSN expected.
In replication environments configured as clients, the next LSN to be used.</ul>
<b>u_int32_t st_next_pg;</b><ul compact><li>The next page number we expect to receive.</ul>
<b>u_int32_t st_nsites;</b><ul compact><li>The number of sites used in the last election.</ul>
<b>u_int32_t st_nthrottles;</b><ul compact><li>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 href="../api_cxx/rep_message.html">DbEnv::rep_process_message</a>.</ul>
<b>u_int32_t st_outdated;</b><ul compact><li>The number of outdated conditions detected.</ul>
<b>u_int32_t st_pg_duplicated;</b><ul compact><li>The number of duplicate pages received.</ul>
<b>u_int32_t st_pg_records;</b><ul compact><li>The number of pages received and stored.</ul>
<b>u_int32_t st_pg_requested;</b><ul compact><li>The number of pages missed and requested from the master.</ul>
<b>u_int32_t st_startsync_delayed;</b><ul compact><li>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).</ul>
<b>u_int32_t st_startup_complete;</b><ul compact><li>The client site has completed its startup procedures and is now
handling live records from the master.</ul>
<b>u_int32_t st_status;</b><ul compact><li>The current replication mode.  Set to <a href="../api_cxx/repmgr_start.html#DB_REP_MASTER">DB_REP_MASTER</a> if the
environment is a replication master, <a href="../api_cxx/repmgr_start.html#DB_REP_CLIENT">DB_REP_CLIENT</a> if the
environment is a replication client, or 0 if replication is not
configured.</ul>
<b>u_int32_t st_txns_applied;</b><ul compact><li>The number of transactions applied.</ul>
<b>DB_LSN st_waiting_lsn;</b><ul compact><li>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.</ul>
<b>u_int32_t st_waiting_pg;</b><ul compact><li>The page number of the first page we have after missing pages
being waited for, or 0 if no pages are currently missing.</ul>
<br>
<p>The DbEnv::rep_stat method may not be called before the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is called.</p>
<p>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.
</p>
<b>Parameters</b> <br>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or
the following value:
<br>
<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after returning their values.</ul>
<br></ul>
 <b>statp</b><ul compact><li>The <b>statp</b> parameter references memory into which
a pointer to the allocated statistics structure is copied.</ul> 
<br>
<br><b>Errors</b>
<p>The DbEnv::rep_stat method
may fail and throw
<a href="../api_cxx/except_class.html">DbException</a>,
encapsulating one of the following non-zero errors, or return one of
the following non-zero errors:</p>
<br>
<b>EINVAL</b><ul compact><li>An
invalid flag value or parameter was specified.</ul>
<br>
<hr size=1 noshade>
<b>Description: DbEnv::rep_stat_print</b>
<p>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
<a href="../api_cxx/env_set_msgfile.html">DbEnv::set_msgfile</a> method for more information), or passed to an
application callback function (see the <a href="../api_cxx/env_set_msgcall.html">DbEnv::set_msgcall</a> method for
more information).</p>
<p>The DbEnv::rep_stat_print method may not be called before the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is called.</p>
<p>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.
</p>
<b>Parameters</b> <br>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one
or more of the following values:
<br>
<b><a name="DB_STAT_ALL">DB_STAT_ALL</a></b><ul compact><li>Display all available information.</ul>
<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after displaying their values.</ul>
<br></ul>
<br>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_cxx/env_class.html">DbEnv</a>
<br><b>See Also</b>
<a href="../api_cxx/rep_list.html">Replication and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>