HBASE-24609 Move MetaTableAccessor out of hbase-client (#1943)
[hbase.git] / hbase-server / src / main / java / org / apache / hadoop / hbase / SplitLogCounters.java
blob6be1131bfb82c16b41802721b5423f93b5f7448b
1 package org.apache.hadoop.hbase;
3 /**
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
20 import java.lang.reflect.Field;
21 import java.util.concurrent.atomic.LongAdder;
23 import org.apache.yetus.audience.InterfaceAudience;
25 /**
26 * Counters kept by the distributed WAL split log process.
27 * Used by master and regionserver packages.
29 @InterfaceAudience.Private
30 public class SplitLogCounters {
31 //Spnager counters
32 public final static LongAdder tot_mgr_log_split_batch_start = new LongAdder();
33 public final static LongAdder tot_mgr_log_split_batch_success = new LongAdder();
34 public final static LongAdder tot_mgr_log_split_batch_err = new LongAdder();
35 public final static LongAdder tot_mgr_new_unexpected_wals = new LongAdder();
36 public final static LongAdder tot_mgr_log_split_start = new LongAdder();
37 public final static LongAdder tot_mgr_log_split_success = new LongAdder();
38 public final static LongAdder tot_mgr_log_split_err = new LongAdder();
39 public final static LongAdder tot_mgr_node_create_queued = new LongAdder();
40 public final static LongAdder tot_mgr_node_create_result = new LongAdder();
41 public final static LongAdder tot_mgr_node_already_exists = new LongAdder();
42 public final static LongAdder tot_mgr_node_create_err = new LongAdder();
43 public final static LongAdder tot_mgr_node_create_retry = new LongAdder();
44 public final static LongAdder tot_mgr_get_data_queued = new LongAdder();
45 public final static LongAdder tot_mgr_get_data_result = new LongAdder();
46 public final static LongAdder tot_mgr_get_data_nonode = new LongAdder();
47 public final static LongAdder tot_mgr_get_data_err = new LongAdder();
48 public final static LongAdder tot_mgr_get_data_retry = new LongAdder();
49 public final static LongAdder tot_mgr_node_delete_queued = new LongAdder();
50 public final static LongAdder tot_mgr_node_delete_result = new LongAdder();
51 public final static LongAdder tot_mgr_node_delete_err = new LongAdder();
52 public final static LongAdder tot_mgr_resubmit = new LongAdder();
53 public final static LongAdder tot_mgr_resubmit_failed = new LongAdder();
54 public final static LongAdder tot_mgr_null_data = new LongAdder();
55 public final static LongAdder tot_mgr_orphan_task_acquired = new LongAdder();
56 public final static LongAdder tot_mgr_wait_for_zk_delete = new LongAdder();
57 public final static LongAdder tot_mgr_unacquired_orphan_done = new LongAdder();
58 public final static LongAdder tot_mgr_resubmit_threshold_reached = new LongAdder();
59 public final static LongAdder tot_mgr_missing_state_in_delete = new LongAdder();
60 public final static LongAdder tot_mgr_heartbeat = new LongAdder();
61 public final static LongAdder tot_mgr_rescan = new LongAdder();
62 public final static LongAdder tot_mgr_rescan_deleted = new LongAdder();
63 public final static LongAdder tot_mgr_task_deleted = new LongAdder();
64 public final static LongAdder tot_mgr_resubmit_unassigned = new LongAdder();
65 public final static LongAdder tot_mgr_relist_logdir = new LongAdder();
66 public final static LongAdder tot_mgr_resubmit_dead_server_task = new LongAdder();
67 public final static LongAdder tot_mgr_resubmit_force = new LongAdder();
69 // SplitLogWorker counters
70 public final static LongAdder tot_wkr_failed_to_grab_task_no_data = new LongAdder();
71 public final static LongAdder tot_wkr_failed_to_grab_task_exception = new LongAdder();
72 public final static LongAdder tot_wkr_failed_to_grab_task_owned = new LongAdder();
73 public final static LongAdder tot_wkr_failed_to_grab_task_lost_race = new LongAdder();
74 public final static LongAdder tot_wkr_task_acquired = new LongAdder();
75 public final static LongAdder tot_wkr_task_resigned = new LongAdder();
76 public final static LongAdder tot_wkr_task_done = new LongAdder();
77 public final static LongAdder tot_wkr_task_err = new LongAdder();
78 public final static LongAdder tot_wkr_task_heartbeat = new LongAdder();
79 public final static LongAdder tot_wkr_task_acquired_rescan = new LongAdder();
80 public final static LongAdder tot_wkr_get_data_queued = new LongAdder();
81 public final static LongAdder tot_wkr_get_data_result = new LongAdder();
82 public final static LongAdder tot_wkr_get_data_retry = new LongAdder();
83 public final static LongAdder tot_wkr_preempt_task = new LongAdder();
84 public final static LongAdder tot_wkr_task_heartbeat_failed = new LongAdder();
85 public final static LongAdder tot_wkr_final_transition_failed = new LongAdder();
86 public final static LongAdder tot_wkr_task_grabing = new LongAdder();
88 public static void resetCounters() throws Exception {
89 Class<?> cl = SplitLogCounters.class;
90 for (Field fld : cl.getDeclaredFields()) {
91 /* Guard against source instrumentation. */
92 if ((!fld.isSynthetic()) && (LongAdder.class.isAssignableFrom(fld.getType()))) {
93 ((LongAdder)fld.get(null)).reset();