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