[1/3] hbase git commit: HBASE-17616 Incorrect actions performed by CM

2017-02-09 Thread apurtell
Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 a8158b550 -> 3e28384b4
  refs/heads/branch-1.2 0976b8693 -> 7bfb930a8
  refs/heads/branch-1.3 6ca86b981 -> 906b364da


HBASE-17616 Incorrect actions performed by CM

Signed-off-by: tedyu 


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

Branch: refs/heads/branch-1.3
Commit: 906b364dac8239c4136ece4421a4717ec95a49de
Parents: 6ca86b9
Author: Abhishek Singh Chouhan 
Authored: Thu Feb 9 15:31:18 2017 +0530
Committer: Andrew Purtell 
Committed: Thu Feb 9 15:09:53 2017 -0800

--
 .../test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/906b364d/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
--
diff --git 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
index 2a5ae55..ce9ca70 100644
--- 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
+++ 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
@@ -269,7 +269,7 @@ public class DistributedHBaseCluster extends HBaseCluster {
   public ServerName getServerHoldingRegion(TableName tn, byte[] regionName) 
throws IOException {
 HRegionLocation regionLoc = null;
 try (RegionLocator locator = connection.getRegionLocator(tn)) {
-  regionLoc = locator.getRegionLocation(regionName);
+  regionLoc = locator.getRegionLocation(regionName, true);
 }
 if (regionLoc == null) {
   LOG.warn("Cannot find region server holding region " + 
Bytes.toString(regionName) +



[3/3] hbase git commit: HBASE-17616 Incorrect actions performed by CM

2017-02-09 Thread apurtell
HBASE-17616 Incorrect actions performed by CM

Signed-off-by: tedyu 


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

Branch: refs/heads/branch-1.1
Commit: 3e28384b47eb41f12f7a483ac4442633030a7b23
Parents: a8158b5
Author: Abhishek Singh Chouhan 
Authored: Thu Feb 9 15:31:18 2017 +0530
Committer: Andrew Purtell 
Committed: Thu Feb 9 15:10:01 2017 -0800

--
 .../test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/3e28384b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
--
diff --git 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
index 2a5ae55..ce9ca70 100644
--- 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
+++ 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
@@ -269,7 +269,7 @@ public class DistributedHBaseCluster extends HBaseCluster {
   public ServerName getServerHoldingRegion(TableName tn, byte[] regionName) 
throws IOException {
 HRegionLocation regionLoc = null;
 try (RegionLocator locator = connection.getRegionLocator(tn)) {
-  regionLoc = locator.getRegionLocation(regionName);
+  regionLoc = locator.getRegionLocation(regionName, true);
 }
 if (regionLoc == null) {
   LOG.warn("Cannot find region server holding region " + 
Bytes.toString(regionName) +



[2/3] hbase git commit: HBASE-17616 Incorrect actions performed by CM

2017-02-09 Thread apurtell
HBASE-17616 Incorrect actions performed by CM

Signed-off-by: tedyu 


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

Branch: refs/heads/branch-1.2
Commit: 7bfb930a81a3235a62c3cf145d5b699a105011fb
Parents: 0976b86
Author: Abhishek Singh Chouhan 
Authored: Thu Feb 9 15:31:18 2017 +0530
Committer: Andrew Purtell 
Committed: Thu Feb 9 15:09:57 2017 -0800

--
 .../test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/7bfb930a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
--
diff --git 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
index 2a5ae55..ce9ca70 100644
--- 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
+++ 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
@@ -269,7 +269,7 @@ public class DistributedHBaseCluster extends HBaseCluster {
   public ServerName getServerHoldingRegion(TableName tn, byte[] regionName) 
throws IOException {
 HRegionLocation regionLoc = null;
 try (RegionLocator locator = connection.getRegionLocator(tn)) {
-  regionLoc = locator.getRegionLocation(regionName);
+  regionLoc = locator.getRegionLocation(regionName, true);
 }
 if (regionLoc == null) {
   LOG.warn("Cannot find region server holding region " + 
Bytes.toString(regionName) +



hbase git commit: HBASE-17609 Allow for region merging in the UI

2017-02-09 Thread apurtell
Repository: hbase
Updated Branches:
  refs/heads/branch-1.3 65d1af571 -> 6ca86b981


HBASE-17609 Allow for region merging in the UI

Signed-off-by: Andrew Purtell 


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

Branch: refs/heads/branch-1.3
Commit: 6ca86b9815a338ba9fd195cc78ef6c73e673d6ca
Parents: 65d1af5
Author: rgidwani 
Authored: Tue Feb 7 11:30:47 2017 -0800
Committer: Andrew Purtell 
Committed: Thu Feb 9 14:21:46 2017 -0800

--
 .../resources/hbase-webapps/master/table.jsp| 20 
 1 file changed, 20 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/6ca86b98/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
--
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp 
b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
index bec5710..cfe21ec 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
@@ -58,6 +58,8 @@
   }
   String action = request.getParameter("action");
   String key = request.getParameter("key");
+  String left = request.getParameter("left");
+  String right = request.getParameter("right");
 %>
 

[1/2] hbase git commit: HBASE-17609 Allow for region merging in the UI

2017-02-09 Thread apurtell
Repository: hbase
Updated Branches:
  refs/heads/branch-1 e4ee7ee89 -> 4588bdee9
  refs/heads/master 06a260f10 -> 1b041a4fc


HBASE-17609 Allow for region merging in the UI

Signed-off-by: Andrew Purtell 


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

Branch: refs/heads/branch-1
Commit: 4588bdee9fb7314e318c867ae513790fbc3b9374
Parents: e4ee7ee
Author: rgidwani 
Authored: Tue Feb 7 11:30:47 2017 -0800
Committer: Andrew Purtell 
Committed: Thu Feb 9 14:06:48 2017 -0800

--
 .../resources/hbase-webapps/master/table.jsp| 20 
 1 file changed, 20 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/4588bdee/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
--
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp 
b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
index 37209c7..7c2770d 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
@@ -72,6 +72,8 @@
   }
   String action = request.getParameter("action");
   String key = request.getParameter("key");
+  String left = request.getParameter("left");
+  String right = request.getParameter("right");
   long totalStoreFileSizeMB = 0;
 
   final String numRegionsParam = request.getParameter("numRegions");
@@ -186,6 +188,11 @@ if ( fqtn != null ) {
 admin.compact(TableName.valueOf(fqtn));
   }
 %> Compact request accepted. <%
+} else if (action.equals("merge")) {
+if (left != null && left.length() > 0 && right != null && 
right.length() > 0) {
+admin.mergeRegions(Bytes.toBytesBinary(left), 
Bytes.toBytesBinary(right), false);
+}
+%> Merge request accepted. <%
 }
   }
 %>
@@ -698,6 +705,19 @@ Actions:
   other regions. Split requests for noneligible regions will be ignored.
   
 
+
+  
+  
+  
+  
+  
+  
+  Region Key (Required):
+  Region Key (Required) :
+  This action will merge two
+  regions of the table, Merge requests for noneligible regions will be 
ignored.
+  
+
 
 
 



[2/2] hbase git commit: HBASE-17609 Allow for region merging in the UI

2017-02-09 Thread apurtell
HBASE-17609 Allow for region merging in the UI

Signed-off-by: Andrew Purtell 


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

Branch: refs/heads/master
Commit: 1b041a4fc7d262d2b1ede5a88dfe45adfd90b9ca
Parents: 06a260f
Author: rgidwani 
Authored: Tue Feb 7 11:30:47 2017 -0800
Committer: Andrew Purtell 
Committed: Thu Feb 9 14:06:56 2017 -0800

--
 .../resources/hbase-webapps/master/table.jsp| 20 
 1 file changed, 20 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/1b041a4f/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
--
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp 
b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
index 343754b..575bd10 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
@@ -86,6 +86,8 @@
   }
   String action = request.getParameter("action");
   String key = request.getParameter("key");
+  String left = request.getParameter("left");
+  String right = request.getParameter("right");
   long totalStoreFileSizeMB = 0;
 
   final String numRegionsParam = request.getParameter("numRegions");
@@ -208,6 +210,11 @@ if ( fqtn != null ) {
 admin.compact(TableName.valueOf(fqtn));
   }
 %> Compact request accepted. <%
+} else if (action.equals("merge")) {
+if (left != null && left.length() > 0 && right != null && 
right.length() > 0) {
+admin.mergeRegions(Bytes.toBytesBinary(left), 
Bytes.toBytesBinary(right), false);
+}
+%> Merge request accepted. <%
 }
   }
 %>
@@ -759,6 +766,19 @@ Actions:
   other regions. Split requests for noneligible regions will be ignored.
   
 
+
+  
+  
+  
+  
+  
+  
+  Region Key (Required):
+  Region Key (Required) :
+  This action will merge two
+  regions of the table, Merge requests for noneligible regions will be 
ignored.
+  
+
 
 
 



[2/2] hbase git commit: HBASE-17572 HMaster: Caught throwable while processing event C_M_MERGE_REGION

2017-02-09 Thread apurtell
HBASE-17572 HMaster: Caught throwable while processing event C_M_MERGE_REGION


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

Branch: refs/heads/branch-1.3
Commit: 65d1af5711302d4ba37025c8891e5a9524619400
Parents: 6959208
Author: Andrew Purtell 
Authored: Wed Feb 8 16:04:47 2017 -0800
Committer: Andrew Purtell 
Committed: Thu Feb 9 13:37:42 2017 -0800

--
 .../java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java| 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/65d1af57/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
--
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
index ac48ecd..5a78601 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
@@ -1990,7 +1990,11 @@ public final class ProtobufUtil {
 user.getUGI().doAs(new PrivilegedExceptionAction() {
   @Override
   public Void run() throws Exception {
-admin.mergeRegions(controller, request);
+try {
+  admin.mergeRegions(controller, request);
+} catch (ServiceException se) {
+  throw ProtobufUtil.getRemoteException(se);
+}
 return null;
   }
 });



hbase git commit: HBASE-17265 Region left unassigned in master failover when region failed to open (Allan Yang)

2017-02-09 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/branch-1.3 5a044ffc6 -> 695920846


HBASE-17265 Region left unassigned in master failover when region failed to 
open (Allan Yang)


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

Branch: refs/heads/branch-1.3
Commit: 6959208463930faaa9295c6fcbedfdaa3b6e10af
Parents: 5a044ff
Author: tedyu 
Authored: Thu Feb 9 12:45:46 2017 -0800
Committer: tedyu 
Committed: Thu Feb 9 12:45:46 2017 -0800

--
 .../org/apache/hadoop/hbase/master/AssignmentManager.java |  2 +-
 .../java/org/apache/hadoop/hbase/master/RegionStates.java | 10 ++
 2 files changed, 11 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/69592084/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
index 59e938d..1e19397 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
@@ -1065,7 +1065,7 @@ public class AssignmentManager extends ZooKeeperListener {
 failedOpenTracker.remove(encodedName);
   } else {
 // Handle this the same as if it were opened and then closed.
-regionState = regionStates.updateRegionState(rt, State.CLOSED);
+regionState = 
regionStates.setRegionStateTOCLOSED(rt.getRegionName(), sn);
 if (regionState != null) {
   // When there are more than one region server a new RS is 
selected as the
   // destination and the same is updated in the regionplan. 
(HBASE-5546)

http://git-wip-us.apache.org/repos/asf/hbase/blob/69592084/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
index 9d68a85..96125f0 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
@@ -390,6 +390,16 @@ public class RegionStates {
* Set the region state to CLOSED
*/
   public RegionState setRegionStateTOCLOSED(
+  final byte[] regionName,
+  final ServerName serverName) {
+HRegionInfo regionInfo = getRegionInfo(regionName);
+return setRegionStateTOCLOSED(regionInfo, serverName);
+  }
+
+  /**
+   * Set the region state to CLOSED
+   */
+  public RegionState setRegionStateTOCLOSED(
   final HRegionInfo regionInfo,
   final ServerName serverName) {
 ServerName sn = serverName;



hbase git commit: HBASE-17265 Region left unassigned in master failover when region failed to open (Allan Yang)

2017-02-09 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/branch-1 807fcfd22 -> 52c51fc27


HBASE-17265 Region left unassigned in master failover when region failed to 
open (Allan Yang)


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

Branch: refs/heads/branch-1
Commit: 52c51fc271b8bf0e3dfc8dc05513cc61ce689787
Parents: 807fcfd
Author: tedyu 
Authored: Thu Feb 9 12:43:37 2017 -0800
Committer: tedyu 
Committed: Thu Feb 9 12:43:37 2017 -0800

--
 .../org/apache/hadoop/hbase/master/AssignmentManager.java |  2 +-
 .../java/org/apache/hadoop/hbase/master/RegionStates.java | 10 ++
 2 files changed, 11 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/52c51fc2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
index bf50d48..fe94f42 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
@@ -1091,7 +1091,7 @@ public class AssignmentManager extends ZooKeeperListener {
 failedOpenTracker.remove(encodedName);
   } else {
 // Handle this the same as if it were opened and then closed.
-regionState = regionStates.updateRegionState(rt, State.CLOSED);
+regionState = 
regionStates.setRegionStateTOCLOSED(rt.getRegionName(), sn);
 if (regionState != null) {
   // When there are more than one region server a new RS is 
selected as the
   // destination and the same is updated in the regionplan. 
(HBASE-5546)

http://git-wip-us.apache.org/repos/asf/hbase/blob/52c51fc2/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
index c2c45d2..6cc8b49 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
@@ -423,6 +423,16 @@ public class RegionStates {
* Set the region state to CLOSED
*/
   public RegionState setRegionStateTOCLOSED(
+  final byte[] regionName,
+  final ServerName serverName) {
+HRegionInfo regionInfo = getRegionInfo(regionName);
+return setRegionStateTOCLOSED(regionInfo, serverName);
+  }
+
+  /**
+   * Set the region state to CLOSED
+   */
+  public RegionState setRegionStateTOCLOSED(
   final HRegionInfo regionInfo,
   final ServerName serverName) {
 ServerName sn = serverName;



hbase git commit: HBASE-17616 Incorrect actions performed by CM

2017-02-09 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/branch-1 67fe516ec -> 807fcfd22


HBASE-17616 Incorrect actions performed by CM

Signed-off-by: tedyu 


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

Branch: refs/heads/branch-1
Commit: 807fcfd22f7a531aad0059859853626ac8f1530c
Parents: 67fe516
Author: Abhishek Singh Chouhan 
Authored: Thu Feb 9 15:31:18 2017 +0530
Committer: tedyu 
Committed: Thu Feb 9 12:35:22 2017 -0800

--
 .../test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/807fcfd2/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
--
diff --git 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
index 2a5ae55..ce9ca70 100644
--- 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
+++ 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
@@ -269,7 +269,7 @@ public class DistributedHBaseCluster extends HBaseCluster {
   public ServerName getServerHoldingRegion(TableName tn, byte[] regionName) 
throws IOException {
 HRegionLocation regionLoc = null;
 try (RegionLocator locator = connection.getRegionLocator(tn)) {
-  regionLoc = locator.getRegionLocation(regionName);
+  regionLoc = locator.getRegionLocation(regionName, true);
 }
 if (regionLoc == null) {
   LOG.warn("Cannot find region server holding region " + 
Bytes.toString(regionName) +



hbase git commit: HBASE-17616 Incorrect actions performed by CM

2017-02-09 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/master 489c8872c -> 06a260f10


HBASE-17616 Incorrect actions performed by CM

Signed-off-by: tedyu 


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

Branch: refs/heads/master
Commit: 06a260f107ba5ab489e7d28256ee6bc9530d3416
Parents: 489c887
Author: Abhishek Singh Chouhan 
Authored: Thu Feb 9 15:31:18 2017 +0530
Committer: tedyu 
Committed: Thu Feb 9 12:34:59 2017 -0800

--
 .../test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/06a260f1/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
--
diff --git 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
index 16f1e71..d35ef84 100644
--- 
a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
+++ 
b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
@@ -269,7 +269,7 @@ public class DistributedHBaseCluster extends HBaseCluster {
   public ServerName getServerHoldingRegion(TableName tn, byte[] regionName) 
throws IOException {
 HRegionLocation regionLoc = null;
 try (RegionLocator locator = connection.getRegionLocator(tn)) {
-  regionLoc = locator.getRegionLocation(regionName);
+  regionLoc = locator.getRegionLocation(regionName, true);
 }
 if (regionLoc == null) {
   LOG.warn("Cannot find region server holding region " + 
Bytes.toString(regionName) +



[1/3] hbase git commit: HBASE-17280 Add mechanism to control hbase cleaner behavior

2017-02-09 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/branch-1 e9abe0762 -> 67fe516ec


http://git-wip-us.apache.org/repos/asf/hbase/blob/67fe516e/hbase-protocol/src/main/protobuf/Master.proto
--
diff --git a/hbase-protocol/src/main/protobuf/Master.proto 
b/hbase-protocol/src/main/protobuf/Master.proto
index b6a56e2..1c60465 100644
--- a/hbase-protocol/src/main/protobuf/Master.proto
+++ b/hbase-protocol/src/main/protobuf/Master.proto
@@ -345,6 +345,28 @@ message IsCatalogJanitorEnabledResponse {
   required bool value = 1;
 }
 
+message RunCleanerChoreRequest {
+}
+
+message RunCleanerChoreResponse {
+  required bool cleaner_chore_ran = 1;
+}
+
+message SetCleanerChoreRunningRequest {
+  required bool on = 1;
+}
+
+message SetCleanerChoreRunningResponse {
+  optional bool prev_value = 1;
+}
+
+message IsCleanerChoreEnabledRequest {
+}
+
+message IsCleanerChoreEnabledResponse {
+  required bool value = 1;
+}
+
 message SnapshotRequest {
required SnapshotDescription snapshot = 1;
 }
@@ -699,6 +721,22 @@ service MasterService {
   rpc IsCatalogJanitorEnabled(IsCatalogJanitorEnabledRequest)
  returns(IsCatalogJanitorEnabledResponse);
 
+  /** Get a run of the cleaner chore*/
+  rpc RunCleanerChore(RunCleanerChoreRequest)
+returns(RunCleanerChoreResponse);
+
+  /**
+   * Enable the cleaner chore on or off.
+   */
+  rpc SetCleanerChoreRunning(SetCleanerChoreRunningRequest)
+returns(SetCleanerChoreRunningResponse);
+
+  /**
+   * Query whether the cleaner chore is enabled.
+   */
+  rpc IsCleanerChoreEnabled(IsCleanerChoreEnabledRequest)
+returns(IsCleanerChoreEnabledResponse);
+
   /**
* Call a master coprocessor endpoint
*/

http://git-wip-us.apache.org/repos/asf/hbase/blob/67fe516e/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index 9da081a..2352df2 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -1053,6 +1053,20 @@ public class HMaster extends HRegionServer implements 
MasterServices, Server {
   catalogJanitorChore.getEnabled() : false;
   }
 
+  boolean isCleanerChoreEnabled() {
+boolean hfileCleanerFlag = true, logCleanerFlag = true;
+
+if (hfileCleaner != null) {
+  hfileCleanerFlag = hfileCleaner.getEnabled();
+}
+
+if(logCleaner != null) {
+  logCleanerFlag = logCleaner.getEnabled();
+}
+
+return (hfileCleanerFlag && logCleanerFlag);
+  }
+
   private void splitMetaLogBeforeAssignment(ServerName currentMetaServer) 
throws IOException {
 if (RecoveryMode.LOG_REPLAY == 
this.getMasterFileSystem().getLogRecoveryMode()) {
   // In log replay mode, we mark hbase:meta region as recovering in ZK
@@ -2713,6 +2727,10 @@ public class HMaster extends HRegionServer implements 
MasterServices, Server {
 return this.hfileCleaner;
   }
 
+  public LogCleaner getLogCleaner() {
+return this.logCleaner;
+  }
+
   /**
* @return the underlying snapshot manager
*/

http://git-wip-us.apache.org/repos/asf/hbase/blob/67fe516e/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
index f51a797..c678c86 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
@@ -107,6 +107,8 @@ import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetTableNamesRequ
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetTableNamesResponse;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsBalancerEnabledRequest;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsBalancerEnabledResponse;
+import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCleanerChoreEnabledRequest;
+import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCleanerChoreEnabledResponse;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCatalogJanitorEnabledRequest;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCatalogJanitorEnabledResponse;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsInMaintenanceModeRequest;
@@ -149,11 +151,15 @@ import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.RestoreSnapshotRe
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.RestoreSnapshotResponse;
 import 

[3/3] hbase git commit: HBASE-17280 Add mechanism to control hbase cleaner behavior

2017-02-09 Thread tedyu
HBASE-17280 Add mechanism to control hbase cleaner behavior

Signed-off-by: tedyu 


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

Branch: refs/heads/branch-1
Commit: 67fe516ec9adabc56e557cb67fb254353da4a50e
Parents: e9abe07
Author: Ajay Jadhav 
Authored: Thu Feb 9 09:06:00 2017 -0800
Committer: tedyu 
Committed: Thu Feb 9 12:18:42 2017 -0800

--
 .../org/apache/hadoop/hbase/client/Admin.java   |   24 +
 .../hadoop/hbase/client/ConnectionManager.java  |   25 +
 .../apache/hadoop/hbase/client/HBaseAdmin.java  |   33 +
 .../hadoop/hbase/protobuf/RequestConverter.java |   39 +
 .../hbase/protobuf/ResponseConverter.java   |9 +
 .../hbase/protobuf/generated/MasterProtos.java  | 3669 +++---
 hbase-protocol/src/main/protobuf/Master.proto   |   38 +
 .../org/apache/hadoop/hbase/master/HMaster.java |   18 +
 .../hadoop/hbase/master/MasterRpcServices.java  |   41 +
 .../hbase/master/cleaner/CleanerChore.java  |   23 +
 .../hbase/master/cleaner/TestCleanerChore.java  |   66 +
 hbase-shell/src/main/ruby/hbase/admin.rb|   20 +
 hbase-shell/src/main/ruby/shell.rb  |3 +
 .../shell/commands/cleaner_chore_enabled.rb |   40 +
 .../ruby/shell/commands/cleaner_chore_run.rb|   37 +
 .../ruby/shell/commands/cleaner_chore_switch.rb |   41 +
 16 files changed, 3670 insertions(+), 456 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/67fe516e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
--
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
index 270518d..5810b2b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
@@ -767,6 +767,30 @@ public interface Admin extends Abortable, Closeable {
   boolean isCatalogJanitorEnabled() throws IOException;
 
   /**
+   * Enable/Disable the cleaner chore
+   *
+   * @param on if true enables the cleaner chore
+   * @return the previous state
+   * @throws IOException
+   */
+  public boolean setCleanerChoreRunning(final boolean on) throws IOException;
+
+  /**
+   * Ask for cleaner chore to run
+   *
+   * @return True if cleaner chore ran, false otherwise
+   * @throws IOException
+   */
+  public boolean runCleanerChore() throws IOException;
+
+  /**
+   * Query on the cleaner chore state (Enabled/Disabled?)
+   *
+   * @throws IOException
+   */
+  public boolean isCleanerChoreEnabled() throws IOException;
+
+  /**
* Merge two regions. Asynchronous operation.
*
* @param nameOfRegionA encoded or full name of region a

http://git-wip-us.apache.org/repos/asf/hbase/blob/67fe516e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionManager.java
--
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionManager.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionManager.java
index ab6cb8d..c10f893 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionManager.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionManager.java
@@ -128,6 +128,8 @@ import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsBalancerEnabled
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsBalancerEnabledResponse;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCatalogJanitorEnabledRequest;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCatalogJanitorEnabledResponse;
+import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCleanerChoreEnabledRequest;
+import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCleanerChoreEnabledResponse;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsMasterRunningRequest;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsMasterRunningResponse;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsNormalizerEnabledRequest;
@@ -164,10 +166,14 @@ import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.RestoreSnapshotRe
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.RestoreSnapshotResponse;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.RunCatalogScanRequest;
 import 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.RunCatalogScanResponse;

[2/3] hbase git commit: HBASE-17280 Add mechanism to control hbase cleaner behavior

2017-02-09 Thread tedyu
http://git-wip-us.apache.org/repos/asf/hbase/blob/67fe516e/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/MasterProtos.java
--
diff --git 
a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/MasterProtos.java
 
b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/MasterProtos.java
index e247938..edf2e85 100644
--- 
a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/MasterProtos.java
+++ 
b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/MasterProtos.java
@@ -35828,6 +35828,2442 @@ public final class MasterProtos {
 // 
@@protoc_insertion_point(class_scope:hbase.pb.IsCatalogJanitorEnabledResponse)
   }
 
+  public interface RunCleanerChoreRequestOrBuilder
+  extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code hbase.pb.RunCleanerChoreRequest}
+   */
+  public static final class RunCleanerChoreRequest extends
+  com.google.protobuf.GeneratedMessage
+  implements RunCleanerChoreRequestOrBuilder {
+// Use RunCleanerChoreRequest.newBuilder() to construct.
+private 
RunCleanerChoreRequest(com.google.protobuf.GeneratedMessage.Builder builder) 
{
+  super(builder);
+  this.unknownFields = builder.getUnknownFields();
+}
+private RunCleanerChoreRequest(boolean noInit) { this.unknownFields = 
com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+private static final RunCleanerChoreRequest defaultInstance;
+public static RunCleanerChoreRequest getDefaultInstance() {
+  return defaultInstance;
+}
+
+public RunCleanerChoreRequest getDefaultInstanceForType() {
+  return defaultInstance;
+}
+
+private final com.google.protobuf.UnknownFieldSet unknownFields;
+@java.lang.Override
+public final com.google.protobuf.UnknownFieldSet
+getUnknownFields() {
+  return this.unknownFields;
+}
+private RunCleanerChoreRequest(
+com.google.protobuf.CodedInputStream input,
+com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+throws com.google.protobuf.InvalidProtocolBufferException {
+  initFields();
+  com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+  com.google.protobuf.UnknownFieldSet.newBuilder();
+  try {
+boolean done = false;
+while (!done) {
+  int tag = input.readTag();
+  switch (tag) {
+case 0:
+  done = true;
+  break;
+default: {
+  if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+done = true;
+  }
+  break;
+}
+  }
+}
+  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+throw e.setUnfinishedMessage(this);
+  } catch (java.io.IOException e) {
+throw new com.google.protobuf.InvalidProtocolBufferException(
+e.getMessage()).setUnfinishedMessage(this);
+  } finally {
+this.unknownFields = unknownFields.build();
+makeExtensionsImmutable();
+  }
+}
+public static final com.google.protobuf.Descriptors.Descriptor
+getDescriptor() {
+  return 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.internal_static_hbase_pb_RunCleanerChoreRequest_descriptor;
+}
+
+protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+internalGetFieldAccessorTable() {
+  return 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.internal_static_hbase_pb_RunCleanerChoreRequest_fieldAccessorTable
+  .ensureFieldAccessorsInitialized(
+  
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.RunCleanerChoreRequest.class,
 
org.apache.hadoop.hbase.protobuf.generated.MasterProtos.RunCleanerChoreRequest.Builder.class);
+}
+
+public static com.google.protobuf.Parser PARSER =
+new com.google.protobuf.AbstractParser() {
+  public RunCleanerChoreRequest parsePartialFrom(
+  com.google.protobuf.CodedInputStream input,
+  com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+  throws com.google.protobuf.InvalidProtocolBufferException {
+return new RunCleanerChoreRequest(input, extensionRegistry);
+  }
+};
+
+@java.lang.Override
+public com.google.protobuf.Parser 
getParserForType() {
+  return PARSER;
+}
+
+private void initFields() {
+}
+private byte memoizedIsInitialized = -1;
+public final boolean isInitialized() {
+  byte isInitialized = memoizedIsInitialized;
+  if (isInitialized != -1) return isInitialized == 1;
+
+  memoizedIsInitialized = 1;
+  return true;
+}
+
+public void writeTo(com.google.protobuf.CodedOutputStream output)
+throws java.io.IOException 

hbase git commit: HBASE-17278 [C++] Cell Scanner and KeyValueCodec for encoding cells in RPC (Sudeep Sunthankar and enis)

2017-02-09 Thread enis
Repository: hbase
Updated Branches:
  refs/heads/HBASE-14850 3fa0acfb8 -> 9aa4b16b7


HBASE-17278 [C++] Cell Scanner and KeyValueCodec for encoding cells in RPC 
(Sudeep Sunthankar and enis)


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

Branch: refs/heads/HBASE-14850
Commit: 9aa4b16b746efbb85c47d65cc25999444aa7a054
Parents: 3fa0acf
Author: Enis Soztutar 
Authored: Thu Feb 9 11:26:47 2017 -0800
Committer: Enis Soztutar 
Committed: Thu Feb 9 11:26:58 2017 -0800

--
 hbase-native-client/.gitignore|   3 +-
 hbase-native-client/core/BUCK |   2 +
 hbase-native-client/core/keyvalue-codec.cc|  69 ++
 hbase-native-client/core/keyvalue-codec.h | 147 +
 hbase-native-client/serde/BUCK|   3 +
 hbase-native-client/serde/cell-outputstream.h |  53 
 hbase-native-client/serde/cell-scanner.h  |  50 +++
 hbase-native-client/serde/codec.h |  50 +++
 8 files changed, 376 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/9aa4b16b/hbase-native-client/.gitignore
--
diff --git a/hbase-native-client/.gitignore b/hbase-native-client/.gitignore
index b172fe9..c0032e4 100644
--- a/hbase-native-client/.gitignore
+++ b/hbase-native-client/.gitignore
@@ -22,4 +22,5 @@ buck-out
 *.swp
 
 # Thirdparty dirs
-third-party/googletest*
+third-party/*
+/gcc-debug/

http://git-wip-us.apache.org/repos/asf/hbase/blob/9aa4b16b/hbase-native-client/core/BUCK
--
diff --git a/hbase-native-client/core/BUCK b/hbase-native-client/core/BUCK
index f1880a4..d8d15a9 100644
--- a/hbase-native-client/core/BUCK
+++ b/hbase-native-client/core/BUCK
@@ -22,6 +22,7 @@ cxx_library(
 "client.h",
 "cell.h",
 "hbase_macros.h",
+"keyvalue-codec.h",
 "region-location.h",
 "location-cache.h",
 # TODO: move this out of exported
@@ -40,6 +41,7 @@ cxx_library(
 srcs=[
 "cell.cc",
 "client.cc",
+"keyvalue-codec.cc",
 "location-cache.cc",
 "meta-utils.cc",
 "get.cc",

http://git-wip-us.apache.org/repos/asf/hbase/blob/9aa4b16b/hbase-native-client/core/keyvalue-codec.cc
--
diff --git a/hbase-native-client/core/keyvalue-codec.cc 
b/hbase-native-client/core/keyvalue-codec.cc
new file mode 100644
index 000..1b526b9
--- /dev/null
+++ b/hbase-native-client/core/keyvalue-codec.cc
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ *
+ */
+
+#include "core/keyvalue-codec.h"
+
+#include 
+
+namespace hbase {
+
+KeyValueCodec::KVDecoder::KVDecoder(std::unique_ptr cell_block, 
uint32_t offset,
+uint32_t length)
+: cell_block_(std::move(cell_block)), offset_(offset), length_(length) {}
+
+KeyValueCodec::KVDecoder::~KVDecoder() {}
+
+std::shared_ptr KeyValueCodec::KVDecoder::Decode(folly::io::Cursor 
) {
+  uint32_t key_length = cursor.readBE();
+  uint32_t value_length = cursor.readBE();
+  uint16_t row_length = cursor.readBE();
+  std::string row = cursor.readFixedString(row_length);
+  uint8_t column_family_length = cursor.readBE();
+  std::string column_family = cursor.readFixedString(column_family_length);
+  int qualifier_length =
+  key_length - (row_length + column_family_length + 
kHBaseSizeOfKeyInfrastructure_);
+  std::string column_qualifier = cursor.readFixedString(qualifier_length);
+  uint64_t timestamp = cursor.readBE();
+  uint8_t key_type = cursor.readBE();
+  std::string value = cursor.readFixedString(value_length);
+
+  return std::make_shared(row, column_family, column_qualifier, 
timestamp, value,
+ 

hbase git commit: HBASE-17613 avoid copy of family when initializing the FSWALEntry

2017-02-09 Thread tedyu
Repository: hbase
Updated Branches:
  refs/heads/master 712fe69e4 -> 489c8872c


HBASE-17613 avoid copy of family when initializing the FSWALEntry

Signed-off-by: tedyu 


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

Branch: refs/heads/master
Commit: 489c8872c14fc8c4c9cd5d36b1953bf5afcf08ec
Parents: 712fe69
Author: ChiaPing Tsai 
Authored: Thu Feb 9 01:24:41 2017 +0800
Committer: tedyu 
Committed: Thu Feb 9 08:18:47 2017 -0800

--
 .../hbase/regionserver/wal/FSWALEntry.java  | 35 ++-
 .../hbase/regionserver/wal/TestFSWALEntry.java  | 62 
 2 files changed, 82 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/489c8872/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSWALEntry.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSWALEntry.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSWALEntry.java
index 7ac276d..3b8525c 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSWALEntry.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSWALEntry.java
@@ -18,14 +18,17 @@
 package org.apache.hadoop.hbase.regionserver.wal;
 
 
-import com.google.common.collect.Sets;
+import com.google.common.annotations.VisibleForTesting;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 import java.util.Set;
+import java.util.TreeSet;
+import static java.util.stream.Collectors.toCollection;
 
 import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellComparator;
 import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
@@ -64,24 +67,26 @@ class FSWALEntry extends Entry {
 this.txid = txid;
 if (inMemstore) {
   // construct familyNames here to reduce the work of log sinker.
-  ArrayList cells = this.getEdit().getCells();
-  if (CollectionUtils.isEmpty(cells)) {
-this.familyNames = Collections. emptySet();
-  } else {
-Set familySet = Sets.newTreeSet(Bytes.BYTES_COMPARATOR);
-for (Cell cell : cells) {
-  if (!CellUtil.matchingFamily(cell, WALEdit.METAFAMILY)) {
-// TODO: Avoid this clone?
-familySet.add(CellUtil.cloneFamily(cell));
-  }
-}
-this.familyNames = Collections.unmodifiableSet(familySet);
-  }
+  this.familyNames = collectFamilies(edit.getCells());
 } else {
   this.familyNames = Collections. emptySet();
 }
   }
 
+  @VisibleForTesting
+  static Set collectFamilies(List cells) {
+if (CollectionUtils.isEmpty(cells)) {
+  return Collections. emptySet();
+} else {
+  return cells.stream()
+   .filter(v -> !CellUtil.matchingFamily(v, WALEdit.METAFAMILY))
+   .collect(toCollection(() -> new 
TreeSet<>(CellComparator::compareFamilies)))
+   .stream()
+   .map(CellUtil::cloneFamily)
+   .collect(toCollection(() -> new TreeSet<>(Bytes.BYTES_COMPARATOR)));
+}
+  }
+
   public String toString() {
 return "sequence=" + this.txid + ", " + super.toString();
   };

http://git-wip-us.apache.org/repos/asf/hbase/blob/489c8872/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestFSWALEntry.java
--
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestFSWALEntry.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestFSWALEntry.java
new file mode 100644
index 000..cf059dd
--- /dev/null
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestFSWALEntry.java
@@ -0,0 +1,62 @@
+/**
+ *
+ * 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