hbase git commit: HBASE-18448 Added refresh HFiles coprocessor endpoint

2017-08-24 Thread anoopsamjohn
Repository: hbase
Updated Branches:
  refs/heads/branch-2 99e84a26f -> 81ccef83b


HBASE-18448 Added refresh HFiles coprocessor endpoint

Signed-off-by: anoopsamjohn 


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

Branch: refs/heads/branch-2
Commit: 81ccef83becbd756c05eebace8ebd7eef82b9e85
Parents: 99e84a2
Author: Ajay Jadhav 
Authored: Mon Aug 21 17:24:28 2017 -0700
Committer: anoopsamjohn 
Committed: Fri Aug 25 06:58:18 2017 +0530

--
 .../client/example/RefreshHFilesClient.java |  95 ++
 .../example/RefreshHFilesEndpoint.java  |  86 +
 .../src/main/protobuf/RefreshHFiles.proto   |  36 
 .../example/TestRefreshHFilesEndpoint.java  | 177 +++
 .../hadoop/hbase/HBaseTestingUtility.java   |  18 ++
 5 files changed, 412 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/81ccef83/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
--
diff --git 
a/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
new file mode 100644
index 000..0401959
--- /dev/null
+++ 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.example;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.coprocessor.Batch;
+import org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.protobuf.generated.RefreshHFilesProtos;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * This client class is for invoking the refresh HFile function deployed on the
+ * Region Server side via the RefreshHFilesService.
+ */
+public class RefreshHFilesClient implements Closeable {
+  private static final Log LOG = LogFactory.getLog(RefreshHFilesClient.class);
+  private final Connection connection;
+
+  /**
+   * Constructor with Conf object
+   *
+   * @param cfg
+   */
+  public RefreshHFilesClient(Configuration cfg) {
+try {
+  this.connection = ConnectionFactory.createConnection(cfg);
+} catch (IOException e) {
+  throw new RuntimeException(e);
+}
+  }
+
+  @Override
+  public void close() throws IOException {
+if (this.connection != null && !this.connection.isClosed()) {
+  this.connection.close();
+}
+  }
+
+  public void refreshHFiles(final TableName tableName) throws Throwable {
+try (Table table = connection.getTable(tableName)) {
+  refreshHFiles(table);
+}
+  }
+
+  public void refreshHFiles(final Table table) throws Throwable {
+final RefreshHFilesProtos.RefreshHFilesRequest request = 
RefreshHFilesProtos.RefreshHFilesRequest
+   
.getDefaultInstance();
+table.coprocessorService(RefreshHFilesProtos.RefreshHFilesService.class, 
HConstants.EMPTY_START_ROW,
+ HConstants.EMPTY_END_ROW,
+ new 
Batch.Call() {
+   

hbase git commit: HBASE-18448 Added refresh HFiles coprocessor endpoint

2017-08-24 Thread anoopsamjohn
Repository: hbase
Updated Branches:
  refs/heads/master 1a2c38b96 -> 98bb5c05e


HBASE-18448 Added refresh HFiles coprocessor endpoint

Signed-off-by: anoopsamjohn 


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

Branch: refs/heads/master
Commit: 98bb5c05e3cfcd90f2a3a25902f1eff8d8d37619
Parents: 1a2c38b
Author: Ajay Jadhav 
Authored: Mon Aug 21 17:24:28 2017 -0700
Committer: anoopsamjohn 
Committed: Fri Aug 25 06:56:41 2017 +0530

--
 .../client/example/RefreshHFilesClient.java |  95 ++
 .../example/RefreshHFilesEndpoint.java  |  86 +
 .../src/main/protobuf/RefreshHFiles.proto   |  36 
 .../example/TestRefreshHFilesEndpoint.java  | 177 +++
 .../hadoop/hbase/HBaseTestingUtility.java   |  18 ++
 5 files changed, 412 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/98bb5c05/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
--
diff --git 
a/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
new file mode 100644
index 000..0401959
--- /dev/null
+++ 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.example;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.coprocessor.Batch;
+import org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.protobuf.generated.RefreshHFilesProtos;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * This client class is for invoking the refresh HFile function deployed on the
+ * Region Server side via the RefreshHFilesService.
+ */
+public class RefreshHFilesClient implements Closeable {
+  private static final Log LOG = LogFactory.getLog(RefreshHFilesClient.class);
+  private final Connection connection;
+
+  /**
+   * Constructor with Conf object
+   *
+   * @param cfg
+   */
+  public RefreshHFilesClient(Configuration cfg) {
+try {
+  this.connection = ConnectionFactory.createConnection(cfg);
+} catch (IOException e) {
+  throw new RuntimeException(e);
+}
+  }
+
+  @Override
+  public void close() throws IOException {
+if (this.connection != null && !this.connection.isClosed()) {
+  this.connection.close();
+}
+  }
+
+  public void refreshHFiles(final TableName tableName) throws Throwable {
+try (Table table = connection.getTable(tableName)) {
+  refreshHFiles(table);
+}
+  }
+
+  public void refreshHFiles(final Table table) throws Throwable {
+final RefreshHFilesProtos.RefreshHFilesRequest request = 
RefreshHFilesProtos.RefreshHFilesRequest
+   
.getDefaultInstance();
+table.coprocessorService(RefreshHFilesProtos.RefreshHFilesService.class, 
HConstants.EMPTY_START_ROW,
+ HConstants.EMPTY_END_ROW,
+ new 
Batch.Call() {
+   

hbase git commit: HBASE-18448 Added refresh HFiles coprocessor endpoint

2017-08-24 Thread stack
Repository: hbase
Updated Branches:
  refs/heads/branch-1.4 32bc800bf -> 75ab445eb


HBASE-18448 Added refresh HFiles coprocessor endpoint

Signed-off-by: Michael Stack 


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

Branch: refs/heads/branch-1.4
Commit: 75ab445eb1f99f1f44382a71b5f681aeb395c2db
Parents: 32bc800
Author: Ajay Jadhav 
Authored: Mon Aug 21 16:31:15 2017 -0700
Committer: Michael Stack 
Committed: Thu Aug 24 16:38:52 2017 -0700

--
 hbase-examples/pom.xml  |   1 +
 .../client/example/RefreshHFilesClient.java |  95 ++
 .../example/RefreshHFilesEndpoint.java  |  86 ++
 .../protobuf/generated/RefreshHFilesProtos.java | 973 +++
 .../src/main/protobuf/RefreshHFiles.proto   |  36 +
 .../example/TestRefreshHFilesEndpoint.java  | 180 
 .../hadoop/hbase/HBaseTestingUtility.java   |  18 +
 7 files changed, 1389 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/75ab445e/hbase-examples/pom.xml
--
diff --git a/hbase-examples/pom.xml b/hbase-examples/pom.xml
index a3d16e0..0a8be15 100644
--- a/hbase-examples/pom.xml
+++ b/hbase-examples/pom.xml
@@ -305,6 +305,7 @@ if we can combine these profiles somehow -->
 
   BulkDelete.proto
   Examples.proto
+  RefreshHFiles.proto
 
   
   ${basedir}/src/main/java/

http://git-wip-us.apache.org/repos/asf/hbase/blob/75ab445e/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
--
diff --git 
a/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
new file mode 100644
index 000..38f0362
--- /dev/null
+++ 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.example;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.coprocessor.Batch;
+import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.protobuf.generated.RefreshHFilesProtos;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * This client class is for invoking the refresh HFile function deployed on the
+ * Region Server side via the RefreshHFilesService.
+ */
+public class RefreshHFilesClient implements Closeable {
+  private static final Log LOG = LogFactory.getLog(RefreshHFilesClient.class);
+  private final Connection connection;
+
+  /**
+   * Constructor with Conf object
+   *
+   * @param cfg
+   */
+  public RefreshHFilesClient(Configuration cfg) {
+try {
+  this.connection = ConnectionFactory.createConnection(cfg);
+} catch (IOException e) {
+  throw new RuntimeException(e);
+}
+  }
+
+  @Override
+  public void close() throws IOException {
+if (this.connection != null && !this.connection.isClosed()) {
+  this.connection.close();
+}
+  }
+
+  public void refreshHFiles(final TableName tableName) throws Throwable {
+try (Table table = connection.getTable(tableName)) {
+  

hbase git commit: HBASE-18448 Added refresh HFiles coprocessor endpoint

2017-08-24 Thread stack
Repository: hbase
Updated Branches:
  refs/heads/branch-1 9c26a42ab -> 7d605fe9c


HBASE-18448 Added refresh HFiles coprocessor endpoint

Signed-off-by: Michael Stack 


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

Branch: refs/heads/branch-1
Commit: 7d605fe9c2ebd0e98a9e14067a6b44d117fb53eb
Parents: 9c26a42
Author: Ajay Jadhav 
Authored: Mon Aug 21 16:31:15 2017 -0700
Committer: Michael Stack 
Committed: Thu Aug 24 16:05:04 2017 -0700

--
 hbase-examples/pom.xml  |   1 +
 .../client/example/RefreshHFilesClient.java |  95 ++
 .../example/RefreshHFilesEndpoint.java  |  86 ++
 .../protobuf/generated/RefreshHFilesProtos.java | 973 +++
 .../src/main/protobuf/RefreshHFiles.proto   |  36 +
 .../example/TestRefreshHFilesEndpoint.java  | 180 
 .../hadoop/hbase/HBaseTestingUtility.java   |  18 +
 7 files changed, 1389 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/7d605fe9/hbase-examples/pom.xml
--
diff --git a/hbase-examples/pom.xml b/hbase-examples/pom.xml
index a100ab2..c93c39e 100644
--- a/hbase-examples/pom.xml
+++ b/hbase-examples/pom.xml
@@ -305,6 +305,7 @@ if we can combine these profiles somehow -->
 
   BulkDelete.proto
   Examples.proto
+  RefreshHFiles.proto
 
   
   ${basedir}/src/main/java/

http://git-wip-us.apache.org/repos/asf/hbase/blob/7d605fe9/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
--
diff --git 
a/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
new file mode 100644
index 000..38f0362
--- /dev/null
+++ 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.example;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.coprocessor.Batch;
+import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.protobuf.generated.RefreshHFilesProtos;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * This client class is for invoking the refresh HFile function deployed on the
+ * Region Server side via the RefreshHFilesService.
+ */
+public class RefreshHFilesClient implements Closeable {
+  private static final Log LOG = LogFactory.getLog(RefreshHFilesClient.class);
+  private final Connection connection;
+
+  /**
+   * Constructor with Conf object
+   *
+   * @param cfg
+   */
+  public RefreshHFilesClient(Configuration cfg) {
+try {
+  this.connection = ConnectionFactory.createConnection(cfg);
+} catch (IOException e) {
+  throw new RuntimeException(e);
+}
+  }
+
+  @Override
+  public void close() throws IOException {
+if (this.connection != null && !this.connection.isClosed()) {
+  this.connection.close();
+}
+  }
+
+  public void refreshHFiles(final TableName tableName) throws Throwable {
+try (Table table = connection.getTable(tableName)) {
+  

hbase git commit: HBASE-18448 Added refresh HFiles coprocessor endpoint

2017-08-24 Thread anoopsamjohn
Repository: hbase
Updated Branches:
  refs/heads/branch-2 08212e50f -> e5a8f162a


HBASE-18448 Added refresh HFiles coprocessor endpoint

Signed-off-by: anoopsamjohn 


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

Branch: refs/heads/branch-2
Commit: e5a8f162a2ded86b42f40650d879fb730afb84dc
Parents: 08212e5
Author: Ajay Jadhav 
Authored: Mon Aug 21 17:24:28 2017 -0700
Committer: anoopsamjohn 
Committed: Thu Aug 24 20:44:45 2017 +0530

--
 .../client/example/RefreshHFilesClient.java |  95 ++
 .../example/RefreshHFilesEndpoint.java  |  86 +
 .../src/main/protobuf/RefreshHFiles.proto   |  36 
 .../example/TestRefreshHFilesEndpoint.java  | 177 +++
 .../hadoop/hbase/HBaseTestingUtility.java   |  18 ++
 5 files changed, 412 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/e5a8f162/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
--
diff --git 
a/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
new file mode 100644
index 000..0401959
--- /dev/null
+++ 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.example;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.coprocessor.Batch;
+import org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.protobuf.generated.RefreshHFilesProtos;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * This client class is for invoking the refresh HFile function deployed on the
+ * Region Server side via the RefreshHFilesService.
+ */
+public class RefreshHFilesClient implements Closeable {
+  private static final Log LOG = LogFactory.getLog(RefreshHFilesClient.class);
+  private final Connection connection;
+
+  /**
+   * Constructor with Conf object
+   *
+   * @param cfg
+   */
+  public RefreshHFilesClient(Configuration cfg) {
+try {
+  this.connection = ConnectionFactory.createConnection(cfg);
+} catch (IOException e) {
+  throw new RuntimeException(e);
+}
+  }
+
+  @Override
+  public void close() throws IOException {
+if (this.connection != null && !this.connection.isClosed()) {
+  this.connection.close();
+}
+  }
+
+  public void refreshHFiles(final TableName tableName) throws Throwable {
+try (Table table = connection.getTable(tableName)) {
+  refreshHFiles(table);
+}
+  }
+
+  public void refreshHFiles(final Table table) throws Throwable {
+final RefreshHFilesProtos.RefreshHFilesRequest request = 
RefreshHFilesProtos.RefreshHFilesRequest
+   
.getDefaultInstance();
+table.coprocessorService(RefreshHFilesProtos.RefreshHFilesService.class, 
HConstants.EMPTY_START_ROW,
+ HConstants.EMPTY_END_ROW,
+ new 
Batch.Call() {
+   

hbase git commit: HBASE-18448 Added refresh HFiles coprocessor endpoint

2017-08-24 Thread anoopsamjohn
Repository: hbase
Updated Branches:
  refs/heads/master 321bc55f9 -> 612c23556


HBASE-18448 Added refresh HFiles coprocessor endpoint

Signed-off-by: anoopsamjohn 


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

Branch: refs/heads/master
Commit: 612c23556d4d2b6ef609ce7c487efa9bed35e145
Parents: 321bc55
Author: Ajay Jadhav 
Authored: Mon Aug 21 17:24:28 2017 -0700
Committer: anoopsamjohn 
Committed: Thu Aug 24 20:42:49 2017 +0530

--
 .../client/example/RefreshHFilesClient.java |  95 ++
 .../example/RefreshHFilesEndpoint.java  |  86 +
 .../src/main/protobuf/RefreshHFiles.proto   |  36 
 .../example/TestRefreshHFilesEndpoint.java  | 177 +++
 .../hadoop/hbase/HBaseTestingUtility.java   |  18 ++
 5 files changed, 412 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/612c2355/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
--
diff --git 
a/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
new file mode 100644
index 000..0401959
--- /dev/null
+++ 
b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/RefreshHFilesClient.java
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.example;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.coprocessor.Batch;
+import org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils.BlockingRpcCallback;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.protobuf.generated.RefreshHFilesProtos;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * This client class is for invoking the refresh HFile function deployed on the
+ * Region Server side via the RefreshHFilesService.
+ */
+public class RefreshHFilesClient implements Closeable {
+  private static final Log LOG = LogFactory.getLog(RefreshHFilesClient.class);
+  private final Connection connection;
+
+  /**
+   * Constructor with Conf object
+   *
+   * @param cfg
+   */
+  public RefreshHFilesClient(Configuration cfg) {
+try {
+  this.connection = ConnectionFactory.createConnection(cfg);
+} catch (IOException e) {
+  throw new RuntimeException(e);
+}
+  }
+
+  @Override
+  public void close() throws IOException {
+if (this.connection != null && !this.connection.isClosed()) {
+  this.connection.close();
+}
+  }
+
+  public void refreshHFiles(final TableName tableName) throws Throwable {
+try (Table table = connection.getTable(tableName)) {
+  refreshHFiles(table);
+}
+  }
+
+  public void refreshHFiles(final Table table) throws Throwable {
+final RefreshHFilesProtos.RefreshHFilesRequest request = 
RefreshHFilesProtos.RefreshHFilesRequest
+   
.getDefaultInstance();
+table.coprocessorService(RefreshHFilesProtos.RefreshHFilesService.class, 
HConstants.EMPTY_START_ROW,
+ HConstants.EMPTY_END_ROW,
+ new 
Batch.Call() {
+