From cc873713c17738cecc2264c236586af3a7b91c1f Mon Sep 17 00:00:00 2001 From: Jimmy Xiang Date: Mon, 15 Sep 2014 11:38:30 -0700 Subject: [PATCH] HBASE-11976 Server startcode is not checked for bulk region assignment --- .../org/apache/hadoop/hbase/protobuf/RequestConverter.java | 7 +++++-- .../java/org/apache/hadoop/hbase/master/ServerManager.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) 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 ab764a38e47..c312de821ec 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 @@ -20,7 +20,6 @@ package org.apache.hadoop.hbase.protobuf; import java.io.IOException; import java.util.List; -import org.apache.hadoop.hbase.protobuf.generated.MasterProtos; import org.apache.hadoop.hbase.util.ByteStringer; import org.apache.hadoop.classification.InterfaceAudience; @@ -704,18 +703,22 @@ public final class RequestConverter { /** * Create a protocol buffer OpenRegionRequest to open a list of regions * + * @param server the serverName for the RPC * @param regionOpenInfos info of a list of regions to open * @param openForReplay * @return a protocol buffer OpenRegionRequest */ public static OpenRegionRequest - buildOpenRegionRequest(final List>> regionOpenInfos, Boolean openForReplay) { OpenRegionRequest.Builder builder = OpenRegionRequest.newBuilder(); for (Pair> regionOpenInfo: regionOpenInfos) { builder.addOpenInfo(buildRegionOpenInfo(regionOpenInfo.getFirst(), regionOpenInfo.getSecond(), openForReplay)); } + if (server != null) { + builder.setServerStartCode(server.getStartcode()); + } return builder.build(); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java index 60fb2bba8e8..2449164e6f4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java @@ -756,7 +756,7 @@ public class ServerManager { " failed because no RPC connection found to this server"); } - OpenRegionRequest request = RequestConverter.buildOpenRegionRequest(regionOpenInfos, + OpenRegionRequest request = RequestConverter.buildOpenRegionRequest(server, regionOpenInfos, (RecoveryMode.LOG_REPLAY == this.services.getMasterFileSystem().getLogRecoveryMode())); try { OpenRegionResponse response = admin.openRegion(null, request);