virajjasani commented on a change in pull request #2062:
URL: https://github.com/apache/hbase/pull/2062#discussion_r454229903



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/MetaFixer.java
##########
@@ -174,22 +177,35 @@ private static RegionInfo buildRegionInfo(TableName tn, 
byte [] start, byte [] e
   private static List<RegionInfo> createMetaEntries(final MasterServices 
masterServices,
     final List<RegionInfo> newRegionInfos) {
 
-    final List<Either<RegionInfo, IOException>> addMetaEntriesResults = 
newRegionInfos.stream()
+    final List<Either<List<RegionInfo>, IOException>> addMetaEntriesResults = 
newRegionInfos.stream()
       .map(regionInfo -> {
         try {
-          MetaTableAccessor.addRegionToMeta(masterServices.getConnection(), 
regionInfo);
-          masterServices.getAssignmentManager()
-            .getRegionStates()
-            .updateRegionState(regionInfo, RegionState.State.CLOSED);
-          return Either.<RegionInfo, IOException>ofLeft(regionInfo);
+          TableDescriptor td = 
masterServices.getTableDescriptors().get(regionInfo.getTable());
+
+          // Add replicas if needed
+          // we need to create regions with replicaIds starting from 1
+          List<RegionInfo> newRegions = RegionReplicaUtil.addReplicas(td,

Review comment:
       It seems `addReplicas` does not require TableDescriptor. Can you please 
remove it with this PR?

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/MetaFixer.java
##########
@@ -174,22 +177,35 @@ private static RegionInfo buildRegionInfo(TableName tn, 
byte [] start, byte [] e
   private static List<RegionInfo> createMetaEntries(final MasterServices 
masterServices,
     final List<RegionInfo> newRegionInfos) {
 
-    final List<Either<RegionInfo, IOException>> addMetaEntriesResults = 
newRegionInfos.stream()
+    final List<Either<List<RegionInfo>, IOException>> addMetaEntriesResults = 
newRegionInfos.stream()

Review comment:
       nit: line is beyond 100 char limit. Spotbugs is no longer considering 
line max char limits it seems.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to