hbase git commit: HBASE-16607 Make NoncedRegionServerCallable extend CancellableRegionServerCallable

2016-09-11 Thread chenheng
Repository: hbase
Updated Branches:
  refs/heads/master 2c3b0f2c0 -> c19d2cabb


HBASE-16607 Make NoncedRegionServerCallable extend 
CancellableRegionServerCallable


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c19d2cab
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c19d2cab
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c19d2cab

Branch: refs/heads/master
Commit: c19d2cabbd4c6e312e4926f72d348a5e554cd3dd
Parents: 2c3b0f2
Author: chenheng 
Authored: Mon Sep 12 11:03:29 2016 +0800
Committer: chenheng 
Committed: Mon Sep 12 11:03:29 2016 +0800

--
 .../org/apache/hadoop/hbase/client/HTable.java  | 52 +++---
 .../client/NoncedRegionServerCallable.java  | 74 ++--
 2 files changed, 31 insertions(+), 95 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/c19d2cab/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
--
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
index e98424c..0d1b156 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
@@ -630,17 +630,17 @@ public class HTable implements Table {
   public Result append(final Append append) throws IOException {
 checkHasFamilies(append);
 NoncedRegionServerCallable callable =
-new NoncedRegionServerCallable(this.connection,
-this.rpcControllerFactory, getName(), append.getRow()) {
-  @Override
-  protected Result call(HBaseRpcController controller) throws Exception {
-MutateRequest request = RequestConverter.buildMutateRequest(
-  getLocation().getRegionInfo().getRegionName(), append, 
getNonceGroup(), getNonce());
-MutateResponse response = getStub().mutate(controller, request);
-if (!response.hasResult()) return null;
-return ProtobufUtil.toResult(response.getResult(), 
controller.cellScanner());
-  }
-};
+new NoncedRegionServerCallable(this.connection, 
this.rpcControllerFactory,
+getName(), append.getRow()) {
+  @Override
+  protected Result rpcCall() throws Exception {
+MutateRequest request = RequestConverter.buildMutateRequest(
+  getLocation().getRegionInfo().getRegionName(), append, 
getNonceGroup(), getNonce());
+MutateResponse response = getStub().mutate(getRpcController(), 
request);
+if (!response.hasResult()) return null;
+return ProtobufUtil.toResult(response.getResult(), 
getRpcControllerCellScanner());
+  }
+};
 return rpcCallerFactory. newCaller(this.writeRpcTimeout).
 callWithRetries(callable, this.operationTimeout);
   }
@@ -652,16 +652,16 @@ public class HTable implements Table {
   public Result increment(final Increment increment) throws IOException {
 checkHasFamilies(increment);
 NoncedRegionServerCallable callable =
-new NoncedRegionServerCallable(this.connection,
-this.rpcControllerFactory, getName(), increment.getRow()) {
-  @Override
-  protected Result call(HBaseRpcController controller) throws Exception {
-MutateRequest request = RequestConverter.buildMutateRequest(
-  getLocation().getRegionInfo().getRegionName(), increment, 
getNonceGroup(), getNonce());
-MutateResponse response = getStub().mutate(controller, request);
-// Should this check for null like append does?
-return ProtobufUtil.toResult(response.getResult(), 
controller.cellScanner());
-  }
+  new NoncedRegionServerCallable(this.connection,
+  this.rpcControllerFactory, getName(), increment.getRow()) {
+@Override
+protected Result rpcCall() throws Exception {
+  MutateRequest request = RequestConverter.buildMutateRequest(
+getLocation().getRegionInfo().getRegionName(), increment, 
getNonceGroup(), getNonce());
+  MutateResponse response = getStub().mutate(getRpcController(), 
request);
+  // Should this check for null like append does?
+  return ProtobufUtil.toResult(response.getResult(), 
getRpcControllerCellScanner());
+}
 };
 return rpcCallerFactory. 
newCaller(writeRpcTimeout).callWithRetries(callable,
 this.operationTimeout);
@@ -701,12 +701,12 @@ public class HTable implements Table {
 new NoncedRegionServerCallable(this.connection, 
this.rpcControllerFactory, getName(),
 row) {
   @Override
-  protected Long call(HBaseRpcController controller) throws Exception {
+  

hbase git commit: HBASE-16606 Remove some duplicate code in HTable

2016-09-11 Thread chenheng
Repository: hbase
Updated Branches:
  refs/heads/master 7bda5151e -> 2c3b0f2c0


HBASE-16606 Remove some duplicate code in HTable


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2c3b0f2c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2c3b0f2c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2c3b0f2c

Branch: refs/heads/master
Commit: 2c3b0f2c0b2d47dfd3a22e1f47f7eb1317d3514f
Parents: 7bda515
Author: chenheng 
Authored: Mon Sep 12 10:57:21 2016 +0800
Committer: chenheng 
Committed: Mon Sep 12 10:57:21 2016 +0800

--
 .../org/apache/hadoop/hbase/client/HTable.java  | 44 +---
 1 file changed, 10 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/2c3b0f2c/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
--
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
index 492714f..e98424c 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
@@ -479,16 +479,18 @@ public class HTable implements Table {
   @Override
   public void batch(final List actions, final Object[] results)
   throws InterruptedException, IOException {
-AsyncRequestFuture ars = multiAp.submitAll(pool, tableName, actions, null, 
results);
-ars.waitUntilDone();
-if (ars.hasError()) {
-  throw ars.getErrors();
-}
+batch(actions, results, -1);
   }
 
   public void batch(final List actions, final Object[] results, 
int timeout)
   throws InterruptedException, IOException {
-AsyncRequestFuture ars = multiAp.submitAll(pool, tableName, actions, null, 
results, null, timeout);
+AsyncRequestFuture ars = null;
+if (timeout != -1) {
+  ars = multiAp.submitAll(pool, tableName, actions, null, results, null, 
timeout);
+} else {
+  // use default timeout in AP
+  ars = multiAp.submitAll(pool, tableName, actions, null, results);
+}
 ars.waitUntilDone();
 if (ars.hasError()) {
   throw ars.getErrors();
@@ -720,20 +722,7 @@ public class HTable implements Table {
   final byte [] family, final byte [] qualifier, final byte [] value,
   final Put put)
   throws IOException {
-RegionServerCallable callable =
-new RegionServerCallable(this.connection, 
this.rpcControllerFactory,
-getName(), row) {
-  @Override
-  protected Boolean rpcCall() throws Exception {
-MutateRequest request = RequestConverter.buildMutateRequest(
-  getLocation().getRegionInfo().getRegionName(), row, family, 
qualifier,
-  new BinaryComparator(value), CompareType.EQUAL, put);
-MutateResponse response = getStub().mutate(getRpcController(), 
request);
-return Boolean.valueOf(response.getProcessed());
-  }
-};
-return rpcCallerFactory. newCaller(this.writeRpcTimeout).
-callWithRetries(callable, this.operationTimeout);
+return checkAndPut(row, family, qualifier, CompareOp.EQUAL, value, put);
   }
 
   /**
@@ -768,20 +757,7 @@ public class HTable implements Table {
   public boolean checkAndDelete(final byte [] row, final byte [] family, final 
byte [] qualifier,
   final byte [] value, final Delete delete)
   throws IOException {
-RegionServerCallable callable =
-new RegionServerCallable(this.connection, 
this.rpcControllerFactory,
-getName(), row) {
-  @Override
-  protected Boolean rpcCall() throws Exception {
-MutateRequest request = RequestConverter.buildMutateRequest(
-  getLocation().getRegionInfo().getRegionName(), row, family, 
qualifier,
-  new BinaryComparator(value), CompareType.EQUAL, delete);
-MutateResponse response = getStub().mutate(getRpcController(), 
request);
-return Boolean.valueOf(response.getProcessed());
-  }
-};
-return rpcCallerFactory. newCaller(this.writeRpcTimeout).
-callWithRetries(callable, this.operationTimeout);
+return checkAndDelete(row, family, qualifier, CompareOp.EQUAL, value, 
delete);
   }
 
   /**



hbase git commit: HBASE-16603 Detect unavailability of hbase:backup table to avoid extraneous logging

2016-09-11 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/HBASE-7912 260fafe53 -> e2b40ddb4


HBASE-16603 Detect unavailability of hbase:backup table to avoid extraneous 
logging


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e2b40ddb
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e2b40ddb
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e2b40ddb

Branch: refs/heads/HBASE-7912
Commit: e2b40ddb4f3c3e218f75cec1c8f86de654f0ae98
Parents: 260fafe
Author: tedyu 
Authored: Sun Sep 11 18:36:25 2016 -0700
Committer: tedyu 
Committed: Sun Sep 11 18:36:25 2016 -0700

--
 .../hadoop/hbase/backup/master/BackupLogCleaner.java  | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/e2b40ddb/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/BackupLogCleaner.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/BackupLogCleaner.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/BackupLogCleaner.java
index 04a91a6..1f1fe32 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/BackupLogCleaner.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/BackupLogCleaner.java
@@ -28,6 +28,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableNotFoundException;
 import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
@@ -64,8 +65,13 @@ public class BackupLogCleaner extends BaseLogCleanerDelegate 
{
 try (final Connection conn = ConnectionFactory.createConnection(getConf());
 final BackupSystemTable table = new BackupSystemTable(conn)) {
   // If we do not have recorded backup sessions
-  if (!table.hasBackupSessions()) {
-LOG.debug("BackupLogCleaner has no backup sessions");
+  try {
+if (!table.hasBackupSessions()) {
+  LOG.debug("BackupLogCleaner has no backup sessions");
+  return files;
+}
+  } catch (TableNotFoundException tnfe) {
+LOG.warn("hbase:backup is not available" + tnfe.getMessage());
 return files;
   }
   



hbase git commit: HBASE-16591 Add a docker file only contains java 8 for running pre commit on master

2016-09-11 Thread zhangduo
Repository: hbase
Updated Branches:
  refs/heads/master 80d8b2100 -> 7bda5151e


HBASE-16591 Add a docker file only contains java 8 for running pre commit on 
master


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7bda5151
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7bda5151
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7bda5151

Branch: refs/heads/master
Commit: 7bda5151eee2febc03a8e0434705e0aa2d6a8c34
Parents: 80d8b21
Author: zhangduo 
Authored: Sat Sep 10 07:52:54 2016 +0800
Committer: zhangduo 
Committed: Sun Sep 11 13:02:36 2016 +0800

--
 dev-support/docker/Dockerfile | 139 +
 1 file changed, 139 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/7bda5151/dev-support/docker/Dockerfile
--
diff --git a/dev-support/docker/Dockerfile b/dev-support/docker/Dockerfile
new file mode 100644
index 000..44e2a58
--- /dev/null
+++ b/dev-support/docker/Dockerfile
@@ -0,0 +1,139 @@
+
+# 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.
+
+# Dockerfile for installing the necessary dependencies for building Hadoop.
+# See BUILDING.txt.
+
+
+FROM ubuntu:trusty
+
+WORKDIR /root
+
+ENV DEBIAN_FRONTEND noninteractive
+ENV DEBCONF_TERSE true
+
+##
+# Install common dependencies from packages
+#
+# WARNING: DO NOT PUT JAVA APPS HERE! Otherwise they will install default
+# Ubuntu Java.  See Java section below!
+##
+RUN apt-get -q update && apt-get -q install --no-install-recommends -y \
+build-essential \
+bzip2 \
+cmake \
+curl \
+doxygen \
+fuse \
+g++ \
+gcc \
+git \
+gnupg-agent \
+make \
+libbz2-dev \
+libcurl4-openssl-dev \
+libfuse-dev \
+libprotobuf-dev \
+libprotoc-dev \
+libsnappy-dev \
+libssl-dev \
+libtool \
+pinentry-curses \
+pkg-config \
+protobuf-compiler \
+protobuf-c-compiler \
+python \
+python2.7 \
+python-pip \
+rsync \
+snappy \
+zlib1g-dev
+
+###
+# Oracle Java
+###
+
+RUN echo "dot_style = mega" > "/root/.wgetrc"
+RUN echo "quiet = on" >> "/root/.wgetrc"
+
+RUN apt-get -q install --no-install-recommends -y software-properties-common
+RUN add-apt-repository -y ppa:webupd8team/java
+RUN apt-get -q update
+
+# Auto-accept the Oracle JDK license
+RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select 
true | sudo /usr/bin/debconf-set-selections
+RUN apt-get -q install --no-install-recommends -y oracle-java8-installer
+
+
+# Apps that require Java
+###
+RUN apt-get -q update && apt-get -q install --no-install-recommends -y \
+ant \
+maven
+
+# Fixing the Apache commons / Maven dependency problem under Ubuntu:
+# See http://wiki.apache.org/commons/VfsProblems
+RUN cd /usr/share/maven/lib && ln -s ../../java/commons-lang.jar .
+
+##
+# Install findbugs
+##
+RUN mkdir -p /opt/findbugs && \
+curl -L -s -S \
+ 
https://sourceforge.net/projects/findbugs/files/findbugs/3.0.1/findbugs-noUpdateChecks-3.0.1.tar.gz/download
 \
+ -o /opt/findbugs.tar.gz && \
+tar xzf /opt/findbugs.tar.gz --strip-components 1 -C /opt/findbugs
+ENV FINDBUGS_HOME /opt/findbugs
+
+
+# Install shellcheck
+
+RUN apt-get -q install -y cabal-install
+RUN mkdir /root/.cabal
+RUN echo "remote-repo: hackage.fpcomplete.com:http://hackage.fpcomplete.com/; 
>> /root/.cabal/config
+#RUN echo "remote-repo: hackage.haskell.org:http://hackage.haskell.org/; > 
/root/.cabal/config
+RUN echo "remote-repo-cache: /root/.cabal/packages" >> /root/.cabal/config
+RUN cabal update
+RUN cabal install shellcheck --global
+
+
+# Install bats
+
+RUN add-apt-repository -y ppa:duggan/bats
+RUN apt-get -q update
+RUN apt-get -q install --no-install-recommends -y bats
+
+
+# Install pylint
+
+RUN pip install pylint
+
+
+# Install dateutil.parser
+
+RUN pip install python-dateutil
+
+###
+# Avoid out of memory errors in