1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>DbEnv::rep_stat()</title> 7 <link rel="stylesheet" href="apiReference.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> 10 <link rel="up" href="rep.html" title="Chapter 11. Replication Methods" /> 11 <link rel="prev" href="repstart.html" title="DbEnv::rep_start()" /> 12 <link rel="next" href="repstat_print.html" title="DbEnv::rep_stat_print()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::rep_stat()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="repstart.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 11. 23 Replication Methods 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="repstat_print.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="repstat"></a>DbEnv::rep_stat()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::rep_stat(DB_REP_STAT **statp, u_int32_t flags); </pre> 42 <p> 43 The <code class="methodname">DbEnv::rep_stat()</code> method returns the replication subsystem 44 statistics. 45 </p> 46 <p> 47 The <code class="methodname">DbEnv::rep_stat()</code> method creates a statistical structure of type 48 <code class="literal">DB_REP_STAT</code> and copies a pointer to it into a user-specified memory 49 location. 50 </p> 51 <p> 52 Statistical structures are stored in allocated memory. If application-specific allocation 53 routines have been declared (see <a class="xref" href="envset_alloc.html" title="DbEnv::set_alloc()">DbEnv::set_alloc()</a> 54 for more information), they are used to allocate the memory; otherwise, the standard 55 C library <span class="bold"><strong>malloc</strong></span>(3) is used. The caller is responsible 56 for deallocating the memory. To deallocate the memory, free the memory reference; 57 references inside the returned memory need not be individually freed. 58 </p> 59 <p> 60 The following <code class="literal">DB_REP_STAT</code> fields will be filled in: 61 </p> 62 <div class="itemizedlist"> 63 <ul type="disc"> 64 <li> 65 <p> 66 <span class="bold"><strong>uintmax_t st_bulk_fills;</strong></span> 67 </p> 68 <p> 69 The number of times the bulk buffer filled up, forcing the buffer 70 content to be sent. 71 </p> 72 </li> 73 <li> 74 <p> 75 <span class="bold"><strong>uintmax_t st_bulk_overflows;</strong></span> 76 </p> 77 <p> 78 The number of times a record was bigger than the entire bulk buffer, 79 and therefore had to be sent as a singleton. 80 </p> 81 </li> 82 <li> 83 <p> 84 <span class="bold"><strong>uintmax_t st_bulk_records;</strong></span> 85 </p> 86 <p> 87 The number of records added to a bulk buffer. 88 </p> 89 </li> 90 <li> 91 <p> 92 <span class="bold"><strong>uintmax_t st_bulk_transfers;</strong></span> 93 </p> 94 <p> 95 The number of bulk buffers transferred (via a call to the 96 application's <span class="bold"><strong>send</strong></span> function). 97 </p> 98 </li> 99 <li> 100 <p> 101 <span class="bold"><strong>uintmax_t st_client_rerequests;</strong></span> 102 </p> 103 <p> 104 The number of times this client site received a "re-request" message, 105 indicating that a request it previously sent to another client could 106 not be serviced by that client. (Compare to <span class="bold"><strong>st_client_svc_miss</strong></span>.) 107 </p> 108 </li> 109 <li> 110 <p> 111 <span class="bold"><strong>uintmax_t st_client_svc_miss;</strong></span> 112 </p> 113 <p> 114 The number of "request" type messages received by this client that 115 could not be processed, forcing the originating requester to try 116 sending the request to the master (or another client). 117 </p> 118 </li> 119 <li> 120 <p> 121 <span class="bold"><strong>uintmax_t st_client_svc_req;</strong></span> 122 </p> 123 <p> 124 The number of "request" type messages received by this client. 125 ("Request" messages are usually sent from a client to the master, but 126 a message marked with the 127 <a class="link" href="reptransport.html#transport_DB_REP_ANYWHERE">DB_REP_ANYWHERE</a> 128 flag in the invocation of the application's <span class="bold"><strong>send</strong></span> function may be sent to another client 129 instead.) 130 </p> 131 </li> 132 <li> 133 <p> 134 <span class="bold"><strong>u_int32_t st_dupmasters;</strong></span> 135 </p> 136 <p> 137 The number of duplicate master conditions originally detected at this 138 site. 139 </p> 140 </li> 141 <li> 142 <p> 143 <span class="bold"><strong>u_int32_t st_egen;</strong></span> 144 </p> 145 <p> 146 The election generation number for the current or next election. 147 </p> 148 </li> 149 <li> 150 <p> 151 <span class="bold"><strong>int st_election_cur_winner;</strong></span> 152 </p> 153 <p> 154 The environment ID of the winner of the current or last election. 155 </p> 156 </li> 157 <li> 158 <p> 159 <span class="bold"><strong>u_int32_t st_election_gen;</strong></span> 160 </p> 161 <p> 162 The master generation number of the winner of the current or last election. 163 </p> 164 </li> 165 <li> 166 <p> 167 <span class="bold"><strong>DB_LSN st_election_lsn;</strong></span> 168 </p> 169 <p> 170 The maximum LSN of the winner of the current or last election. 171 </p> 172 </li> 173 <li> 174 <p> 175 <span class="bold"><strong>u_int32_t st_election_nsites;</strong></span> 176 </p> 177 <p> 178 The number of sites responding to this site during the current election. 179 </p> 180 </li> 181 <li> 182 <p> 183 <span class="bold"><strong>u_int32_t st_election_nvotes;</strong></span> 184 </p> 185 <p> 186 The number of votes required in the current or last election. 187 </p> 188 </li> 189 <li> 190 <p> 191 <span class="bold"><strong>u_int32_t st_election_priority;</strong></span> 192 </p> 193 <p> 194 The priority of the winner of the current or last election. 195 </p> 196 </li> 197 <li> 198 <p> 199 <span class="bold"><strong>u_int32_t st_election_sec;</strong></span> 200 </p> 201 <p> 202 The number of seconds the last election took (the total election time 203 is <span class="bold"><strong>st_election_sec</strong></span> plus <span class="bold"><strong>st_election_usec</strong></span>). 204 </p> 205 </li> 206 <li> 207 <p> 208 <span class="bold"><strong>int st_election_status;</strong></span> 209 </p> 210 <p> 211 The current election phase (0 if no election is in progress). 212 </p> 213 </li> 214 <li> 215 <p> 216 <span class="bold"><strong>u_int32_t st_election_tiebreaker;</strong></span> 217 </p> 218 <p> 219 The tiebreaker value of the winner of the current or last election. 220 </p> 221 </li> 222 <li> 223 <p> 224 <span class="bold"><strong>u_int32_t st_election_usec;</strong></span> 225 </p> 226 <p> 227 The number of microseconds the last election took (the total election 228 time is <span class="bold"><strong>st_election_sec</strong></span> plus 229 <span class="bold"><strong>st_election_usec</strong></span>). 230 </p> 231 </li> 232 <li> 233 <p> 234 <span class="bold"><strong>u_int32_t st_election_votes;</strong></span> 235 </p> 236 <p> 237 The number of votes received during the current election. 238 </p> 239 </li> 240 <li> 241 <p> 242 <span class="bold"><strong>uintmax_t st_elections;</strong></span> 243 </p> 244 <p> 245 The number of elections held. 246 </p> 247 </li> 248 <li> 249 <p> 250 <span class="bold"><strong>uintmax_t st_elections_won;</strong></span> 251 </p> 252 <p> 253 The number of elections won. 254 </p> 255 </li> 256 <li> 257 <p> 258 <span class="bold"><strong>int st_env_id;</strong></span> 259 </p> 260 <p> 261 The current environment ID. 262 </p> 263 </li> 264 <li> 265 <p> 266 <span class="bold"><strong>u_int32_t st_env_priority;</strong></span> 267 </p> 268 <p> 269 The current environment priority. 270 </p> 271 </li> 272 <li> 273 <p> 274 <span class="bold"><strong>u_int32_t st_gen;</strong></span> 275 </p> 276 <p> 277 The current master generation number. 278 </p> 279 </li> 280 <li> 281 <p> 282 <span class="bold"><strong>uintmax_t st_log_duplicated;</strong></span> 283 </p> 284 <p> 285 The number of duplicate log records received. 286 </p> 287 </li> 288 <li> 289 <p> 290 <span class="bold"><strong>uintmax_t st_log_queued;</strong></span> 291 </p> 292 <p> 293 The number of log records currently queued. 294 </p> 295 </li> 296 <li> 297 <p> 298 <span class="bold"><strong>uintmax_t st_log_queued_max;</strong></span> 299 </p> 300 <p> 301 The maximum number of log records ever queued at once. 302 </p> 303 </li> 304 <li> 305 <p> 306 <span class="bold"><strong>uintmax_t st_log_queued_total;</strong></span> 307 </p> 308 <p> 309 The total number of log records queued. 310 </p> 311 </li> 312 <li> 313 <p> 314 <span class="bold"><strong>uintmax_t st_log_records;</strong></span> 315 </p> 316 <p> 317 The number of log records received and appended to the log. 318 </p> 319 </li> 320 <li> 321 <p> 322 <span class="bold"><strong>uintmax_t st_log_requested;</strong></span> 323 </p> 324 <p> 325 The number of times log records were missed and requested. 326 </p> 327 </li> 328 <li> 329 <p> 330 <span class="bold"><strong>int st_master;</strong></span> 331 </p> 332 <p> 333 The current master environment ID. 334 </p> 335 </li> 336 <li> 337 <p> 338 <span class="bold"><strong>uintmax_t st_master_changes;</strong></span> 339 </p> 340 <p> 341 The number of times the master has changed. 342 </p> 343 </li> 344 <li> 345 <p> 346 <span class="bold"><strong>u_int32_t st_max_lease_sec;</strong></span> 347 </p> 348 <p> 349 The number of seconds of the longest lease (the total lease time is 350 <span class="bold"><strong>st_max_lease_sec</strong></span> plus <span class="bold"><strong>st_max_lease_usec</strong></span>). 351 </p> 352 </li> 353 <li> 354 <p> 355 <span class="bold"><strong>u_int32_t st_max_lease_usec;</strong></span> 356 </p> 357 <p> 358 The number of microseconds of the longest lease (the total lease time 359 is <span class="bold"><strong>st_max_lease_sec</strong></span> plus <span class="bold"><strong>st_max_lease_usec</strong></span>). 360 </p> 361 </li> 362 <li> 363 <p> 364 <span class="bold"><strong>DB_LSN st_max_perm_lsn;</strong></span> 365 </p> 366 <p> 367 The LSN of the maximum permanent log record, or 0 if there are no 368 permanent log records. 369 </p> 370 </li> 371 <li> 372 <p> 373 <span class="bold"><strong>uintmax_t st_msgs_badgen;</strong></span> 374 </p> 375 <p> 376 The number of messages received with a bad generation number. 377 </p> 378 </li> 379 <li> 380 <p> 381 <span class="bold"><strong>uintmax_t st_msgs_processed;</strong></span> 382 </p> 383 <p> 384 The number of messages received and processed. 385 </p> 386 </li> 387 <li> 388 <p> 389 <span class="bold"><strong>uintmax_t st_msgs_recover;</strong></span> 390 </p> 391 <p> 392 The number of messages ignored due to pending recovery. 393 </p> 394 </li> 395 <li> 396 <p> 397 <span class="bold"><strong>uintmax_t st_msgs_send_failures;</strong></span> 398 </p> 399 <p> 400 The number of failed message sends. 401 </p> 402 </li> 403 <li> 404 <p> 405 <span class="bold"><strong>uintmax_t st_msgs_sent;</strong></span> 406 </p> 407 <p> 408 The number of messages sent. 409 </p> 410 </li> 411 <li> 412 <p> 413 <span class="bold"><strong>uintmax_t st_newsites;</strong></span> 414 </p> 415 <p> 416 The number of new site messages received. 417 </p> 418 </li> 419 <li> 420 <p> 421 <span class="bold"><strong>DB_LSN st_next_lsn;</strong></span> 422 </p> 423 <p> 424 In replication environments configured as masters, the next LSN 425 to be used. In replication environments configured as clients, the next 426 LSN expected. 427 </p> 428 </li> 429 <li> 430 <p> 431 <span class="bold"><strong>u_int32_t st_next_pg;</strong></span> 432 </p> 433 <p> 434 The next page number we expect to receive. 435 </p> 436 </li> 437 <li> 438 <p> 439 <span class="bold"><strong>u_int32_t st_nsites;</strong></span> 440 </p> 441 <p> 442 The number of sites used in the last election. 443 </p> 444 </li> 445 <li> 446 <p> 447 <span class="bold"><strong>uintmax_t st_nthrottles;</strong></span> 448 </p> 449 <p> 450 Transmission limited. This indicates the number of times that data 451 transmission was stopped to limit the amount of data sent in response 452 to a single call to <a class="xref" href="repmessage.html" title="DbEnv::rep_process_message()">DbEnv::rep_process_message()</a>. 453 </p> 454 </li> 455 <li> 456 <p> 457 <span class="bold"><strong>uintmax_t st_outdated;</strong></span> 458 </p> 459 <p> 460 The number of outdated conditions detected. 461 </p> 462 </li> 463 <li> 464 <p> 465 <span class="bold"><strong>uintmax_t st_pg_duplicated;</strong></span> 466 </p> 467 <p> 468 The number of duplicate pages received. 469 </p> 470 </li> 471 <li> 472 <p> 473 <span class="bold"><strong>uintmax_t st_pg_records;</strong></span> 474 </p> 475 <p> 476 The number of pages received and stored. 477 </p> 478 </li> 479 <li> 480 <p> 481 <span class="bold"><strong>uintmax_t st_pg_requested;</strong></span> 482 </p> 483 <p> 484 The number of pages missed and requested from the master. 485 </p> 486 </li> 487 <li> 488 <p> 489 <span class="bold"><strong>uintmax_t st_startsync_delayed;</strong></span> 490 </p> 491 <p> 492 The number of times the client had to delay the start of a cache flush 493 operation (initiated by the master for an impending checkpoint) 494 because it was missing some previous log record(s). 495 </p> 496 </li> 497 <li> 498 <p> 499 <span class="bold"><strong>u_int32_t st_startup_complete;</strong></span> 500 </p> 501 <p> 502 The client site has completed its startup procedures and is now 503 handling live records from the master. 504 </p> 505 </li> 506 <li> 507 <p> 508 <span class="bold"><strong>u_int32_t st_status;</strong></span> 509 </p> 510 <p> 511 The current replication mode. Set to 512 <a class="link" href="repmgrstart.html#repmgrstart_DB_REP_MASTER">DB_REP_MASTER</a> 513 if the environment is a replication master, 514 <a class="link" href="repmgrstart.html#repmgrstart_DB_REP_CLIENT">DB_REP_CLIENT</a> 515 if the environment is a replication client, or 0 if replication is not 516 configured. 517 </p> 518 </li> 519 <li> 520 <p> 521 <span class="bold"><strong>uintmax_t st_txns_applied;</strong></span> 522 </p> 523 <p> 524 The number of transactions applied. 525 </p> 526 </li> 527 <li> 528 <p> 529 <span class="bold"><strong>DB_LSN st_waiting_lsn;</strong></span> 530 </p> 531 <p> 532 The LSN of the first log record we have after missing log records 533 being waited for, or 0 if no log records are currently missing. 534 </p> 535 </li> 536 <li> 537 <p> 538 <span class="bold"><strong>u_int32_t st_waiting_pg;</strong></span> 539 </p> 540 <p> 541 The page number of the first page we have after missing pages being 542 waited for, or 0 if no pages are currently missing. 543 </p> 544 </li> 545 </ul> 546 </div> 547 <p> 548 The <code class="methodname">DbEnv::rep_stat()</code> method may not be called before the 549 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is called. 550 </p> 551 <p> 552 The <code class="methodname">DbEnv::rep_stat()</code> <span> 553 554 <span> 555 method either returns a non-zero error value or throws an 556 exception that encapsulates a non-zero error value on 557 failure, and returns 0 on success. 558 </span> 559 </span> 560 </p> 561 <div class="sect2" lang="en" xml:lang="en"> 562 <div class="titlepage"> 563 <div> 564 <div> 565 <h3 class="title"><a id="id1705537"></a>Parameters</h3> 566 </div> 567 </div> 568 </div> 569 <div class="sect3" lang="en" xml:lang="en"> 570 <div class="titlepage"> 571 <div> 572 <div> 573 <h4 class="title"><a id="id1705411"></a>flags</h4> 574 </div> 575 </div> 576 </div> 577 <p> 578 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 579 or the following value: 580 </p> 581 <div class="itemizedlist"> 582 <ul type="disc"> 583 <li> 584 <p> 585 <code class="literal">DB_STAT_CLEAR</code> 586 </p> 587 <p> 588 Reset statistics after returning their values. 589 </p> 590 </li> 591 </ul> 592 </div> 593 </div> 594 <div class="sect3" lang="en" xml:lang="en"> 595 <div class="titlepage"> 596 <div> 597 <div> 598 <h4 class="title"><a id="id1706745"></a>statp</h4> 599 </div> 600 </div> 601 </div> 602 <p> 603 The <span class="bold"><strong>statp</strong></span> parameter references memory 604 into which a pointer to the allocated statistics structure is copied. 605 </p> 606 </div> 607 </div> 608 <div class="sect2" lang="en" xml:lang="en"> 609 <div class="titlepage"> 610 <div> 611 <div> 612 <h3 class="title"><a id="id1706599"></a>Errors</h3> 613 </div> 614 </div> 615 </div> 616 <p> 617 The <code class="methodname">DbEnv::rep_stat()</code> <span> 618 619 <span> 620 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 621 exception, encapsulating one of the following non-zero errors, or return one 622 of the following non-zero errors: 623 </span> 624 </span> 625 </p> 626 <div class="sect3" lang="en" xml:lang="en"> 627 <div class="titlepage"> 628 <div> 629 <div> 630 <h4 class="title"><a id="id1705312"></a>EINVAL</h4> 631 </div> 632 </div> 633 </div> 634 <p> 635 If the database environment was not already opened; or if an invalid 636 flag value or parameter was specified. 637 </p> 638 </div> 639 </div> 640 <div class="sect2" lang="en" xml:lang="en"> 641 <div class="titlepage"> 642 <div> 643 <div> 644 <h3 class="title"><a id="id1706356"></a>Class</h3> 645 </div> 646 </div> 647 </div> 648 <p> 649 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> 650 </p> 651 </div> 652 <div class="sect2" lang="en" xml:lang="en"> 653 <div class="titlepage"> 654 <div> 655 <div> 656 <h3 class="title"><a id="id1706380"></a>See Also</h3> 657 </div> 658 </div> 659 </div> 660 <p> 661 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 662 </p> 663 </div> 664 </div> 665 <div class="navfooter"> 666 <hr /> 667 <table width="100%" summary="Navigation footer"> 668 <tr> 669 <td width="40%" align="left"><a accesskey="p" href="repstart.html">Prev</a> </td> 670 <td width="20%" align="center"> 671 <a accesskey="u" href="rep.html">Up</a> 672 </td> 673 <td width="40%" align="right"> <a accesskey="n" href="repstat_print.html">Next</a></td> 674 </tr> 675 <tr> 676 <td width="40%" align="left" valign="top">DbEnv::rep_start() </td> 677 <td width="20%" align="center"> 678 <a accesskey="h" href="index.html">Home</a> 679 </td> 680 <td width="40%" align="right" valign="top"> DbEnv::rep_stat_print()</td> 681 </tr> 682 </table> 683 </div> 684 </body> 685</html> 686