You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sentry.apache.org by "Alexander Kolbasov (JIRA)" <ji...@apache.org> on 2017/04/07 04:26:41 UTC
[jira] [Commented] (SENTRY-1698) PathsUpdate.parsePath() calls
FileSystem.getDefaultUri() way too often
[ https://issues.apache.org/jira/browse/SENTRY-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15960259#comment-15960259 ]
Alexander Kolbasov commented on SENTRY-1698:
--------------------------------------------
Subsequent code is interesting as well:
{code}
String scheme = uri.getScheme();
if (scheme == null) {
// Use the default URI scheme only if the path has no scheme.
URI defaultUri = FileSystem.getDefaultUri(CONF);
scheme = defaultUri.getScheme();
if(scheme == null) {
String msg = "Scheme is missing and could not be constructed from defaultURI=" + defaultUri;
throw new SentryMalformedPathException(msg);
}
}
{code}
The scheme here is always the same since defaultUri never changes. And we can detect that scheme==null right at the constructor rather then delay until we start parsing strings. And, of course, scheme == null has nothing to do with SentryMalformedPathException.
> PathsUpdate.parsePath() calls FileSystem.getDefaultUri() way too often
> ----------------------------------------------------------------------
>
> Key: SENTRY-1698
> URL: https://issues.apache.org/jira/browse/SENTRY-1698
> Project: Sentry
> Issue Type: Bug
> Components: Sentry
> Affects Versions: 1.8.0, sentry-ha-redesign
> Reporter: Alexander Kolbasov
> Labels: bite-sized, newbie
>
> The PathsUpdate#parsePath() method has the following code:
> {code}
> String scheme = uri.getScheme();
> if (scheme == null) {
> // Use the default URI scheme only if the path has no scheme.
> URI defaultUri = FileSystem.getDefaultUri(CONF);
> {code}
> The default URI never changes so there is no need to call FileSystem.getDefaultUri(CONF) for each input string which doesn't have URI. This should be done once in constructor.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)