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


##########
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:
   In the problematic case we have the same (3) replica count in the Table 
Descriptor and the problem is that only 1 of them exists in ZK. After this we 
will assign the other 2 as well.
   
   In my previous implementation I changed the replica count in the 
TableDescriptor so it was not needed.



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