From fa0fbaf4a2781b888a4746b6d46788bf509eeabe Mon Sep 17 00:00:00 2001 From: chenheng Date: Tue, 27 Oct 2015 16:18:50 +0800 Subject: [PATCH] HBASE-14703 update the per-region stats twice for the call on return --- .../hbase/client/RpcRetryingCallerFactory.java | 6 -- .../client/StatsTrackingRpcRetryingCaller.java | 77 ---------------------- 2 files changed, 83 deletions(-) delete mode 100644 hbase-client/src/main/java/org/apache/hadoop/hbase/client/StatsTrackingRpcRetryingCaller.java diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java index 0af8210..550812f 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java @@ -67,12 +67,6 @@ public class RpcRetryingCallerFactory { // is cheap as it does not require parsing a complex structure. RpcRetryingCaller caller = new RpcRetryingCallerImpl(pause, retries, interceptor, startLogErrorsCnt); - - // wrap it with stats, if we are tracking them - if (enableBackPressure && this.stats != null) { - caller = new StatsTrackingRpcRetryingCaller(caller, this.stats); - } - return caller; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/StatsTrackingRpcRetryingCaller.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/StatsTrackingRpcRetryingCaller.java deleted file mode 100644 index e82f1e8..0000000 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/StatsTrackingRpcRetryingCaller.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.hbase.client; - -import org.apache.hadoop.hbase.HRegionLocation; -import org.apache.hadoop.hbase.classification.InterfaceAudience; - -import java.io.IOException; - -/** - * An {@link RpcRetryingCaller} that will update the per-region stats for the call on return, - * if stats are available - */ -@InterfaceAudience.Private -public class StatsTrackingRpcRetryingCaller implements RpcRetryingCaller { - private final ServerStatisticTracker stats; - private final RpcRetryingCaller delegate; - - public StatsTrackingRpcRetryingCaller(RpcRetryingCaller delegate, - ServerStatisticTracker stats) { - this.delegate = delegate; - this.stats = stats; - } - - @Override - public void cancel() { - delegate.cancel(); - } - - @Override - public T callWithRetries(RetryingCallable callable, int callTimeout) - throws IOException, RuntimeException { - T result = delegate.callWithRetries(callable, callTimeout); - return updateStatsAndUnwrap(result, callable); - } - - @Override - public T callWithoutRetries(RetryingCallable callable, int callTimeout) - throws IOException, RuntimeException { - T result = delegate.callWithRetries(callable, callTimeout); - return updateStatsAndUnwrap(result, callable); - } - - private T updateStatsAndUnwrap(T result, RetryingCallable callable) { - // don't track stats about requests that aren't to regionservers - if (!(callable instanceof RegionServerCallable)) { - return result; - } - - // mutli-server callables span multiple regions, so they don't have a location, - // but they are region server callables, so we have to handle them when we process the - // result in AsyncProcess#receiveMultiAction, not in here - if (callable instanceof MultiServerCallable) { - return result; - } - - // update the stats for the single server callable - RegionServerCallable regionCallable = (RegionServerCallable) callable; - HRegionLocation location = regionCallable.getLocation(); - return ResultStatsUtil.updateStats(result, stats, location); - } -} \ No newline at end of file -- 1.9.3 (Apple Git-50)