This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 106f0c580d Don't enforce -realTimeInstanceCount and 
-offlineInstanceCount options when creating broker tenants (#13236)
106f0c580d is described below

commit 106f0c580d06661b715068617cebc35378bbc926
Author: Yash Mayya <[email protected]>
AuthorDate: Wed May 29 00:47:36 2024 +0530

    Don't enforce -realTimeInstanceCount and -offlineInstanceCount options when 
creating broker tenants (#13236)
---
 .../pinot/tools/admin/command/AddTenantCommand.java     | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git 
a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTenantCommand.java
 
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTenantCommand.java
index a2f236cfd3..d15e522c4a 100644
--- 
a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTenantCommand.java
+++ 
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTenantCommand.java
@@ -54,12 +54,13 @@ public class AddTenantCommand extends 
AbstractBaseAdminCommand implements Comman
   @CommandLine.Option(names = {"-instanceCount"}, required = true, description 
= "Number of instances.")
   private int _instanceCount;
 
-  @CommandLine.Option(names = {"-offlineInstanceCount"}, required = true, 
description = "Number of offline instances.")
-  private int _offlineInstanceCount;
+  @CommandLine.Option(names = {"-offlineInstanceCount"}, required = false,
+      description = "Number of offline instances.")
+  private Integer _offlineInstanceCount;
 
-  @CommandLine.Option(names = {"-realTimeInstanceCount"}, required = true,
+  @CommandLine.Option(names = {"-realTimeInstanceCount"}, required = false,
       description = "Number of realtime instances.")
-  private int _realtimeInstanceCount;
+  private Integer _realtimeInstanceCount;
 
   @CommandLine.Option(names = {"-exec"}, required = false, description = 
"Execute the command.")
   private boolean _exec;
@@ -151,6 +152,14 @@ public class AddTenantCommand extends 
AbstractBaseAdminCommand implements Comman
     }
 
     LOGGER.info("Executing command: {}", toString());
+
+    if (_role == TenantRole.SERVER) {
+      if (_offlineInstanceCount == null || _realtimeInstanceCount == null) {
+        throw new IllegalArgumentException("-offlineInstanceCount and 
-realTimeInstanceCount should be set when "
+            + "creating a server tenant.");
+      }
+    }
+
     Tenant tenant = new Tenant(_role, _name, _instanceCount, 
_offlineInstanceCount, _realtimeInstanceCount);
     String res = AbstractBaseAdminCommand
         .sendRequest("POST", 
ControllerRequestURLBuilder.baseUrl(_controllerAddress).forTenantCreate(),


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to