richardantal commented on code in PR #6448:
URL: https://github.com/apache/hbase/pull/6448#discussion_r2098010364


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ModifyTableProcedure.java:
##########
@@ -506,14 +506,17 @@ private void 
removeReplicaColumnsIfNeeded(MasterProcedureEnv env) throws IOExcep
   private void assignNewReplicasIfNeeded(MasterProcedureEnv env) throws 
IOException {
     final int oldReplicaCount = 
unmodifiedTableDescriptor.getRegionReplication();
     final int newReplicaCount = modifiedTableDescriptor.getRegionReplication();
-    if (newReplicaCount <= oldReplicaCount) {
+    int existingReplicasCount = env.getAssignmentManager().getRegionStates()
+      .getRegionsOfTable(modifiedTableDescriptor.getTableName()).size();
+    if (newReplicaCount <= Math.min(oldReplicaCount, existingReplicasCount)) {

Review Comment:
   After we run the createAssignProcedures for the 2 replicas, ZK info will be 
correct too.
   In the problematic case the oldReplicaCount and newReplicaCount are both 
3(the same) so the replica assignment wouldn't happen.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to