1/*- 2 * Automatically built by dist/s_java_stat. 3 * Only the javadoc comments can be edited. 4 * 5 * See the file LICENSE for redistribution information. 6 * 7 * Copyright (c) 2002,2008 Oracle. All rights reserved. 8 */ 9 10package com.sleepycat.db; 11 12import com.sleepycat.db.internal.DbConstants; 13 14/** 15Replication statistics for a database environment. 16*/ 17public class ReplicationStats { 18 // no public constructor 19 /* package */ ReplicationStats() {} 20 /** 21 The environment is configured as a replication client, as reported by {@link #getStatus}. 22 */ 23 public static final int REP_CLIENT = DbConstants.DB_REP_CLIENT; 24 25 /** 26 The environment is configured as a replication master, as reported by {@link #getStatus}. 27 */ 28 public static final int REP_MASTER = DbConstants.DB_REP_MASTER; 29 30 /** 31 Replication is not configured for this environment, as reported by {@link #getStatus}. 32 */ 33 public static final int REP_NONE = 0; 34 35 private int st_log_queued; 36 /** 37 The number of log records currently queued. 38 */ 39 public int getLogQueued() { 40 return st_log_queued; 41 } 42 43 private int st_startup_complete; 44 /** 45 The client site has completed its startup procedures and is now 46 handling live records from the master. 47 */ 48 public boolean getStartupComplete() { 49 return (st_startup_complete != 0); 50 } 51 52 private int st_status; 53 /** 54 The current replication mode. Set to REP_MASTER if the environment 55 is a replication master, REP_CLIENT if the environment is a 56 replication client, or REP_NONE if replication is not configured. 57 */ 58 public int getStatus() { 59 return st_status; 60 } 61 62 private LogSequenceNumber st_next_lsn; 63 /** 64 In replication environments configured as masters, the next LSN 65 expected. In replication environments configured as clients, the next 66 LSN to be used. 67 */ 68 public LogSequenceNumber getNextLsn() { 69 return st_next_lsn; 70 } 71 72 private LogSequenceNumber st_waiting_lsn; 73 /** 74 The LSN of the first log record we have after missing log records 75 being waited for, or 0 if no log records are currently missing. 76 */ 77 public LogSequenceNumber getWaitingLsn() { 78 return st_waiting_lsn; 79 } 80 81 private LogSequenceNumber st_max_perm_lsn; 82 /** 83 The LSN of the maximum permanent log record, or 0 if there are no 84 permanent log records. 85 */ 86 public LogSequenceNumber getMaxPermLsn() { 87 return st_max_perm_lsn; 88 } 89 90 private int st_next_pg; 91 /** 92 The next page number we expect to receive. 93 */ 94 public int getNextPages() { 95 return st_next_pg; 96 } 97 98 private int st_waiting_pg; 99 /** 100 The page number of the first page we have after missing pages being 101 waited for, or 0 if no pages are currently missing. 102 */ 103 public int getWaitingPages() { 104 return st_waiting_pg; 105 } 106 107 private int st_dupmasters; 108 /** 109 The number of duplicate master conditions detected. 110 */ 111 public int getDupmasters() { 112 return st_dupmasters; 113 } 114 115 private int st_env_id; 116 /** 117 The current environment ID. 118 */ 119 public int getEnvId() { 120 return st_env_id; 121 } 122 123 private int st_env_priority; 124 /** 125 The current environment priority. 126 */ 127 public int getEnvPriority() { 128 return st_env_priority; 129 } 130 131 private int st_bulk_fills; 132 /** 133 The number of times the bulk buffer filled up, forcing the buffer content 134 to be sent. 135 **/ 136 public int getBulkFills() { 137 return st_bulk_fills; 138 } 139 140 private int st_bulk_overflows; 141 /** 142 The number of times a record was bigger than the entire bulk buffer, 143 and therefore had to be sent as a singleton. 144 **/ 145 public int getBulkOverflows() { 146 return st_bulk_overflows; 147 } 148 149 private int st_bulk_records; 150 /** The number of records added to a bulk buffer.**/ 151 public int getBulkRecords() { 152 return st_bulk_records; 153 } 154 155 private int st_bulk_transfers; 156 /** 157 The number of bulk buffers transferred (via a call to the 158 application's {@link ReplicationTransport#send} method). 159 **/ 160 public int getBulkTransfers() { 161 return st_bulk_transfers; 162 } 163 164 private int st_client_rerequests; 165 /** 166 The number of times this client site received a "re-request" message, 167 indicating that a request it previously sent to another client could 168 not be serviced by that client. (Compare to {@link #getClientSvcMiss}.) 169 **/ 170 public int getClientRerequests() { 171 return st_client_rerequests; 172 } 173 174 private int st_client_svc_req; 175 /** 176 The number of "request" type messages received by this client. 177 ("Request" messages are usually sent from a client to the master, but 178 a message marked with <code>anywhere = true</code> in the 179 invocation of the application's {@link ReplicationTransport#send} 180 method may be sent to another client instead.) 181 **/ 182 public int getClientSvcReq() { 183 return st_client_svc_req; 184 } 185 186 private int st_client_svc_miss; 187 /** 188 The number of "request" type messages received by this client that 189 could not be processed, forcing the originating requestor to try 190 sending the request to the master (or another client). 191 **/ 192 public int getClientSvcMiss() { 193 return st_client_svc_miss; 194 } 195 196 private int st_gen; 197 /** 198 The current generation number. 199 */ 200 public int getGen() { 201 return st_gen; 202 } 203 204 private int st_egen; 205 /** 206 The current election generation number. 207 */ 208 public int getEgen() { 209 return st_egen; 210 } 211 212 private int st_log_duplicated; 213 /** 214 The number of duplicate log records received. 215 */ 216 public int getLogDuplicated() { 217 return st_log_duplicated; 218 } 219 220 private int st_log_queued_max; 221 /** 222 The maximum number of log records ever queued at once. 223 */ 224 public int getLogQueuedMax() { 225 return st_log_queued_max; 226 } 227 228 private int st_log_queued_total; 229 /** 230 The total number of log records queued. 231 */ 232 public int getLogQueuedTotal() { 233 return st_log_queued_total; 234 } 235 236 private int st_log_records; 237 /** 238 The number of log records received and appended to the log. 239 */ 240 public int getLogRecords() { 241 return st_log_records; 242 } 243 244 private int st_log_requested; 245 /** 246 The number of log records missed and requested. 247 */ 248 public int getLogRequested() { 249 return st_log_requested; 250 } 251 252 private int st_master; 253 /** 254 The current master environment ID. 255 */ 256 public int getMaster() { 257 return st_master; 258 } 259 260 private int st_master_changes; 261 /** 262 The number of times the master has changed. 263 */ 264 public int getMasterChanges() { 265 return st_master_changes; 266 } 267 268 private int st_msgs_badgen; 269 /** 270 The number of messages received with a bad generation number. 271 */ 272 public int getMsgsBadgen() { 273 return st_msgs_badgen; 274 } 275 276 private int st_msgs_processed; 277 /** 278 The number of messages received and processed. 279 */ 280 public int getMsgsProcessed() { 281 return st_msgs_processed; 282 } 283 284 private int st_msgs_recover; 285 /** 286 The number of messages ignored due to pending recovery. 287 */ 288 public int getMsgsRecover() { 289 return st_msgs_recover; 290 } 291 292 private int st_msgs_send_failures; 293 /** 294 The number of failed message sends. 295 */ 296 public int getMsgsSendFailures() { 297 return st_msgs_send_failures; 298 } 299 300 private int st_msgs_sent; 301 /** 302 The number of messages sent. 303 */ 304 public int getMsgsSent() { 305 return st_msgs_sent; 306 } 307 308 private int st_newsites; 309 /** 310 The number of new site messages received. 311 */ 312 public int getNewsites() { 313 return st_newsites; 314 } 315 316 private int st_nsites; 317 /** 318 The number of sites believed to be in the replication group. 319 */ 320 public int getNumSites() { 321 return st_nsites; 322 } 323 324 private int st_nthrottles; 325 /** 326 Transmission limited. This indicates the number of times data 327 transmission was stopped to limit the amount of data sent in response to 328 a single call to {@link com.sleepycat.db.Environment#processReplicationMessage Environment.processReplicationMessage}. 329 */ 330 public int getNumThrottles() { 331 return st_nthrottles; 332 } 333 334 private int st_outdated; 335 /** 336 The number of outdated conditions detected. 337 */ 338 public int getOutdated() { 339 return st_outdated; 340 } 341 342 private int st_pg_duplicated; 343 /** 344 The number of duplicate pages received. 345 */ 346 public int getPagesDuplicated() { 347 return st_pg_duplicated; 348 } 349 350 private int st_pg_records; 351 /** 352 The number of pages received and stored. 353 */ 354 public int getPagesRecords() { 355 return st_pg_records; 356 } 357 358 private int st_pg_requested; 359 /** 360 The number of pages missed and requested from the master. 361 */ 362 public int getPagesRequested() { 363 return st_pg_requested; 364 } 365 366 private int st_txns_applied; 367 /** 368 The number of transactions applied. 369 */ 370 public int getTxnsApplied() { 371 return st_txns_applied; 372 } 373 374 private int st_startsync_delayed; 375 /** 376 The number of times the client had to delay the start of a cache flush 377 operation (initiated by the master for an impending checkpoint) because it 378 was missing some previous log record(s). 379 */ 380 public int getStartSyncDelayed() { 381 return st_startsync_delayed; 382 } 383 384 private int st_elections; 385 /** 386 The number of elections held. 387 */ 388 public int getElections() { 389 return st_elections; 390 } 391 392 private int st_elections_won; 393 /** 394 The number of elections won. 395 */ 396 public int getElectionsWon() { 397 return st_elections_won; 398 } 399 400 private int st_election_cur_winner; 401 /** 402 The election winner. 403 */ 404 public int getElectionCurWinner() { 405 return st_election_cur_winner; 406 } 407 408 private int st_election_gen; 409 /** 410 The election generation number. 411 */ 412 public int getElectionGen() { 413 return st_election_gen; 414 } 415 416 private LogSequenceNumber st_election_lsn; 417 /** 418 The maximum LSN of election winner. 419 */ 420 public LogSequenceNumber getElectionLsn() { 421 return st_election_lsn; 422 } 423 424 private int st_election_nsites; 425 /** 426 The number sites expected to participate in elections. 427 */ 428 public int getElectionNumSites() { 429 return st_election_nsites; 430 } 431 432 private int st_election_nvotes; 433 /** 434 The number of votes required to complete the election. 435 */ 436 public int getElectionNumVotes() { 437 return st_election_nvotes; 438 } 439 440 private int st_election_priority; 441 /** 442 The election priority. 443 */ 444 public int getElectionPriority() { 445 return st_election_priority; 446 } 447 448 private int st_election_status; 449 /** 450 The current election phase (0 if no election is in progress). 451 */ 452 public int getElectionStatus() { 453 return st_election_status; 454 } 455 456 private int st_election_tiebreaker; 457 /** 458 The election tiebreaker value. 459 */ 460 public int getElectionTiebreaker() { 461 return st_election_tiebreaker; 462 } 463 464 private int st_election_votes; 465 /** 466 The votes received this election round. 467 */ 468 public int getElectionVotes() { 469 return st_election_votes; 470 } 471 472 private int st_election_sec; 473 /** 474 The number of seconds the last election took (the total election 475 time is this plus {@link #getElectionUsec}). 476 **/ 477 public int getElectionSec() { 478 return st_election_sec; 479 } 480 481 private int st_election_usec; 482 /** 483 The number of microseconds the last election took (the total election 484 time is this plus {@link #getElectionSec}). 485 **/ 486 public int getElectionUsec() { 487 return st_election_usec; 488 } 489 490 private int st_max_lease_sec; 491 /** 492 The number of seconds of the longest lease (the total lease time 493 is this plus {@link #getMaxLeaseUsec}). 494 */ 495 public int getMaxLeaseSec() { 496 return st_max_lease_sec; 497 } 498 499 private int st_max_lease_usec; 500 /** 501 The number of microseconds of the longest lease (the total lease 502 time is this plus {@link #getMaxLeaseSec}). 503 */ 504 public int getMaxLeaseUsec() { 505 return st_max_lease_usec; 506 } 507 508 /** 509 For convenience, the ReplicationStats class has a toString method 510 that lists all the data fields. 511 */ 512 public String toString() { 513 return "ReplicationStats:" 514 + "\n st_log_queued=" + st_log_queued 515 + "\n st_startup_complete=" + (st_startup_complete != 0) 516 + "\n st_status=" + st_status 517 + "\n st_next_lsn=" + st_next_lsn 518 + "\n st_waiting_lsn=" + st_waiting_lsn 519 + "\n st_max_perm_lsn=" + st_max_perm_lsn 520 + "\n st_next_pg=" + st_next_pg 521 + "\n st_waiting_pg=" + st_waiting_pg 522 + "\n st_dupmasters=" + st_dupmasters 523 + "\n st_env_id=" + st_env_id 524 + "\n st_env_priority=" + st_env_priority 525 + "\n st_bulk_fills=" + st_bulk_fills 526 + "\n st_bulk_overflows=" + st_bulk_overflows 527 + "\n st_bulk_records=" + st_bulk_records 528 + "\n st_bulk_transfers=" + st_bulk_transfers 529 + "\n st_client_rerequests=" + st_client_rerequests 530 + "\n st_client_svc_req=" + st_client_svc_req 531 + "\n st_client_svc_miss=" + st_client_svc_miss 532 + "\n st_gen=" + st_gen 533 + "\n st_egen=" + st_egen 534 + "\n st_log_duplicated=" + st_log_duplicated 535 + "\n st_log_queued_max=" + st_log_queued_max 536 + "\n st_log_queued_total=" + st_log_queued_total 537 + "\n st_log_records=" + st_log_records 538 + "\n st_log_requested=" + st_log_requested 539 + "\n st_master=" + st_master 540 + "\n st_master_changes=" + st_master_changes 541 + "\n st_msgs_badgen=" + st_msgs_badgen 542 + "\n st_msgs_processed=" + st_msgs_processed 543 + "\n st_msgs_recover=" + st_msgs_recover 544 + "\n st_msgs_send_failures=" + st_msgs_send_failures 545 + "\n st_msgs_sent=" + st_msgs_sent 546 + "\n st_newsites=" + st_newsites 547 + "\n st_nsites=" + st_nsites 548 + "\n st_nthrottles=" + st_nthrottles 549 + "\n st_outdated=" + st_outdated 550 + "\n st_pg_duplicated=" + st_pg_duplicated 551 + "\n st_pg_records=" + st_pg_records 552 + "\n st_pg_requested=" + st_pg_requested 553 + "\n st_txns_applied=" + st_txns_applied 554 + "\n st_startsync_delayed=" + st_startsync_delayed 555 + "\n st_elections=" + st_elections 556 + "\n st_elections_won=" + st_elections_won 557 + "\n st_election_cur_winner=" + st_election_cur_winner 558 + "\n st_election_gen=" + st_election_gen 559 + "\n st_election_lsn=" + st_election_lsn 560 + "\n st_election_nsites=" + st_election_nsites 561 + "\n st_election_nvotes=" + st_election_nvotes 562 + "\n st_election_priority=" + st_election_priority 563 + "\n st_election_status=" + st_election_status 564 + "\n st_election_tiebreaker=" + st_election_tiebreaker 565 + "\n st_election_votes=" + st_election_votes 566 + "\n st_election_sec=" + st_election_sec 567 + "\n st_election_usec=" + st_election_usec 568 + "\n st_max_lease_sec=" + st_max_lease_sec 569 + "\n st_max_lease_usec=" + st_max_lease_usec 570 ; 571 } 572} 573