Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0B3171860C for ; Fri, 15 Jan 2016 18:24:38 +0000 (UTC) Received: (qmail 29286 invoked by uid 500); 15 Jan 2016 18:24:37 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 29245 invoked by uid 500); 15 Jan 2016 18:24:37 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 29236 invoked by uid 99); 15 Jan 2016 18:24:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jan 2016 18:24:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C1855E01BA; Fri, 15 Jan 2016 18:24:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stack@apache.org To: commits@hbase.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: v1 Date: Fri, 15 Jan 2016 18:24:37 +0000 (UTC) Repository: hbase Updated Branches: refs/heads/master cb17c7a97 -> c516968b8 v1 Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c516968b Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c516968b Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c516968b Branch: refs/heads/master Commit: c516968b8ccd478dcefff07d5f1d82480231c029 Parents: cb17c7a Author: stack Authored: Fri Jan 15 10:15:05 2016 -0800 Committer: stack Committed: Fri Jan 15 10:15:05 2016 -0800 ---------------------------------------------------------------------- .../hadoop/hbase/client/HConnectable.java | 50 -------------------- .../hadoop/hbase/client/MetricsConnection.java | 2 +- .../hbase/client/RetriesExhaustedException.java | 3 +- .../RetryingCallerInterceptorFactory.java | 2 + .../hadoop/hbase/filter/BinaryComparator.java | 2 +- .../hbase/filter/BinaryPrefixComparator.java | 2 +- .../hadoop/hbase/filter/FuzzyRowFilter.java | 8 +--- .../hadoop/hbase/filter/LongComparator.java | 2 - .../hbase/filter/MultiRowRangeFilter.java | 2 + .../apache/hadoop/hbase/ipc/RpcClientImpl.java | 24 +++++++--- .../hadoop/hbase/protobuf/RequestConverter.java | 2 +- 11 files changed, 28 insertions(+), 71 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectable.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectable.java deleted file mode 100644 index f5f841d..0000000 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectable.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright The Apache Software Foundation - * - * 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 java.io.IOException; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.classification.InterfaceAudience; - -/** - * This class makes it convenient for one to execute a command in the context - * of a {@link HConnection} instance based on the given {@link Configuration}. - * - *

- * If you find yourself wanting to use a {@link HConnection} for a relatively - * short duration of time, and do not want to deal with the hassle of creating - * and cleaning up that resource, then you should consider using this - * convenience class. - * - * @param - * the return type of the {@link HConnectable#connect(HConnection)} - * method. - */ -@InterfaceAudience.Private -public abstract class HConnectable { - protected Configuration conf; - - protected HConnectable(Configuration conf) { - this.conf = conf; - } - - public abstract T connect(HConnection connection) throws IOException; -} http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java index 4fdc587..6a292bc 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java @@ -105,7 +105,7 @@ public class MetricsConnection { } @VisibleForTesting - protected final class CallTracker { + protected static final class CallTracker { private final String name; @VisibleForTesting final Timer callTimer; @VisibleForTesting final Histogram reqHist; http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java index a452bbc..dc25f64 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java @@ -85,8 +85,7 @@ public class RetriesExhaustedException extends IOException { public RetriesExhaustedException(final int numRetries, final List exceptions) { super(getMessage(numRetries, exceptions), - (exceptions != null && !exceptions.isEmpty() ? - exceptions.get(exceptions.size() - 1).t : null)); + exceptions.isEmpty()? null: exceptions.get(exceptions.size() - 1).t); } private static String getMessage(String callableVitals, int numTries, http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallerInterceptorFactory.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallerInterceptorFactory.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallerInterceptorFactory.java index 15475f8..5a70582 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallerInterceptorFactory.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallerInterceptorFactory.java @@ -59,6 +59,8 @@ class RetryingCallerInterceptorFactory { * {@link RetryingCallerInterceptor} object according to the * configuration. */ + @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="REC_CATCH_EXCEPTION", + justification="Convert thrown exception to unchecked") public RetryingCallerInterceptor build() { RetryingCallerInterceptor ret = NO_OP_INTERCEPTOR; if (failFast) { http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java index 0f2ed2b..3cbb7b9 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java @@ -53,7 +53,7 @@ public class BinaryComparator extends ByteArrayComparable { @Override public int compareTo(ByteBuffer value, int offset, int length) { - return -(ByteBufferUtils.compareTo(value, offset, length, this.value, 0, this.value.length)); + return ByteBufferUtils.compareTo(this.value, 0, this.value.length, value, offset, length); } /** http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java index c4d5197..a26edbc 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java @@ -58,7 +58,7 @@ public class BinaryPrefixComparator extends ByteArrayComparable { if (this.value.length <= length) { length = this.value.length; } - return -(ByteBufferUtils.compareTo(value, offset, length, this.value, 0, this.value.length)); + return ByteBufferUtils.compareTo(this.value, 0, this.value.length, value, offset, length); } /** http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java index e31f0b5..0f01fb7 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java @@ -189,12 +189,8 @@ public class FuzzyRowFilter extends FilterBase { @Override public int compare(Pair> o1, Pair> o2) { - int compare = Bytes.compareTo(o1.getFirst(), o2.getFirst()); - if (!isReversed()) { - return compare; - } else { - return -compare; - } + return isReversed()? Bytes.compareTo(o2.getFirst(), o1.getFirst()): + Bytes.compareTo(o1.getFirst(), o2.getFirst()); } }); } http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java index fd456e4..9c56772 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/LongComparator.java @@ -89,8 +89,6 @@ public class LongComparator extends ByteArrayComparable { */ boolean areSerializedFieldsEqual(LongComparator other) { if (other == this) return true; - if (!(other instanceof LongComparator)) return false; - return super.areSerializedFieldsEqual(other); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java index e5ce27c..5f9c833 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java @@ -503,6 +503,8 @@ public class MultiRowRangeFilter extends FilterBase { } @Override + @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="EQ_COMPARETO_USE_OBJECT_EQUALS", + justification="This compareTo is not of this Object, but of referenced RowRange") public int compareTo(RowRange other) { return Bytes.compareTo(this.startRow, other.startRow); } http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java index ca8a149..940fcd1 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java @@ -383,7 +383,7 @@ public class RpcClientImpl extends AbstractRpcClient { } } - private UserInformation getUserInfo(UserGroupInformation ugi) { + private synchronized UserInformation getUserInfo(UserGroupInformation ugi) { if (ugi == null || authMethod == AuthMethod.DIGEST) { // Don't send user for token auth return null; @@ -804,7 +804,9 @@ public class RpcClientImpl extends AbstractRpcClient { byte [] preamble = new byte [rpcHeaderLen + 2]; System.arraycopy(HConstants.RPC_HEADER, 0, preamble, 0, rpcHeaderLen); preamble[rpcHeaderLen] = HConstants.RPC_CURRENT_VERSION; - preamble[rpcHeaderLen + 1] = authMethod.code; + synchronized (this) { + preamble[rpcHeaderLen + 1] = authMethod.code; + } outStream.write(preamble); outStream.flush(); } @@ -880,6 +882,8 @@ public class RpcClientImpl extends AbstractRpcClient { * threads. * @see #readResponse() */ + @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="IS2_INCONSISTENT_SYNC", + justification="Findbugs is misinterpreting locking missing fact that this.outLock is held") private void writeRequest(Call call, final int priority, Span span) throws IOException { RequestHeader.Builder builder = RequestHeader.newBuilder(); builder.setCallId(call.id); @@ -913,8 +917,8 @@ public class RpcClientImpl extends AbstractRpcClient { checkIsOpen(); // Now we're checking that it didn't became idle in between. try { - call.callStats.setRequestSizeBytes( - IPCUtil.write(this.out, header, call.param, cellBlock)); + call.callStats.setRequestSizeBytes(IPCUtil.write(this.out, header, call.param, + cellBlock)); } catch (IOException e) { // We set the value inside the synchronized block, this way the next in line // won't even try to write. Otherwise we might miss a call in the calls map? @@ -932,14 +936,20 @@ public class RpcClientImpl extends AbstractRpcClient { // We added a call, and may be started the connection close. In both cases, we // need to notify the reader. - synchronized (this) { - notifyAll(); - } + doNotify(); // Now that we notified, we can rethrow the exception if any. Otherwise we're good. if (writeException != null) throw writeException; } + @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NN_NAKED_NOTIFY", + justification="Presume notifyAll is because we are closing/shutting down") + private synchronized void doNotify() { + // Make a separate method so can do synchronize and add findbugs annotation; only one + // annotation at at time in source 1.7. + notifyAll(); // Findbugs: NN_NAKED_NOTIFY + } + /* Receive a response. * Because only one receiver, so no synchronization on in. */ http://git-wip-us.apache.org/repos/asf/hbase/blob/c516968b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java index bd4c427..9d659fc 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java @@ -463,7 +463,7 @@ public final class RequestConverter { builder.setScan(ProtobufUtil.toScan(scan)); builder.setClientHandlesPartials(true); builder.setClientHandlesHeartbeats(true); - builder.setTrackScanMetrics(scan != null && scan.isScanMetricsEnabled()); + builder.setTrackScanMetrics(scan.isScanMetricsEnabled()); return builder.build(); }