[
https://issues.apache.org/jira/browse/GOBBLIN-1341?focusedWorklogId=525687&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-525687
]
ASF GitHub Bot logged work on GOBBLIN-1341:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 17/Dec/20 19:33
Start Date: 17/Dec/20 19:33
Worklog Time Spent: 10m
Work Description: aplex commented on a change in pull request #3177:
URL: https://github.com/apache/incubator-gobblin/pull/3177#discussion_r545350249
##########
File path:
gobblin-utility/src/main/java/org/apache/gobblin/util/ClustersNames.java
##########
@@ -97,21 +110,34 @@ public void addClusterMapping(URL clusterUrl, String
clusterName) {
this.urlToNameMap.put(clusterUrl.toString(), clusterName);
}
- // Strip out the port number if it is a valid URI
- private static String normalizeClusterUrl(String clusterIdentifier) {
+ private static List<String> generateUrlMatchCandidates(String
clusterIdentifier) {
+ ArrayList<String> candidates = new ArrayList<>();
+ candidates.add(clusterIdentifier);
+
try {
URI uri = new URI(clusterIdentifier.trim());
- // URIs without protocol prefix
- if (!uri.isOpaque() && null != uri.getHost()) {
- clusterIdentifier = uri.getHost();
+ if (uri.getHost() != null) {
+ if (uri.getPort() != -1) {
+ candidates.add(uri.getHost() + ":" + uri.getPort());
+ }
+
+ candidates.add(uri.getHost());
+ } else if (uri.getScheme() != null && uri.getPath() != null) {
+ // we have a scheme and a path, but not the host name
+ // assuming local host
+ candidates.add("localhost");
} else {
- clusterIdentifier = uri.toString().replaceAll("[/:]","
").trim().replaceAll(" ", "_");
+ candidates.add(getNormalizedName(clusterIdentifier));
}
} catch (URISyntaxException e) {
- //leave ID as is
+ candidates.add(getNormalizedName(clusterIdentifier));
}
- return clusterIdentifier;
+ return candidates;
+ }
+
+ private static String getNormalizedName(String clusterIdentifier) {
Review comment:
Added logic explanation to getClusterName(String). Let me know if it is
sufficiently clear there.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 525687)
Time Spent: 1h 10m (was: 1h)
> Make cluster name resolution more robust
> ----------------------------------------
>
> Key: GOBBLIN-1341
> URL: https://issues.apache.org/jira/browse/GOBBLIN-1341
> Project: Apache Gobblin
> Issue Type: Improvement
> Components: gobblin-core
> Reporter: Alex Prokofiev
> Assignee: Abhishek Tiwari
> Priority: Minor
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)