summaryrefslogtreecommitdiff
path: root/lang/java/src/com/sleepycat/db/ReplicationStats.java
blob: 5c0c7eef443bb4e9b00014b5cf389c6b6b172b7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
/*-
 * Automatically built by dist/s_java_stat.
 * Only the javadoc comments can be edited.
 *
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2002, 2015 Oracle and/or its affiliates.  All rights reserved.
 */

package com.sleepycat.db;

import com.sleepycat.db.internal.DbConstants;

/**
Replication statistics for a database environment.
*/
public class ReplicationStats {
    // no public constructor
    /* package */ ReplicationStats() {}
    /**
    The environment is configured as a replication client, as reported by {@link #getStatus}.
    */
    public static final int REP_CLIENT = DbConstants.DB_REP_CLIENT;

    /**
    The environment is configured as a replication master, as reported by {@link #getStatus}.
    */
    public static final int REP_MASTER = DbConstants.DB_REP_MASTER;

    /**
    Replication is not configured for this environment, as reported by {@link #getStatus}.
    */
    public static final int REP_NONE = 0;

    private int st_startup_complete;
    /** The client site has completed its startup procedures and is now handling live records from the master.  */
    public boolean getStartupComplete() {
        return (st_startup_complete != 0);
    }

    private int st_view;
    /** True if the site is a view and false if not. */
    public boolean getView() {
        return (st_view != 0);
    }

    private long st_log_queued;
    /** The number of log records currently queued. */
    public long getLogQueued() {
        return st_log_queued;
    }

    private int st_status;
    /** The current replication mode.  Set to one of {@link #REP_MASTER}, {@link #REP_CLIENT} or {@link #REP_NONE}. */
    public int getStatus() {
        return st_status;
    }

    private LogSequenceNumber st_next_lsn;
    /** In replication environments configured as masters, the next LSN to be used. In replication environments configured as clients, the next LSN expected.  */
    public LogSequenceNumber getNextLsn() {
        return st_next_lsn;
    }

    private LogSequenceNumber st_waiting_lsn;
    /** The LSN of the first log record we have after missing log records being waited for, or 0 if no log records are currently missing.  */
    public LogSequenceNumber getWaitingLsn() {
        return st_waiting_lsn;
    }

    private LogSequenceNumber st_max_perm_lsn;
    /** The LSN of the maximum permanent log record, or 0 if there are no permanent log records.  */
    public LogSequenceNumber getMaxPermLsn() {
        return st_max_perm_lsn;
    }

    private int st_next_pg;
    /** The next page number we expect to receive.  */
    public int getNextPages() {
        return st_next_pg;
    }

    private int st_waiting_pg;
    /** The page number of the first page we have after missing pages being waited for, or 0 if no pages are currently missing. */
    public int getWaitingPages() {
        return st_waiting_pg;
    }

    private int st_dupmasters;
    /** The number of duplicate master conditions originally detected at this site. */
    public int getDupmasters() {
        return st_dupmasters;
    }

    private long st_env_id;
    /** The current environment ID. */
    public long getEnvId() {
        return st_env_id;
    }

    private int st_env_priority;
    /** The current environment priority. */
    public int getEnvPriority() {
        return st_env_priority;
    }

    private long st_bulk_fills;
    /** The number of times the bulk buffer filled up, forcing the buffer content to be sent. */
    public long getBulkFills() {
        return st_bulk_fills;
    }

    private long st_bulk_overflows;
    /** The number of times a record was bigger than the entire bulk buffer, and therefore had to be sent as a singleton. */
    public long getBulkOverflows() {
        return st_bulk_overflows;
    }

    private long st_bulk_records;
    /** The number of records added to a bulk buffer. */
    public long getBulkRecords() {
        return st_bulk_records;
    }

    private long st_bulk_transfers;
    /** The number of bulk buffers transferred (via a call to the application's {@link ReplicationTransport} function). */
    public long getBulkTransfers() {
        return st_bulk_transfers;
    }

    private long st_client_rerequests;
    /** The number of times this client site received a "re-request" message, indicating that a request it previously sent to another client could not be serviced by that client. (Compare to {@link #getClientSvcMiss}.) */
    public long getClientRerequests() {
        return st_client_rerequests;
    }

    private long st_client_svc_req;
    /** The number of "request" type messages received by this client. ("Request" messages are usually sent from a client to the master, but a message passed with the anywhere parameter set to true in the invocation of the application's {@link ReplicationTransport#send ReplicationTransport.send()} function may be sent to another client instead.) */
    public long getClientSvcReq() {
        return st_client_svc_req;
    }

    private long st_client_svc_miss;
    /** The number of "request" type messages received by this client that could not be processed, forcing the originating requester to try sending the request to the master (or another client). */
    public long getClientSvcMiss() {
        return st_client_svc_miss;
    }

    private int st_gen;
    /** The current master generation number. */
    public int getGen() {
        return st_gen;
    }

    private int st_egen;
    /** The election generation number for the current or next election. */
    public int getEgen() {
        return st_egen;
    }

    private long st_lease_chk;
    /** The number of lease validity checks. */
    public long getLeaseChk() {
        return st_lease_chk;
    }

    private long st_lease_chk_misses;
    /** The number of invalid lease validity checks. */
    public long getLeaseChkMisses() {
        return st_lease_chk_misses;
    }

    private long st_lease_chk_refresh;
    /** The number of lease refresh attempts during lease validity checks. */
    public long getLeaseChkRefresh() {
        return st_lease_chk_refresh;
    }

    private long st_lease_sends;
    /** The number of live messages sent while using leases. */
    public long getLeaseSends() {
        return st_lease_sends;
    }

    private long st_log_duplicated;
    /** The number of duplicate log records received. */
    public long getLogDuplicated() {
        return st_log_duplicated;
    }

    private long st_log_queued_max;
    /** The maximum number of log records ever queued at once. */
    public long getLogQueuedMax() {
        return st_log_queued_max;
    }

    private long st_log_queued_total;
    /** The total number of log records queued. */
    public long getLogQueuedTotal() {
        return st_log_queued_total;
    }

    private long st_log_records;
    /** The number of log records received and appended to the log. */
    public long getLogRecords() {
        return st_log_records;
    }

    private long st_log_requested;
    /** The number of times log records were missed and requested. */
    public long getLogRequested() {
        return st_log_requested;
    }

    private long st_master;
    /** The current master environment ID. */
    public long getMaster() {
        return st_master;
    }

    private long st_master_changes;
    /** The number of times the master has changed. */
    public long getMasterChanges() {
        return st_master_changes;
    }

    private long st_msgs_badgen;
    /** The number of messages received with a bad generation number. */
    public long getMsgsBadgen() {
        return st_msgs_badgen;
    }

    private long st_msgs_processed;
    /** The number of messages received and processed. */
    public long getMsgsProcessed() {
        return st_msgs_processed;
    }

    private long st_msgs_recover;
    /** The number of messages ignored due to pending recovery. */
    public long getMsgsRecover() {
        return st_msgs_recover;
    }

    private long st_msgs_send_failures;
    /** The number of failed message sends. */
    public long getMsgsSendFailures() {
        return st_msgs_send_failures;
    }

    private long st_msgs_sent;
    /** The number of messages sent. */
    public long getMsgsSent() {
        return st_msgs_sent;
    }

    private long st_newsites;
    /** The number of new site messages received. */
    public long getNewsites() {
        return st_newsites;
    }

    private int st_nsites;
    /** The number of sites used in the last election. */
    public int getNumSites() {
        return st_nsites;
    }

    private long st_nthrottles;
    /** Transmission limited. This indicates the number of times that data transmission was stopped to limit the amount of data sent in response to a single call to {@link Environment#processReplicationMessage Environment.processReplicationMessage}. */
    public long getNumThrottles() {
        return st_nthrottles;
    }

    private long st_outdated;
    /** The number of outdated conditions detected. */
    public long getOutdated() {
        return st_outdated;
    }

    private long st_pg_duplicated;
    /** The number of duplicate pages received. */
    public long getPagesDuplicated() {
        return st_pg_duplicated;
    }

    private long st_pg_records;
    /** The number of pages received and stored. */
    public long getPagesRecords() {
        return st_pg_records;
    }

    private long st_pg_requested;
    /** The number of pages missed and requested from the master. */
    public long getPagesRequested() {
        return st_pg_requested;
    }

    private long st_txns_applied;
    /** The number of transactions applied. */
    public long getTxnsApplied() {
        return st_txns_applied;
    }

    private long st_startsync_delayed;
    /** The number of times the client had to delay the start of a cache flush operation (initiated by the master for an impending checkpoint) because it was missing some previous log record(s). */
    public long getStartSyncDelayed() {
        return st_startsync_delayed;
    }

    private long st_elections;
    /** The number of elections held. */
    public long getElections() {
        return st_elections;
    }

    private long st_elections_won;
    /** The number of elections won. */
    public long getElectionsWon() {
        return st_elections_won;
    }

    private long st_election_cur_winner;
    /** The environment ID of the winner of the current or last election.*/
    public long getElectionCurWinner() {
        return st_election_cur_winner;
    }

    private int st_election_gen;
    /** The master generation number of the winner of the current or last election. */
    public int getElectionGen() {
        return st_election_gen;
    }

    private int st_election_datagen;
    /** The master data generation number of the winner of the current or last election.*/
    public int getElectionDatagen() {
        return st_election_datagen;
    }

    private LogSequenceNumber st_election_lsn;
    /** The maximum LSN of the winner of the current or last election.*/
    public LogSequenceNumber getElectionLsn() {
        return st_election_lsn;
    }

    private int st_election_nsites;
    /** The number of sites responding to this site during the current election. */
    public int getElectionNumSites() {
        return st_election_nsites;
    }

    private int st_election_nvotes;
    /** The number of votes required in the current or last election. */
    public int getElectionNumVotes() {
        return st_election_nvotes;
    }

    private int st_election_priority;
    /** The priority of the winner of the current or last election. */
    public int getElectionPriority() {
        return st_election_priority;
    }

    private int st_election_status;
    /** The current election phase (0 if no election is in progress). */
    public int getElectionStatus() {
        return st_election_status;
    }

    private int st_election_tiebreaker;
    /** The tiebreaker value of the winner of the current or last election. */
    public int getElectionTiebreaker() {
        return st_election_tiebreaker;
    }

    private int st_election_votes;
    /** The number of votes received during the current election. */
    public int getElectionVotes() {
        return st_election_votes;
    }

    private int st_election_sec;
    /** The number of seconds the last election took (the total election time is this value plus {@link #getElectionUsec}). */
    public int getElectionSec() {
        return st_election_sec;
    }

    private int st_election_usec;
    /** The number of microseconds the last election took (the total election time is this value plus {@link #getElectionSec}). */
    public int getElectionUsec() {
        return st_election_usec;
    }

    private int st_max_lease_sec;
    /** The number of seconds of the longest lease (the total lease time is this value plus {@link #getMaxLeaseUsec}). */
    public int getMaxLeaseSec() {
        return st_max_lease_sec;
    }

    private int st_max_lease_usec;
    /** The number of microseconds of the longest lease (the total lease time is this value plus {@link #getMaxLeaseSec}). */
    public int getMaxLeaseUsec() {
        return st_max_lease_usec;
    }

    /**
    For convenience, the ReplicationStats class has a toString method
    that lists all the data fields.
    */
    public String toString() {
        return "ReplicationStats:"
            + "\n  st_startup_complete=" + (st_startup_complete != 0)
            + "\n  st_view=" + st_view
            + "\n  st_log_queued=" + st_log_queued
            + "\n  st_status=" + st_status
            + "\n  st_next_lsn=" + st_next_lsn
            + "\n  st_waiting_lsn=" + st_waiting_lsn
            + "\n  st_max_perm_lsn=" + st_max_perm_lsn
            + "\n  st_next_pg=" + st_next_pg
            + "\n  st_waiting_pg=" + st_waiting_pg
            + "\n  st_dupmasters=" + st_dupmasters
            + "\n  st_env_id=" + st_env_id
            + "\n  st_env_priority=" + st_env_priority
            + "\n  st_bulk_fills=" + st_bulk_fills
            + "\n  st_bulk_overflows=" + st_bulk_overflows
            + "\n  st_bulk_records=" + st_bulk_records
            + "\n  st_bulk_transfers=" + st_bulk_transfers
            + "\n  st_client_rerequests=" + st_client_rerequests
            + "\n  st_client_svc_req=" + st_client_svc_req
            + "\n  st_client_svc_miss=" + st_client_svc_miss
            + "\n  st_gen=" + st_gen
            + "\n  st_egen=" + st_egen
            + "\n  st_lease_chk=" + st_lease_chk
            + "\n  st_lease_chk_misses=" + st_lease_chk_misses
            + "\n  st_lease_chk_refresh=" + st_lease_chk_refresh
            + "\n  st_lease_sends=" + st_lease_sends
            + "\n  st_log_duplicated=" + st_log_duplicated
            + "\n  st_log_queued_max=" + st_log_queued_max
            + "\n  st_log_queued_total=" + st_log_queued_total
            + "\n  st_log_records=" + st_log_records
            + "\n  st_log_requested=" + st_log_requested
            + "\n  st_master=" + st_master
            + "\n  st_master_changes=" + st_master_changes
            + "\n  st_msgs_badgen=" + st_msgs_badgen
            + "\n  st_msgs_processed=" + st_msgs_processed
            + "\n  st_msgs_recover=" + st_msgs_recover
            + "\n  st_msgs_send_failures=" + st_msgs_send_failures
            + "\n  st_msgs_sent=" + st_msgs_sent
            + "\n  st_newsites=" + st_newsites
            + "\n  st_nsites=" + st_nsites
            + "\n  st_nthrottles=" + st_nthrottles
            + "\n  st_outdated=" + st_outdated
            + "\n  st_pg_duplicated=" + st_pg_duplicated
            + "\n  st_pg_records=" + st_pg_records
            + "\n  st_pg_requested=" + st_pg_requested
            + "\n  st_txns_applied=" + st_txns_applied
            + "\n  st_startsync_delayed=" + st_startsync_delayed
            + "\n  st_elections=" + st_elections
            + "\n  st_elections_won=" + st_elections_won
            + "\n  st_election_cur_winner=" + st_election_cur_winner
            + "\n  st_election_gen=" + st_election_gen
            + "\n  st_election_datagen=" + st_election_datagen
            + "\n  st_election_lsn=" + st_election_lsn
            + "\n  st_election_nsites=" + st_election_nsites
            + "\n  st_election_nvotes=" + st_election_nvotes
            + "\n  st_election_priority=" + st_election_priority
            + "\n  st_election_status=" + st_election_status
            + "\n  st_election_tiebreaker=" + st_election_tiebreaker
            + "\n  st_election_votes=" + st_election_votes
            + "\n  st_election_sec=" + st_election_sec
            + "\n  st_election_usec=" + st_election_usec
            + "\n  st_max_lease_sec=" + st_max_lease_sec
            + "\n  st_max_lease_usec=" + st_max_lease_usec
            ;
    }
}