View Javadoc

1   package org.apache.hadoop.hbase;
2   
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
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
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.
19   */
20  import java.lang.reflect.Field;
21  import java.util.concurrent.atomic.AtomicLong;
22  
23  import org.apache.hadoop.hbase.classification.InterfaceAudience;
24  
25  /**
26   * Counters kept by the distributed WAL split log process.
27   * Used by master and regionserver packages.
28   */
29  @InterfaceAudience.Private
30  public class SplitLogCounters {
31    //SplitLogManager counters
32    public final static AtomicLong tot_mgr_log_split_batch_start = new AtomicLong(0);
33    public final static AtomicLong tot_mgr_log_split_batch_success = new AtomicLong(0);
34    public final static AtomicLong tot_mgr_log_split_batch_err = new AtomicLong(0);
35    public final static AtomicLong tot_mgr_new_unexpected_wals = new AtomicLong(0);
36    public final static AtomicLong tot_mgr_log_split_start = new AtomicLong(0);
37    public final static AtomicLong tot_mgr_log_split_success = new AtomicLong(0);
38    public final static AtomicLong tot_mgr_log_split_err = new AtomicLong(0);
39    public final static AtomicLong tot_mgr_node_create_queued = new AtomicLong(0);
40    public final static AtomicLong tot_mgr_node_create_result = new AtomicLong(0);
41    public final static AtomicLong tot_mgr_node_already_exists = new AtomicLong(0);
42    public final static AtomicLong tot_mgr_node_create_err = new AtomicLong(0);
43    public final static AtomicLong tot_mgr_node_create_retry = new AtomicLong(0);
44    public final static AtomicLong tot_mgr_get_data_queued = new AtomicLong(0);
45    public final static AtomicLong tot_mgr_get_data_result = new AtomicLong(0);
46    public final static AtomicLong tot_mgr_get_data_nonode = new AtomicLong(0);
47    public final static AtomicLong tot_mgr_get_data_err = new AtomicLong(0);
48    public final static AtomicLong tot_mgr_get_data_retry = new AtomicLong(0);
49    public final static AtomicLong tot_mgr_node_delete_queued = new AtomicLong(0);
50    public final static AtomicLong tot_mgr_node_delete_result = new AtomicLong(0);
51    public final static AtomicLong tot_mgr_node_delete_err = new AtomicLong(0);
52    public final static AtomicLong tot_mgr_resubmit = new AtomicLong(0);
53    public final static AtomicLong tot_mgr_resubmit_failed = new AtomicLong(0);
54    public final static AtomicLong tot_mgr_null_data = new AtomicLong(0);
55    public final static AtomicLong tot_mgr_orphan_task_acquired = new AtomicLong(0);
56    public final static AtomicLong tot_mgr_wait_for_zk_delete = new AtomicLong(0);
57    public final static AtomicLong tot_mgr_unacquired_orphan_done = new AtomicLong(0);
58    public final static AtomicLong tot_mgr_resubmit_threshold_reached = new AtomicLong(0);
59    public final static AtomicLong tot_mgr_missing_state_in_delete = new AtomicLong(0);
60    public final static AtomicLong tot_mgr_heartbeat = new AtomicLong(0);
61    public final static AtomicLong tot_mgr_rescan = new AtomicLong(0);
62    public final static AtomicLong tot_mgr_rescan_deleted = new AtomicLong(0);
63    public final static AtomicLong tot_mgr_task_deleted = new AtomicLong(0);
64    public final static AtomicLong tot_mgr_resubmit_unassigned = new AtomicLong(0);
65    public final static AtomicLong tot_mgr_relist_logdir = new AtomicLong(0);
66    public final static AtomicLong tot_mgr_resubmit_dead_server_task = new AtomicLong(0);
67    public final static AtomicLong tot_mgr_resubmit_force = new AtomicLong(0);
68  
69    // SplitLogWorker counters
70    public final static AtomicLong tot_wkr_failed_to_grab_task_no_data = new AtomicLong(0);
71    public final static AtomicLong tot_wkr_failed_to_grab_task_exception = new AtomicLong(0);
72    public final static AtomicLong tot_wkr_failed_to_grab_task_owned = new AtomicLong(0);
73    public final static AtomicLong tot_wkr_failed_to_grab_task_lost_race = new AtomicLong(0);
74    public final static AtomicLong tot_wkr_task_acquired = new AtomicLong(0);
75    public final static AtomicLong tot_wkr_task_resigned = new AtomicLong(0);
76    public final static AtomicLong tot_wkr_task_done = new AtomicLong(0);
77    public final static AtomicLong tot_wkr_task_err = new AtomicLong(0);
78    public final static AtomicLong tot_wkr_task_heartbeat = new AtomicLong(0);
79    public final static AtomicLong tot_wkr_task_acquired_rescan = new AtomicLong(0);
80    public final static AtomicLong tot_wkr_get_data_queued = new AtomicLong(0);
81    public final static AtomicLong tot_wkr_get_data_result = new AtomicLong(0);
82    public final static AtomicLong tot_wkr_get_data_retry = new AtomicLong(0);
83    public final static AtomicLong tot_wkr_preempt_task = new AtomicLong(0);
84    public final static AtomicLong tot_wkr_task_heartbeat_failed = new AtomicLong(0);
85    public final static AtomicLong tot_wkr_final_transition_failed = new AtomicLong(0);
86    public final static AtomicLong tot_wkr_task_grabing = new AtomicLong(0);
87  
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()) && (AtomicLong.class.isAssignableFrom(fld.getType()))) {
93          ((AtomicLong)fld.get(null)).set(0);
94        }
95      }
96    }
97  }