1<!--$Id: rep_stat.so,v 10.46 2007/12/05 13:39:41 sue Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DB_ENV-&gt;rep_stat</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DB_ENV-&gt;rep_stat</b>
14</td>
15<td align=right>
16<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;rep_stat(DB_ENV *env, DB_REP_STAT **statp, u_int32_t flags);
26<p>
27int
28DB_ENV-&gt;rep_stat_print(DB_ENV *env, u_int32_t flags);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DB_ENV-&gt;rep_stat</b>
32<p>The DB_ENV-&gt;rep_stat method returns the replication subsystem statistics.</p>
33<p>The DB_ENV-&gt;rep_stat method creates a statistical structure of type
34DB_REP_STAT and copies a pointer to it into a user-specified memory
35location.</p>
36<p>Statistical structures are stored in allocated memory.  If application-specific allocation
37routines have been declared (see <a href="../api_c/env_set_alloc.html">DB_ENV-&gt;set_alloc</a> for more
38information), they are used to allocate the memory; otherwise, the
39standard C library <b>malloc</b>(3) is used.  The caller is
40responsible for deallocating the memory.  To deallocate the memory, free
41the memory reference; references inside the returned memory need not be
42individually freed.</p>
43<p>The following DB_REP_STAT fields will be filled in:</p>
44<br>
45<b>u_int32_t st_bulk_fills;</b><ul compact><li>The number of times the bulk buffer filled up, forcing the buffer content
46to be sent.</ul>
47<b>u_int32_t st_bulk_overflows;</b><ul compact><li>The number of times a record was bigger than the entire bulk buffer,
48and therefore had to be sent as a singleton.</ul>
49<b>u_int32_t st_bulk_records;</b><ul compact><li>The number of records added to a bulk buffer.</ul>
50<b>u_int32_t st_bulk_transfers;</b><ul compact><li>The number of bulk buffers transferred (via a call to the
51application's <b>send</b> function).</ul>
52<b>u_int32_t st_client_rerequests;</b><ul compact><li>The number of times this client site received a "re-request" message,
53indicating that a request it previously sent to another client could
54not be serviced by that client.  (Compare to
55<b>st_client_svc_miss</b>.)</ul>
56<b>u_int32_t st_client_svc_miss;</b><ul compact><li>The number of "request" type messages received by this client that
57could not be processed, forcing the originating requester to try sending
58the request to the master (or another client).</ul>
59<b>u_int32_t st_client_svc_req;</b><ul compact><li>The number of "request" type messages received by this client.
60("Request" messages are usually sent from a client to the master, but a
61message marked with the <a href="../api_c/rep_transport.html#DB_REP_ANYWHERE">DB_REP_ANYWHERE</a> flag in the invocation
62of the application's <b>send</b> function may be sent to another client
63instead.)</ul>
64<b>u_int32_t st_dupmasters;</b><ul compact><li>The number of duplicate master conditions originally detected at this site.</ul>
65<b>u_int32_t st_egen;</b><ul compact><li>The current election generation number.</ul>
66<b>u_int32_t st_election_cur_winner;</b><ul compact><li>The election winner.</ul>
67<b>u_int32_t st_election_gen;</b><ul compact><li>The election generation number.</ul>
68<b>DB_LSN st_election_lsn;</b><ul compact><li>The maximum LSN of election winner.</ul>
69<b>u_int32_t st_election_nsites;</b><ul compact><li>The number sites responding to this site during the last election.</ul>
70<b>u_int32_t st_election_nvotes;</b><ul compact><li>The number of votes required in the last election.</ul>
71<b>u_int32_t st_election_priority;</b><ul compact><li>The election priority.</ul>
72<b>u_int32_t st_election_sec;</b><ul compact><li>The number of seconds the last election took (the total election time
73is <b>st_election_sec</b> plus <b>st_election_usec</b>).</ul>
74<b>u_int32_t st_election_status;</b><ul compact><li>The current election phase (0 if no election is in progress).</ul>
75<b>u_int32_t st_election_tiebreaker;</b><ul compact><li>The election tiebreaker value.</ul>
76<b>u_int32_t st_election_usec;</b><ul compact><li>The number of microseconds the last election took (the total election
77time is <b>st_election_sec</b> plus <b>st_election_usec</b>).</ul>
78<b>u_int32_t st_election_votes;</b><ul compact><li>The number of votes received in the last election.</ul>
79<b>u_int32_t st_elections;</b><ul compact><li>The number of elections held.</ul>
80<b>u_int32_t st_elections_won;</b><ul compact><li>The number of elections won.</ul>
81<b>u_int32_t st_env_id;</b><ul compact><li>The current environment ID.</ul>
82<b>u_int32_t st_env_priority;</b><ul compact><li>The current environment priority.</ul>
83<b>u_int32_t st_gen;</b><ul compact><li>The current generation number.</ul>
84<b>u_int32_t st_log_duplicated;</b><ul compact><li>The number of duplicate log records received.</ul>
85<b>u_int32_t st_log_queued;</b><ul compact><li>The number of log records currently queued.</ul>
86<b>u_int32_t st_log_queued_max;</b><ul compact><li>The maximum number of log records ever queued at once.</ul>
87<b>u_int32_t st_log_queued_total;</b><ul compact><li>The total number of log records queued.</ul>
88<b>u_int32_t st_log_records;</b><ul compact><li>The number of log records received and appended to the log.</ul>
89<b>u_int32_t st_log_requested;</b><ul compact><li>The number of times log records were missed and requested.</ul>
90<b>u_int32_t st_master;</b><ul compact><li>The current master environment ID.</ul>
91<b>u_int32_t st_master_changes;</b><ul compact><li>The number of times the master has changed.</ul>
92<b>u_int32_t st_max_lease_sec;</b><ul compact><li>The number of seconds of the longest lease (the total lease time
93is <b>st_max_lease_sec</b> plus <b>st_max_lease_usec</b>).</ul>
94<b>u_int32_t st_max_lease_usec;</b><ul compact><li>The number of microseconds of the longest lease (the total lease
95time is <b>st_max_lease_sec</b> plus <b>st_max_lease_usec</b>).</ul>
96<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
97permanent log records.</ul>
98<b>u_int32_t st_msgs_badgen;</b><ul compact><li>The number of messages received with a bad generation number.</ul>
99<b>u_int32_t st_msgs_processed;</b><ul compact><li>The number of messages received and processed.</ul>
100<b>u_int32_t st_msgs_recover;</b><ul compact><li>The number of messages ignored due to pending recovery.</ul>
101<b>u_int32_t st_msgs_send_failures;</b><ul compact><li>The number of failed message sends.</ul>
102<b>u_int32_t st_msgs_sent;</b><ul compact><li>The number of messages sent.</ul>
103<b>u_int32_t st_newsites;</b><ul compact><li>The number of new site messages received.</ul>
104<b>DB_LSN st_next_lsn;</b><ul compact><li>In replication environments configured as masters, the next LSN expected.
105In replication environments configured as clients, the next LSN to be used.</ul>
106<b>u_int32_t st_next_pg;</b><ul compact><li>The next page number we expect to receive.</ul>
107<b>u_int32_t st_nsites;</b><ul compact><li>The number of sites used in the last election.</ul>
108<b>u_int32_t st_nthrottles;</b><ul compact><li>Transmission limited. This indicates the number of times that data
109transmission was stopped to limit the amount of data sent in response
110to a single call to <a href="../api_c/rep_message.html">DB_ENV-&gt;rep_process_message</a>.</ul>
111<b>u_int32_t st_outdated;</b><ul compact><li>The number of outdated conditions detected.</ul>
112<b>u_int32_t st_pg_duplicated;</b><ul compact><li>The number of duplicate pages received.</ul>
113<b>u_int32_t st_pg_records;</b><ul compact><li>The number of pages received and stored.</ul>
114<b>u_int32_t st_pg_requested;</b><ul compact><li>The number of pages missed and requested from the master.</ul>
115<b>u_int32_t st_startsync_delayed;</b><ul compact><li>The number of times the client had to delay the start of a
116cache flush operation (initiated by the master for an impending
117checkpoint) because it was missing some previous log record(s).</ul>
118<b>u_int32_t st_startup_complete;</b><ul compact><li>The client site has completed its startup procedures and is now
119handling live records from the master.</ul>
120<b>u_int32_t st_status;</b><ul compact><li>The current replication mode.  Set to <a href="../api_c/repmgr_start.html#DB_REP_MASTER">DB_REP_MASTER</a> if the
121environment is a replication master, <a href="../api_c/repmgr_start.html#DB_REP_CLIENT">DB_REP_CLIENT</a> if the
122environment is a replication client, or 0 if replication is not
123configured.</ul>
124<b>u_int32_t st_txns_applied;</b><ul compact><li>The number of transactions applied.</ul>
125<b>DB_LSN st_waiting_lsn;</b><ul compact><li>The LSN of the first log record we have after missing log records
126being waited for, or 0 if no log records are currently missing.</ul>
127<b>u_int32_t st_waiting_pg;</b><ul compact><li>The page number of the first page we have after missing pages
128being waited for, or 0 if no pages are currently missing.</ul>
129<br>
130<p>The DB_ENV-&gt;rep_stat method may not be called before the <a href="../api_c/env_open.html">DB_ENV-&gt;open</a> method is called.</p>
131<p>The DB_ENV-&gt;rep_stat method
132returns a non-zero error value on failure
133and 0 on success.
134</p>
135<b>Parameters</b> <br>
136 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or
137the following value:
138<br>
139<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after returning their values.</ul>
140<br></ul>
141 <b>statp</b><ul compact><li>The <b>statp</b> parameter references memory into which
142a pointer to the allocated statistics structure is copied.</ul> 
143<br>
144<br><b>Errors</b>
145<p>The DB_ENV-&gt;rep_stat method
146may fail and return one of the following non-zero errors:</p>
147<br>
148<b>EINVAL</b><ul compact><li>An
149invalid flag value or parameter was specified.</ul>
150<br>
151<hr size=1 noshade>
152<b>Description: DB_ENV-&gt;rep_stat_print</b>
153<p>The DB_ENV-&gt;rep_stat_print method displays the
154replication subsystem statistical information, as described for the DB_ENV-&gt;rep_stat method.
155The information is printed to a specified output channel (see the
156<a href="../api_c/env_set_msgfile.html">DB_ENV-&gt;set_msgfile</a> method for more information), or passed to an
157application callback function (see the <a href="../api_c/env_set_msgcall.html">DB_ENV-&gt;set_msgcall</a> method for
158more information).</p>
159<p>The DB_ENV-&gt;rep_stat_print method may not be called before the <a href="../api_c/env_open.html">DB_ENV-&gt;open</a> method is called.</p>
160<p>The DB_ENV-&gt;rep_stat_print method
161returns a non-zero error value on failure
162and 0 on success.
163</p>
164<b>Parameters</b> <br>
165 <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
166or more of the following values:
167<br>
168<b><a name="DB_STAT_ALL">DB_STAT_ALL</a></b><ul compact><li>Display all available information.</ul>
169<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after displaying their values.</ul>
170<br></ul>
171<br>
172<hr size=1 noshade>
173<br><b>Class</b>
174<a href="../api_c/env_class.html">DB_ENV</a>
175<br><b>See Also</b>
176<a href="../api_c/rep_list.html">Replication and Related Methods</a>
177</tt>
178<table width="100%"><tr><td><br></td><td align=right>
179<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
180</td></tr></table>
181<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
182</body>
183</html>
184