This is an automated email from the ASF dual-hosted git repository.
Jackie-Jiang 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 8ade0f15822 Leave tenant isolation unset in the generated controller
config (#19393)
8ade0f15822 is described below
commit 8ade0f158222641bca43e3a99f8b9dd266af8945
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Sun Aug 30 11:13:31 2026 -0700
Leave tenant isolation unset in the generated controller config (#19393)
---
.../pinot/tools/admin/command/StartControllerCommand.java | 11 ++++++++---
.../tools/admin/command/StartServiceManagerCommand.java | 3 ++-
.../org/apache/pinot/tools/utils/PinotConfigUtils.java | 14 ++++++++++++--
.../apache/pinot/tools/utils/PinotConfigUtilsTest.java | 15 +++++++++++----
4 files changed, 33 insertions(+), 10 deletions(-)
diff --git
a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java
index 6b57c4a8863..1b58dca0816 100644
---
a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java
+++
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java
@@ -23,6 +23,7 @@ import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
+import javax.annotation.Nullable;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.pinot.controller.ControllerConf;
import org.apache.pinot.spi.services.ServiceRole;
@@ -64,8 +65,10 @@ public class StartControllerCommand extends
AbstractBaseAdminCommand implements
// forbids = {"-controllerHost", "-controllerPort", "-dataDir",
"-zkAddress", "-clusterName", "-controllerMode"})
private String _configFileName;
- // This can be set via the set method, or via config file input.
- private boolean _tenantIsolation = true;
+ // This can be set via the set method, or via config file input. Left null
when neither supplies a value, in which
+ // case the generated config does not pin the key and the controller
starter's default applies.
+ @Nullable
+ private Boolean _tenantIsolation;
@CommandLine.Option(names = {"-configOverride"}, required = false, split =
",")
private Map<String, Object> _configOverrides = new HashMap<>();
@@ -98,7 +101,9 @@ public class StartControllerCommand extends
AbstractBaseAdminCommand implements
return _configFileName;
}
- public boolean isTenantIsolation() {
+ /// Returns the configured tenant isolation value, or `null` when it was
never set.
+ @Nullable
+ public Boolean getTenantIsolation() {
return _tenantIsolation;
}
diff --git
a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java
index da6d2503950..e4d1674715a 100644
---
a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java
+++
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java
@@ -198,8 +198,9 @@ public class StartServiceManagerCommand extends
AbstractBaseAdminCommand impleme
throws SocketException, UnknownHostException {
switch (serviceRole) {
case CONTROLLER:
+ // Tenant isolation is left unset so the controller starter's own
default applies.
return PinotConfigUtils.generateControllerConf(_zkAddress,
_clusterName, null, DEFAULT_CONTROLLER_PORT, null,
- ControllerConf.ControllerMode.DUAL, true);
+ ControllerConf.ControllerMode.DUAL, null);
case BROKER:
return PinotConfigUtils
.generateBrokerConf(_clusterName, _zkAddress, null,
CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT,
diff --git
a/pinot-tools/src/main/java/org/apache/pinot/tools/utils/PinotConfigUtils.java
b/pinot-tools/src/main/java/org/apache/pinot/tools/utils/PinotConfigUtils.java
index 5b1e1494c52..4cef85fc900 100644
---
a/pinot-tools/src/main/java/org/apache/pinot/tools/utils/PinotConfigUtils.java
+++
b/pinot-tools/src/main/java/org/apache/pinot/tools/utils/PinotConfigUtils.java
@@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import javax.annotation.Nullable;
import org.apache.commons.configuration2.builder.fluent.Configurations;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.lang3.StringUtils;
@@ -50,8 +51,15 @@ public class PinotConfigUtils {
private static final String
CONTROLLER_CONFIG_VALIDATION_ERROR_MESSAGE_FORMAT =
"Pinot Controller Config Validation Error: %s";
+ /// Generates the controller config from the given individual options.
+ ///
+ /// A `null` `tenantIsolation` leaves
[ControllerConf#CLUSTER_TENANT_ISOLATION_ENABLE] out of the returned config so
+ /// that the value stays unresolved here. It is then decided by whoever
consumes the config -- a controller starter
+ /// applying its own defaults, or the fallback in
[ControllerConf#tenantIsolationEnabled]. Pass an explicit value
+ /// only when the caller genuinely wants to pin it.
public static Map<String, Object> generateControllerConf(String zkAddress,
String clusterName, String controllerHost,
- String controllerPort, String dataDir, ControllerConf.ControllerMode
controllerMode, boolean tenantIsolation)
+ String controllerPort, String dataDir, ControllerConf.ControllerMode
controllerMode,
+ @Nullable Boolean tenantIsolation)
throws SocketException, UnknownHostException {
if (StringUtils.isEmpty(zkAddress)) {
throw new RuntimeException("zkAddress cannot be empty.");
@@ -70,7 +78,9 @@ public class PinotConfigUtils {
properties.put(ControllerConf.DATA_DIR, !StringUtils.isEmpty(dataDir) ?
dataDir
: TMP_DIR + String.format("Controller_%s_%s/controller/data",
controllerHost, controllerPort));
properties.put(ControllerConf.CONTROLLER_VIP_HOST, controllerHost);
- properties.put(ControllerConf.CLUSTER_TENANT_ISOLATION_ENABLE,
tenantIsolation);
+ if (tenantIsolation != null) {
+ properties.put(ControllerConf.CLUSTER_TENANT_ISOLATION_ENABLE,
tenantIsolation);
+ }
properties.put(ControllerPeriodicTasksConf.RETENTION_MANAGER_FREQUENCY_PERIOD,
"6h");
properties.put(ControllerPeriodicTasksConf.OFFLINE_SEGMENT_INTERVAL_CHECKER_FREQUENCY_PERIOD,
"1h");
properties.put(ControllerPeriodicTasksConf.REALTIME_SEGMENT_VALIDATION_FREQUENCY_PERIOD,
"1h");
diff --git
a/pinot-tools/src/test/java/org/apache/pinot/tools/utils/PinotConfigUtilsTest.java
b/pinot-tools/src/test/java/org/apache/pinot/tools/utils/PinotConfigUtilsTest.java
index 55a9d0bccd3..8a05c544927 100644
---
a/pinot-tools/src/test/java/org/apache/pinot/tools/utils/PinotConfigUtilsTest.java
+++
b/pinot-tools/src/test/java/org/apache/pinot/tools/utils/PinotConfigUtilsTest.java
@@ -29,10 +29,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.pinot.controller.ControllerConf;
import org.testng.annotations.Test;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.testng.Assert.*;
public class PinotConfigUtilsTest {
@@ -61,6 +58,16 @@ public class PinotConfigUtilsTest {
assertEquals(config.get(ControllerConf.CLUSTER_TENANT_ISOLATION_ENABLE),
tenantIsolation);
}
+ @Test
+ public void testGenerateControllerConfWithoutTenantIsolation()
+ throws SocketException, UnknownHostException {
+ Map<String, Object> config = PinotConfigUtils.generateControllerConf(
+ "localhost:2181", "testCluster", "localhost", "9000", "/tmp/pinot",
ControllerConf.ControllerMode.DUAL, null);
+
+
assertFalse(config.containsKey(ControllerConf.CLUSTER_TENANT_ISOLATION_ENABLE));
+ assertEquals(config.get(ControllerConf.HELIX_CLUSTER_NAME), "testCluster");
+ }
+
@Test(expectedExceptions = RuntimeException.class)
public void testGenerateControllerConfWithEmptyZkAddress()
throws SocketException, UnknownHostException {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]