You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by hu...@apache.org on 2020/08/14 18:13:58 UTC
[helix] 03/12: Remove unnecessary IOException
This is an automated email from the ASF dual-hosted git repository.
hulee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
commit 0a9584045a206313f4128ca3e6c96860bd7f76f7
Author: Hunter Lee <hu...@linkedin.com>
AuthorDate: Tue Jul 21 10:44:04 2020 -0700
Remove unnecessary IOException
---
.../org/apache/helix/manager/zk/ZKHelixAdmin.java | 19 +++++++------------
.../helix/zookeeper/routing/RoutingDataManager.java | 3 +--
.../helix/zookeeper/util/TestRoutingDataManager.java | 2 +-
3 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
index bce8105..348f8d8 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
@@ -966,19 +966,14 @@ public class ZKHelixAdmin implements HelixAdmin {
// If on multi-zk mode, we retrieve cluster information from Metadata Store Directory Service.
Map<String, List<String>> realmToShardingKeys;
String msdsEndpoint = _zkClient.getRealmAwareZkConnectionConfig().getMsdsEndpoint();
- try {
- if (msdsEndpoint == null || msdsEndpoint.isEmpty()) {
- realmToShardingKeys = RoutingDataManager.getRawRoutingData();
- } else {
- // TODO: Make RoutingDataReaderType configurable
- realmToShardingKeys =
- RoutingDataManager.getRawRoutingData(RoutingDataReaderType.HTTP, msdsEndpoint);
- }
- } catch (IOException e) {
- throw new HelixException(
- "ZKHelixAdmin: Failed to read raw routing data from Metadata Store Directory Service! MSDS endpoint used: "
- + msdsEndpoint, e);
+ if (msdsEndpoint == null || msdsEndpoint.isEmpty()) {
+ realmToShardingKeys = RoutingDataManager.getRawRoutingData();
+ } else {
+ // TODO: Make RoutingDataReaderType configurable
+ realmToShardingKeys =
+ RoutingDataManager.getRawRoutingData(RoutingDataReaderType.HTTP, msdsEndpoint);
}
+
if (realmToShardingKeys == null || realmToShardingKeys.isEmpty()) {
return Collections.emptyList();
}
diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/routing/RoutingDataManager.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/routing/RoutingDataManager.java
index f8aafb2..aa3986d 100644
--- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/routing/RoutingDataManager.java
+++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/routing/RoutingDataManager.java
@@ -61,9 +61,8 @@ public class RoutingDataManager {
* Fetches routing data from the data source via HTTP by querying the MSDS configured in the JVM
* config.
* @return
- * @throws IOException
*/
- public static Map<String, List<String>> getRawRoutingData() throws IOException {
+ public static Map<String, List<String>> getRawRoutingData() {
if (DEFAULT_MSDS_ENDPOINT == null || DEFAULT_MSDS_ENDPOINT.isEmpty()) {
throw new IllegalStateException(
"HttpRoutingDataReader was unable to find a valid MSDS endpoint String in System "
diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/util/TestRoutingDataManager.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/util/TestRoutingDataManager.java
index ad16fb3..e7d0c43 100644
--- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/util/TestRoutingDataManager.java
+++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/util/TestRoutingDataManager.java
@@ -66,7 +66,7 @@ public class TestRoutingDataManager extends ZkTestBase {
}
@Test
- public void testGetRawRoutingData() throws IOException {
+ public void testGetRawRoutingData() {
Map<String, List<String>> rawRoutingData = RoutingDataManager.getRawRoutingData();
TestConstants.FAKE_ROUTING_DATA.forEach((realm, keys) -> Assert
.assertEquals(new HashSet(rawRoutingData.get(realm)), new HashSet(keys)));