Skip to content

Commit b8eec29

Browse files
[admin-tool] Remove D2 usage from Admin tool (linkedin#2145)
We are migrating away from using D2 for controller and will rely on URL-routing and DNS-based service discovery. This change removes D2 usage from Admin tool
1 parent 0c6a5b0 commit b8eec29

2 files changed

Lines changed: 4 additions & 19 deletions

File tree

clients/venice-admin-tool/src/main/java/com/linkedin/venice/AdminTool.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import com.linkedin.venice.controllerapi.ControllerClient;
3535
import com.linkedin.venice.controllerapi.ControllerClientFactory;
3636
import com.linkedin.venice.controllerapi.ControllerResponse;
37-
import com.linkedin.venice.controllerapi.D2ControllerClient;
3837
import com.linkedin.venice.controllerapi.D2ServiceDiscoveryResponse;
3938
import com.linkedin.venice.controllerapi.JobStatusQueryResponse;
4039
import com.linkedin.venice.controllerapi.MigrationPushStrategyResponse;
@@ -72,7 +71,6 @@
7271
import com.linkedin.venice.controllerapi.VersionCreationResponse;
7372
import com.linkedin.venice.controllerapi.VersionResponse;
7473
import com.linkedin.venice.controllerapi.routes.AdminCommandExecutionResponse;
75-
import com.linkedin.venice.d2.D2ClientFactory;
7674
import com.linkedin.venice.datarecovery.DataRecoveryClient;
7775
import com.linkedin.venice.datarecovery.EstimateDataRecoveryTimeCommand;
7876
import com.linkedin.venice.datarecovery.MonitorCommand;
@@ -2081,7 +2079,7 @@ public static void checkMigrationStatus(
20812079

20822080
ChildAwareResponse response = srcControllerClient.listChildControllers(srcClusterName);
20832081

2084-
if (response.getChildDataCenterControllerUrlMap() == null && response.getChildDataCenterControllerD2Map() == null) {
2082+
if (response.getChildDataCenterControllerUrlMap() == null) {
20852083
// This is a controller in single datacenter setup
20862084
printMigrationStatus(srcControllerClient, storeName, printFunction);
20872085
printMigrationStatus(destControllerClient, storeName, printFunction);
@@ -2127,7 +2125,7 @@ private static void completeMigration(CommandLine cmd) {
21272125
checkPreconditionForStoreMigration(srcControllerClient, destControllerClient);
21282126

21292127
ChildAwareResponse response = destControllerClient.listChildControllers(destClusterName);
2130-
if (response.getChildDataCenterControllerUrlMap() == null && response.getChildDataCenterControllerD2Map() == null) {
2128+
if (response.getChildDataCenterControllerUrlMap() == null) {
21312129
// This is a controller in single datacenter setup
21322130
System.out.println("WARN: fabric option is ignored on child controller.");
21332131
if (isClonedStoreOnline(srcControllerClient, destControllerClient, storeName)) {
@@ -2262,17 +2260,6 @@ private static Map<String, ControllerClient> getControllerClientMap(String clust
22622260
.forEach(
22632261
(key, value) -> controllerClientMap.put(key, new ControllerClient(clusterName, value, sslFactory)));
22642262
}
2265-
if (response.getChildDataCenterControllerD2Map() != null) {
2266-
// TODO: D2Client
2267-
response.getChildDataCenterControllerD2Map()
2268-
.forEach(
2269-
(key, value) -> controllerClientMap.put(
2270-
key,
2271-
new D2ControllerClient(
2272-
response.getD2ServiceName(),
2273-
clusterName,
2274-
D2ClientFactory.getD2Client(value, sslFactory))));
2275-
}
22762263
return controllerClientMap;
22772264
});
22782265
}
@@ -3306,8 +3293,7 @@ private static void endFabricBuildout(CommandLine cmd) {
33063293
String clusterName = getRequiredArgument(cmd, Arg.CLUSTER);
33073294
try {
33083295
ChildAwareResponse response = checkControllerResponse(controllerClient.listChildControllers(clusterName));
3309-
if (response.getChildDataCenterControllerUrlMap() == null
3310-
&& response.getChildDataCenterControllerD2Map() == null) {
3296+
if (response.getChildDataCenterControllerUrlMap() == null) {
33113297
throw new VeniceException("ERROR: Child controller could not run fabric buildout commands");
33123298
}
33133299
System.out.println("Enabling store migration from/to cluster " + clusterName);
@@ -3686,7 +3672,7 @@ private static Map<String, ControllerClient> getAndCheckChildControllerClientMap
36863672
String srcFabric,
36873673
String destFabric) {
36883674
ChildAwareResponse response = checkControllerResponse(controllerClient.listChildControllers(clusterName));
3689-
if (response.getChildDataCenterControllerUrlMap() == null && response.getChildDataCenterControllerD2Map() == null) {
3675+
if (response.getChildDataCenterControllerUrlMap() == null) {
36903676
throw new VeniceException("ERROR: Child controller could not run fabric buildout commands");
36913677
}
36923678
Map<String, ControllerClient> childControllerClientMap = getControllerClientMap(clusterName, response);

clients/venice-admin-tool/src/test/java/com/linkedin/venice/TestCheckMigrationStatus.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public void testCheckMigrationStatus() throws ParseException, IOException {
4040
mockMultiStoreResponse.setStores(new String[] { SYSTEM_STORE_NAME, STORE_NAME });
4141
ChildAwareResponse mockChildAwareResponse = Mockito.mock(ChildAwareResponse.class);
4242
Mockito.when(mockChildAwareResponse.getChildDataCenterControllerUrlMap()).thenReturn(new HashMap<>());
43-
Mockito.when(mockChildAwareResponse.getChildDataCenterControllerD2Map()).thenReturn(new HashMap<>());
4443
Mockito.when(mockSourceControllerClient.listChildControllers(SRC_CLUSTER_NAME)).thenReturn(mockChildAwareResponse);
4544
Mockito.when(mockStoreResponse.getStore()).thenReturn(mockStoreInfo);
4645
Mockito.when(mockSourceControllerClient.getStore(STORE_NAME)).thenReturn(mockStoreResponse);

0 commit comments

Comments
 (0)