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: DbEnv::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>DbEnv::rep_stat</b> 14</td> 15<td align=right> 16<a href="../api_cxx/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 <db_cxx.h> 23<p> 24int 25DbEnv::rep_stat(DB_REP_STAT **statp, u_int32_t flags); 26<p> 27int 28DbEnv::rep_stat_print(u_int32_t flags); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DbEnv::rep_stat</b> 32<p>The DbEnv::rep_stat method returns the replication subsystem statistics.</p> 33<p>The DbEnv::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_cxx/env_set_alloc.html">DbEnv::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_cxx/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_cxx/rep_message.html">DbEnv::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_cxx/repmgr_start.html#DB_REP_MASTER">DB_REP_MASTER</a> if the 121environment is a replication master, <a href="../api_cxx/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 DbEnv::rep_stat method may not be called before the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is called.</p> 131<p>The DbEnv::rep_stat method 132either returns a non-zero error value 133or throws an exception that encapsulates a non-zero error value on 134failure, and returns 0 on success. 135</p> 136<b>Parameters</b> <br> 137 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or 138the following value: 139<br> 140<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after returning their values.</ul> 141<br></ul> 142 <b>statp</b><ul compact><li>The <b>statp</b> parameter references memory into which 143a pointer to the allocated statistics structure is copied.</ul> 144<br> 145<br><b>Errors</b> 146<p>The DbEnv::rep_stat method 147may fail and throw 148<a href="../api_cxx/except_class.html">DbException</a>, 149encapsulating one of the following non-zero errors, or return one of 150the following non-zero errors:</p> 151<br> 152<b>EINVAL</b><ul compact><li>An 153invalid flag value or parameter was specified.</ul> 154<br> 155<hr size=1 noshade> 156<b>Description: DbEnv::rep_stat_print</b> 157<p>The DbEnv::rep_stat_print method displays the 158replication subsystem statistical information, as described for the DbEnv::rep_stat method. 159The information is printed to a specified output channel (see the 160<a href="../api_cxx/env_set_msgfile.html">DbEnv::set_msgfile</a> method for more information), or passed to an 161application callback function (see the <a href="../api_cxx/env_set_msgcall.html">DbEnv::set_msgcall</a> method for 162more information).</p> 163<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> 164<p>The DbEnv::rep_stat_print method 165either returns a non-zero error value 166or throws an exception that encapsulates a non-zero error value on 167failure, and returns 0 on success. 168</p> 169<b>Parameters</b> <br> 170 <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 171or more of the following values: 172<br> 173<b><a name="DB_STAT_ALL">DB_STAT_ALL</a></b><ul compact><li>Display all available information.</ul> 174<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after displaying their values.</ul> 175<br></ul> 176<br> 177<hr size=1 noshade> 178<br><b>Class</b> 179<a href="../api_cxx/env_class.html">DbEnv</a> 180<br><b>See Also</b> 181<a href="../api_cxx/rep_list.html">Replication and Related Methods</a> 182</tt> 183<table width="100%"><tr><td><br></td><td align=right> 184<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> 185</td></tr></table> 186<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 187</body> 188</html> 189