[
https://issues.apache.org/jira/browse/HDFS-15263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17075917#comment-17075917
]
Ayush Saxena commented on HDFS-15263:
-------------------------------------
{quote}For appending PATH_SEPARATOR_STR, I was referring to copy to a new
String and add the separator to it instead of modifying the input arg.
{quote}
{code:java}
protected static boolean isChildScope(final String parentScope,
final String childScope) {
String pScope = parentScope.endsWith(NodeBase.PATH_SEPARATOR_STR) ?
parentScope : parentScope + NodeBase.PATH_SEPARATOR_STR;
String cScope = childScope.endsWith(NodeBase.PATH_SEPARATOR_STR) ?
childScope : childScope + NodeBase.PATH_SEPARATOR_STR;
return pScope.startsWith(cScope);
}
{code}
Something like this shall works?
Couple of names that I can think of : isChildScope, checkScopeContains,
checkInScope, isSubScope, isScopeContained, Let me know if any of these sounds
better, spare me if any one of these sounds really bad. :)
> Fix the logic of scope and excluded scope in Network Topology
> -------------------------------------------------------------
>
> Key: HDFS-15263
> URL: https://issues.apache.org/jira/browse/HDFS-15263
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Ayush Saxena
> Assignee: Ayush Saxena
> Priority: Major
> Attachments: HDFS-15263-01.patch, HDFS-15263-02.patch,
> HDFS-15263-03.patch, HDFS-15263-04.patch
>
>
> If scope is d1 and excluded scope is d10, still scope will be starting with
> excluded scope, so by current logic it will return null, It should append
> Separator and then check.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]