Skip to content

Commit

Permalink
[controller] Merge VeniceControllerConfig and VeniceControllerCluster…
Browse files Browse the repository at this point in the history
…Config (linkedin#1070)

Today, in controllers, we have two classes of configs which serve the same purpose, and it is unnecessary to maintain both. This commit merges "VeniceControllerConfig" and "VeniceControllerClusterConfig".
  • Loading branch information
nisargthakkar authored Jul 22, 2024
1 parent 979fd05 commit 620ee8d
Show file tree
Hide file tree
Showing 36 changed files with 1,416 additions and 1,451 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private ConfigKeys() {

// Controller specific configs
public static final String CONTROLLER_CLUSTER_ZK_ADDRESSS = "controller.cluster.zk.address";
/** Cluster name for all parent controllers */
// Name of the Helix cluster for controllers
public static final String CONTROLLER_CLUSTER = "controller.cluster.name";

/** List of forbidden admin paths */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class AbstractTestVeniceHelixAdmin {
VeniceHelixAdmin veniceAdmin;
String clusterName;
String storeOwner = "Doge of Venice";
VeniceControllerConfig controllerConfig;
VeniceControllerClusterConfig controllerConfig;
String zkAddress;
ZkServerWrapper zkServerWrapper;
PubSubBrokerWrapper pubSubBrokerWrapper;
Expand Down Expand Up @@ -104,7 +104,7 @@ public void setupCluster(boolean createParticipantStore, MetricsRepository metri
properties.put(UNREGISTER_METRIC_FOR_DELETED_STORE_ENABLED, true);
controllerProps = new VeniceProperties(properties);
helixMessageChannelStats = new HelixMessageChannelStats(new MetricsRepository(), clusterName);
controllerConfig = new VeniceControllerConfig(controllerProps);
controllerConfig = new VeniceControllerClusterConfig(controllerProps);
multiClusterConfig = TestUtils.getMultiClusterConfigFromOneCluster(controllerConfig);
veniceAdmin = new VeniceHelixAdmin(
multiClusterConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void testControllerFailOver() throws Exception {
int newAdminPort = controllerConfig.getAdminPort() + 1; /* Note: this is a dummy port */
PropertyBuilder builder = new PropertyBuilder().put(controllerProps.toProperties()).put("admin.port", newAdminPort);
VeniceProperties newControllerProps = builder.build();
VeniceControllerConfig newConfig = new VeniceControllerConfig(newControllerProps);
VeniceControllerClusterConfig newConfig = new VeniceControllerClusterConfig(newControllerProps);
VeniceHelixAdmin newAdmin = new VeniceHelixAdmin(
TestUtils.getMultiClusterConfigFromOneCluster(newConfig),
new MetricsRepository(),
Expand Down Expand Up @@ -313,7 +313,7 @@ public void testGetLeaderController() {
int newAdminPort = controllerConfig.getAdminPort() - 10;
PropertyBuilder builder = new PropertyBuilder().put(controllerProps.toProperties()).put("admin.port", newAdminPort);
VeniceProperties newControllerProps = builder.build();
VeniceControllerConfig newConfig = new VeniceControllerConfig(newControllerProps);
VeniceControllerClusterConfig newConfig = new VeniceControllerClusterConfig(newControllerProps);
VeniceHelixAdmin newLeaderAdmin = new VeniceHelixAdmin(
TestUtils.getMultiClusterConfigFromOneCluster(newConfig),
new MetricsRepository(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void testIsLeaderController() {
PropertyBuilder builder = new PropertyBuilder().put(controllerProps.toProperties()).put("admin.port", newAdminPort);

VeniceProperties newControllerProps = builder.build();
VeniceControllerConfig newConfig = new VeniceControllerConfig(newControllerProps);
VeniceControllerClusterConfig newConfig = new VeniceControllerClusterConfig(newControllerProps);
VeniceHelixAdmin newLeaderAdmin = new VeniceHelixAdmin(
TestUtils.getMultiClusterConfigFromOneCluster(newConfig),
new MetricsRepository(),
Expand Down Expand Up @@ -183,7 +183,7 @@ public void testMultiCluster() {
new PropertyBuilder().put(controllerProps.toProperties()).put("cluster.name", newClusterName);

VeniceProperties newClusterProps = builder.build();
VeniceControllerConfig newClusterConfig = new VeniceControllerConfig(newClusterProps);
VeniceControllerClusterConfig newClusterConfig = new VeniceControllerClusterConfig(newClusterProps);
veniceAdmin.addConfig(newClusterConfig);
veniceAdmin.initStorageCluster(newClusterName);
waitUntilIsLeader(veniceAdmin, newClusterName, LEADER_CHANGE_TIMEOUT_MS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private HelixVeniceClusterResources getVeniceHelixResources(String cluster, Metr
.getReadOnlyZKSharedSystemStoreRepository();
doReturn(mock(HelixReadOnlyZKSharedSchemaRepository.class)).when(veniceHelixAdmin)
.getReadOnlyZKSharedSchemaRepository();
VeniceControllerConfig controllerConfig = mock(VeniceControllerConfig.class);
VeniceControllerClusterConfig controllerConfig = mock(VeniceControllerClusterConfig.class);
when(controllerConfig.getDaVinciPushStatusScanThreadNumber()).thenReturn(4);
when(controllerConfig.getDaVinciPushStatusScanIntervalInSeconds()).thenReturn(5);
when(controllerConfig.isDaVinciPushStatusEnabled()).thenReturn(true);
Expand All @@ -67,7 +67,7 @@ private HelixVeniceClusterResources getVeniceHelixResources(String cluster, Metr
zkClient,
new HelixAdapterSerializer(),
new SafeHelixManager(controller),
mock(VeniceControllerConfig.class),
mock(VeniceControllerClusterConfig.class),
veniceHelixAdmin,
metricsRepository,
mock(RealTimeTopicSwitcher.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.linkedin.venice.compression.NoopCompressor;
import com.linkedin.venice.compression.VeniceCompressor;
import com.linkedin.venice.compression.ZstdWithDictCompressor;
import com.linkedin.venice.controller.VeniceControllerConfig;
import com.linkedin.venice.controller.VeniceControllerClusterConfig;
import com.linkedin.venice.controller.VeniceControllerMultiClusterConfig;
import com.linkedin.venice.controllerapi.ControllerClient;
import com.linkedin.venice.controllerapi.ControllerResponse;
Expand Down Expand Up @@ -545,8 +545,8 @@ public static OffsetRecord getOffsetRecord(long currentOffset, Optional<Long> en
}

public static VeniceControllerMultiClusterConfig getMultiClusterConfigFromOneCluster(
VeniceControllerConfig controllerConfig) {
Map<String, VeniceControllerConfig> configMap = new HashMap<>();
VeniceControllerClusterConfig controllerConfig) {
Map<String, VeniceControllerClusterConfig> configMap = new HashMap<>();
configMap.put(controllerConfig.getClusterName(), controllerConfig);
return new VeniceControllerMultiClusterConfig(configMap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public HelixVeniceClusterResources(
ZkClient zkClient,
HelixAdapterSerializer adapterSerializer,
SafeHelixManager helixManager,
VeniceControllerConfig config,
VeniceControllerClusterConfig config,
VeniceHelixAdmin admin,
MetricsRepository metricsRepository,
RealTimeTopicSwitcher realTimeTopicSwitcher,
Expand Down Expand Up @@ -209,7 +209,7 @@ public HelixVeniceClusterResources(
new StoragePersonaRepository(clusterName, this.storeMetadataRepository, adapterSerializer, zkClient);
}

private List<String> getActiveActiveRealTimeSourceKafkaURLs(VeniceControllerConfig config) {
private List<String> getActiveActiveRealTimeSourceKafkaURLs(VeniceControllerClusterConfig config) {
List<String> kafkaURLs = new ArrayList<>(config.getActiveActiveRealTimeSourceFabrics().size());
for (String fabric: config.getActiveActiveRealTimeSourceFabrics()) {
String kafkaURL = config.getChildDataCenterKafkaUrlMap().get(fabric);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void run() {
time.sleep((long) sleepIntervalBetweenListFetchMinutes * Time.MS_PER_MINUTE);
// loop all clusters
for (String clusterName: multiClusterConfig.getClusters()) {
VeniceControllerConfig clusterConfig = multiClusterConfig.getControllerConfig(clusterName);
VeniceControllerClusterConfig clusterConfig = multiClusterConfig.getControllerConfig(clusterName);
boolean cleanupEnabled = clusterConfig.isStoreGraveyardCleanupEnabled();
int delayInMinutes = clusterConfig.getStoreGraveyardCleanupDelayMinutes();
if (!cleanupEnabled || !admin.isLeaderControllerFor(clusterName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public UserSystemStoreLifeCycleHelper(
this.parentAdmin = parentAdmin;
this.authorizerService = authorizerService;
for (String cluster: multiClusterConfig.getClusters()) {
VeniceControllerConfig controllerConfig = multiClusterConfig.getControllerConfig(cluster);
VeniceControllerClusterConfig controllerConfig = multiClusterConfig.getControllerConfig(cluster);
Set<VeniceSystemStoreType> autoCreateEnabledSystemStores = new HashSet<>();
if (controllerConfig.isZkSharedMetaSystemSchemaStoreAutoCreationEnabled()
&& controllerConfig.isAutoMaterializeMetaSystemStoreEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ public void start() {

private void initializeSystemSchema(Admin admin) {
String systemStoreCluster = multiClusterConfigs.getSystemSchemaClusterName();
VeniceControllerConfig systemStoreClusterConfig = multiClusterConfigs.getControllerConfig(systemStoreCluster);
VeniceControllerClusterConfig systemStoreClusterConfig =
multiClusterConfigs.getControllerConfig(systemStoreCluster);
if (!multiClusterConfigs.isParent() && systemStoreClusterConfig.isSystemSchemaInitializationAtStartTimeEnabled()) {
String regionName = systemStoreClusterConfig.getRegionName();
String childControllerUrl = systemStoreClusterConfig.getChildControllerUrl(regionName);
Expand Down
Loading

0 comments on commit 620ee8d

Please sign in to comment.