korlov42 commented on code in PR #7324:
URL: https://github.com/apache/ignite-3/pull/7324#discussion_r2682537258


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogUtils.java:
##########
@@ -589,25 +591,26 @@ public static boolean shouldCreateNewDefaultZone(Catalog 
catalog, @Nullable Stri
      */
     public static CatalogZoneDescriptor createDefaultZoneDescriptor(
             Catalog catalog,
+            PartitionCountProvider partitionCountProvider,
             int newDefaultZoneId,
             Collection<UpdateEntry> updateEntries
     ) throws CatalogValidationException {
         // TODO: Remove after 
https://issues.apache.org/jira/browse/IGNITE-26798
         checkDuplicateDefaultZoneName(catalog);
 
-        CatalogZoneDescriptor defaultZone = 
createDefaultZoneDescriptor(newDefaultZoneId);
+        CatalogZoneDescriptor defaultZone = 
createDefaultZoneDescriptor(partitionCountProvider, newDefaultZoneId);
 
         updateEntries.add(new NewZoneEntry(defaultZone));
         updateEntries.add(new SetDefaultZoneEntry(defaultZone.id()));
 
         return defaultZone;
     }
 
-    private static CatalogZoneDescriptor createDefaultZoneDescriptor(int 
newDefaultZoneId) {
+    private static CatalogZoneDescriptor 
createDefaultZoneDescriptor(PartitionCountProvider partitionCountProvider, int 
newDefaultZoneId) {
         return new CatalogZoneDescriptor(
                 newDefaultZoneId,
                 DEFAULT_ZONE_NAME,
-                DEFAULT_PARTITION_COUNT,
+                defaultZonePartitionCount(partitionCountProvider),

Review Comment:
   the ones required to calculate partition count. Right now you use the same 
constant inside `PartitionCountCalculationParameters.Builder` class, and 
everything works as expected. But this is an implicit dependency, and therefore 
it is fragile. It's easy to change defaults here during creation of 
`CatalogZoneDescriptor` and forget to update 
`PartitionCountCalculationParameters.Builder`.
   
   I believe more robust approach is to introduce local variable and use it 
both for descriptor creation and as input to partition count calculator.  



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