/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2009 Oracle. All rights reserved.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace BerkeleyDB {
///
/// Statistical information about the replication subsystem
///
public class ReplicationStats {
private Internal.ReplicationStatStruct st;
private LSN next;
private LSN waiting;
private LSN maxPerm;
private LSN winner;
internal ReplicationStats(Internal.ReplicationStatStruct stats) {
st = stats;
next = new LSN(st.st_next_lsn.file, st.st_next_lsn.offset);
waiting = new LSN(st.st_waiting_lsn.file, st.st_waiting_lsn.offset);
maxPerm =
new LSN(st.st_max_perm_lsn.file, st.st_max_perm_lsn.offset);
winner = new LSN(st.st_election_lsn.file, st.st_election_lsn.offset);
}
///
/// Log records currently queued.
///
public ulong CurrentQueuedLogRecords { get { return st.st_log_queued; } }
///
/// Site completed client sync-up.
///
public bool ClientStartupComplete { get { return st.st_startup_complete != 0; } }
///
/// Current replication status.
///
public uint Status { get { return st.st_status; } }
///
/// Next LSN to use or expect.
///
public LSN NextLSN { get { return next; } }
///
/// LSN we're awaiting, if any.
///
public LSN AwaitedLSN { get { return waiting; } }
///
/// Maximum permanent LSN.
///
public LSN MaxPermanentLSN { get { return maxPerm; } }
///
/// Next pg we expect.
///
public uint NextPage { get { return st.st_next_pg; } }
///
/// pg we're awaiting, if any.
///
public uint AwaitedPage { get { return st.st_waiting_pg; } }
///
/// # of times a duplicate master condition was detected.
///
public uint DupMasters { get { return st.st_dupmasters; } }
///
/// Current environment ID.
///
public int EnvID { get { return st.st_env_id; } }
///
/// Current environment priority.
///
public uint EnvPriority { get { return st.st_env_priority; } }
///
/// Bulk buffer fills.
///
public ulong BulkBufferFills { get { return st.st_bulk_fills; } }
///
/// Bulk buffer overflows.
///
public ulong BulkBufferOverflows { get { return st.st_bulk_overflows; } }
///
/// Bulk records stored.
///
public ulong BulkRecordsStored { get { return st.st_bulk_records; } }
///
/// Transfers of bulk buffers.
///
public ulong BulkBufferTransfers { get { return st.st_bulk_transfers; } }
///
/// Number of forced rerequests.
///
public ulong ForcedRerequests { get { return st.st_client_rerequests; } }
///
/// Number of client service requests received by this client.
///
public ulong ClientServiceRequests { get { return st.st_client_svc_req; } }
///
/// Number of client service requests missing on this client.
///
public ulong ClientServiceRequestsMissing { get { return st.st_client_svc_miss; } }
///
/// Current generation number.
///
public uint CurrentGenerationNumber { get { return st.st_gen; } }
///
/// Current election gen number.
///
public uint CurrentElectionGenerationNumber { get { return st.st_egen; } }
///
/// Log records received multiply.
///
public ulong DuplicateLogRecords { get { return st.st_log_duplicated; } }
///
/// Max. log records queued at once.
///
public ulong MaxQueuedLogRecords { get { return st.st_log_queued_max; } }
///
/// Total # of log recs. ever queued.
///
public ulong QueuedLogRecords { get { return st.st_log_queued_total; } }
///
/// Log records received and put.
///
public ulong ReceivedLogRecords { get { return st.st_log_records; } }
///
/// Log recs. missed and requested.
///
public ulong MissedLogRecords { get { return st.st_log_requested; } }
///
/// Env. ID of the current master.
///
public int MasterEnvID { get { return st.st_master; } }
///
/// # of times we've switched masters.
///
public ulong MasterChanges { get { return st.st_master_changes; } }
///
/// Messages with a bad generation #.
///
public ulong BadGenerationMessages { get { return st.st_msgs_badgen; } }
///
/// Messages received and processed.
///
public ulong ReceivedMessages { get { return st.st_msgs_processed; } }
///
/// Messages ignored because this site was a client in recovery.
///
public ulong IgnoredMessages { get { return st.st_msgs_recover; } }
///
/// # of failed message sends.
///
public ulong FailedMessageSends { get { return st.st_msgs_send_failures; } }
///
/// # of successful message sends.
///
public ulong MessagesSent { get { return st.st_msgs_sent; } }
///
/// # of NEWSITE msgs. received.
///
public ulong NewSiteMessages { get { return st.st_newsites; } }
///
/// Current number of sites we will assume during elections.
///
public uint Sites { get { return st.st_nsites; } }
///
/// # of times we were throttled.
///
public ulong Throttled { get { return st.st_nthrottles; } }
///
/// # of times we detected and returned an OUTDATED condition.
///
public ulong Outdated { get { return st.st_outdated; } }
///
/// Pages received multiply.
///
public ulong DuplicatePages { get { return st.st_pg_duplicated; } }
///
/// Pages received and stored.
///
public ulong ReceivedPages { get { return st.st_pg_records; } }
///
/// Pages missed and requested.
///
public ulong MissedPages { get { return st.st_pg_requested; } }
///
/// # of transactions applied.
///
public ulong AppliedTransactions { get { return st.st_txns_applied; } }
///
/// # of STARTSYNC msgs delayed.
///
public ulong StartSyncMessagesDelayed { get { return st.st_startsync_delayed; } }
/* Elections generally. */
///
/// # of elections held.
///
public ulong Elections { get { return st.st_elections; } }
///
/// # of elections won by this site.
///
public ulong ElectionsWon { get { return st.st_elections_won; } }
/* Statistics about an in-progress election. */
///
/// Current front-runner.
///
public int CurrentWinner { get { return st.st_election_cur_winner; } }
///
/// Election generation number.
///
public uint ElectionGenerationNumber { get { return st.st_election_gen; } }
///
/// Max. LSN of current winner.
///
public LSN CurrentWinnerMaxLSN { get { return winner; } }
///
/// # of "registered voters".
///
public uint RegisteredSites { get { return st.st_election_nsites; } }
///
/// # of "registered voters" needed.
///
public uint RegisteredSitesNeeded { get { return st.st_election_nvotes; } }
///
/// Current election priority.
///
public uint ElectionPriority { get { return st.st_election_priority; } }
///
/// Current election status.
///
public int ElectionStatus { get { return st.st_election_status; } }
///
/// Election tiebreaker value.
///
public uint ElectionTiebreaker { get { return st.st_election_tiebreaker; } }
///
/// Votes received in this round.
///
public uint Votes { get { return st.st_election_votes; } }
///
/// Last election time seconds.
///
public uint ElectionTimeSec { get { return st.st_election_sec; } }
///
/// Last election time useconds.
///
public uint ElectionTimeUSec { get { return st.st_election_usec; } }
///
/// Maximum lease timestamp seconds.
///
public uint MaxLeaseSec { get { return st.st_max_lease_sec; } }
///
/// Maximum lease timestamp useconds.
///
public uint MaxLeaseUSec { get { return st.st_max_lease_usec; } }
}
}