001package org.apache.hadoop.hbase;
002
003/**
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *     http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020import java.lang.reflect.Field;
021import java.util.concurrent.atomic.LongAdder;
022
023import org.apache.yetus.audience.InterfaceAudience;
024
025/**
026 * Counters kept by the distributed WAL split log process.
027 * Used by master and regionserver packages.
028 * @deprecated since 2.4.0 and in 3.0.0, to be removed in 4.0.0, replaced by procedure-based
029 *   distributed WAL splitter, see SplitWALManager
030 */
031@Deprecated
032@InterfaceAudience.Private
033public class SplitLogCounters {
034  private SplitLogCounters() {}
035
036  //Spnager counters
037  public final static LongAdder tot_mgr_log_split_batch_start = new LongAdder();
038  public final static LongAdder tot_mgr_log_split_batch_success = new LongAdder();
039  public final static LongAdder tot_mgr_log_split_batch_err = new LongAdder();
040  public final static LongAdder tot_mgr_new_unexpected_wals = new LongAdder();
041  public final static LongAdder tot_mgr_log_split_start = new LongAdder();
042  public final static LongAdder tot_mgr_log_split_success = new LongAdder();
043  public final static LongAdder tot_mgr_log_split_err = new LongAdder();
044  public final static LongAdder tot_mgr_node_create_queued = new LongAdder();
045  public final static LongAdder tot_mgr_node_create_result = new LongAdder();
046  public final static LongAdder tot_mgr_node_already_exists = new LongAdder();
047  public final static LongAdder tot_mgr_node_create_err = new LongAdder();
048  public final static LongAdder tot_mgr_node_create_retry = new LongAdder();
049  public final static LongAdder tot_mgr_get_data_queued = new LongAdder();
050  public final static LongAdder tot_mgr_get_data_result = new LongAdder();
051  public final static LongAdder tot_mgr_get_data_nonode = new LongAdder();
052  public final static LongAdder tot_mgr_get_data_err = new LongAdder();
053  public final static LongAdder tot_mgr_get_data_retry = new LongAdder();
054  public final static LongAdder tot_mgr_node_delete_queued = new LongAdder();
055  public final static LongAdder tot_mgr_node_delete_result = new LongAdder();
056  public final static LongAdder tot_mgr_node_delete_err = new LongAdder();
057  public final static LongAdder tot_mgr_resubmit = new LongAdder();
058  public final static LongAdder tot_mgr_resubmit_failed = new LongAdder();
059  public final static LongAdder tot_mgr_null_data = new LongAdder();
060  public final static LongAdder tot_mgr_orphan_task_acquired = new LongAdder();
061  public final static LongAdder tot_mgr_wait_for_zk_delete = new LongAdder();
062  public final static LongAdder tot_mgr_unacquired_orphan_done = new LongAdder();
063  public final static LongAdder tot_mgr_resubmit_threshold_reached = new LongAdder();
064  public final static LongAdder tot_mgr_missing_state_in_delete = new LongAdder();
065  public final static LongAdder tot_mgr_heartbeat = new LongAdder();
066  public final static LongAdder tot_mgr_rescan = new LongAdder();
067  public final static LongAdder tot_mgr_rescan_deleted = new LongAdder();
068  public final static LongAdder tot_mgr_task_deleted = new LongAdder();
069  public final static LongAdder tot_mgr_resubmit_unassigned = new LongAdder();
070  public final static LongAdder tot_mgr_relist_logdir = new LongAdder();
071  public final static LongAdder tot_mgr_resubmit_dead_server_task = new LongAdder();
072  public final static LongAdder tot_mgr_resubmit_force = new LongAdder();
073
074  // SplitLogWorker counters
075  public final static LongAdder tot_wkr_failed_to_grab_task_no_data = new LongAdder();
076  public final static LongAdder tot_wkr_failed_to_grab_task_exception = new LongAdder();
077  public final static LongAdder tot_wkr_failed_to_grab_task_owned = new LongAdder();
078  public final static LongAdder tot_wkr_failed_to_grab_task_lost_race = new LongAdder();
079  public final static LongAdder tot_wkr_task_acquired = new LongAdder();
080  public final static LongAdder tot_wkr_task_resigned = new LongAdder();
081  public final static LongAdder tot_wkr_task_done = new LongAdder();
082  public final static LongAdder tot_wkr_task_err = new LongAdder();
083  public final static LongAdder tot_wkr_task_heartbeat = new LongAdder();
084  public final static LongAdder tot_wkr_task_acquired_rescan = new LongAdder();
085  public final static LongAdder tot_wkr_get_data_queued = new LongAdder();
086  public final static LongAdder tot_wkr_get_data_result = new LongAdder();
087  public final static LongAdder tot_wkr_get_data_retry = new LongAdder();
088  public final static LongAdder tot_wkr_preempt_task = new LongAdder();
089  public final static LongAdder tot_wkr_task_heartbeat_failed = new LongAdder();
090  public final static LongAdder tot_wkr_final_transition_failed = new LongAdder();
091  public final static LongAdder tot_wkr_task_grabing = new LongAdder();
092
093  public static void resetCounters() throws Exception {
094    Class<?> cl = SplitLogCounters.class;
095    for (Field fld : cl.getDeclaredFields()) {
096      /* Guard against source instrumentation. */
097      if ((!fld.isSynthetic()) && (LongAdder.class.isAssignableFrom(fld.getType()))) {
098        ((LongAdder)fld.get(null)).reset();
099      }
100    }
101  }
102}