valepakh commented on code in PR #5685:
URL: https://github.com/apache/ignite-3/pull/5685#discussion_r2077378260


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/AlterZoneCommand.java:
##########
@@ -136,15 +142,20 @@ private CatalogZoneDescriptor 
fromParamsAndPreviousValue(CatalogZoneDescriptor p
         CatalogStorageProfilesDescriptor storageProfiles = 
storageProfileParams != null
                 ? fromParams(storageProfileParams) : 
previous.storageProfiles();
 
+        // Validate quorum size here since its boundaries depend on the 
current number of replicas
+        int replicas = requireNonNullElse(this.replicas, previous.replicas());
+        validateQuorum(quorumSize, replicas);

Review Comment:
   We decided to automatically adjust quorum size when altering zone replicas 
parameter so it is always consistent.



##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogParamsValidationUtils.java:
##########
@@ -142,6 +146,18 @@ public static void validatePartition(@Nullable Integer 
partitions) {
         }
     }
 
+    /**
+     * Validates quorum size, taking number of replicas into consideration.
+     *
+     * @param quorumSize Quorum size to validate.
+     * @param replicas Current number of replicas.
+     */
+    public static void validateQuorum(@Nullable Integer quorumSize, int 
replicas) {
+        int minQuorum = min(replicas, 2);
+        int maxQuorum = max(minQuorum, (int) (floor(replicas / 2.0 + 0.5)));

Review Comment:
   Changed that.



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to