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/06/17 21:59:00 UTC

[jira] [Commented] (SENTRY-1807) NotificationProcessor may put the wrong path in the update

    [ https://issues.apache.org/jira/browse/SENTRY-1807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16053008#comment-16053008 ] 

Alexander Kolbasov commented on SENTRY-1807:
--------------------------------------------

This isn't a bug - parsePath() call above does the right thing stripping schema.

> NotificationProcessor may put the wrong path in the update
> ----------------------------------------------------------
>
>                 Key: SENTRY-1807
>                 URL: https://issues.apache.org/jira/browse/SENTRY-1807
>             Project: Sentry
>          Issue Type: Sub-task
>          Components: Sentry
>    Affects Versions: sentry-ha-redesign
>            Reporter: Alexander Kolbasov
>            Assignee: Alexander Kolbasov
>              Labels: sentry-ha
>             Fix For: sentry-ha-redesign
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> Looking at NotificationProcessor we see the following:
> {code}
>   private void addPaths(String authzObj, Collection<String> locations, long seqNum)
>         throws Exception {
>     // AuthzObj is case insensitive
>     authzObj = authzObj.toLowerCase();
>     PathsUpdate update = new PathsUpdate(seqNum, false);
>     Collection<String> paths = new HashSet<>(locations.size());
>     // addPath and persist into Sentry DB.
>     // Skip update if encounter malformed path.
>     for (String location : locations) {
>       String pathTree = getPath(location);
>         update.newPathChange(authzObj).addToAddPaths(splitPath(pathTree)); // --> Here
>         paths.add(pathTree);
>       }
>     }
>     sentryStore.addAuthzPathsMapping(authzObj, paths, update);
>   }
> {code}
> Here each path is added to the update. The problem is that splitPath doesn't remove the prefix (hdfs://) from the path so the update is incorrect.
> Original code did this:
> {code}
>   public void addPath(String authzObj, String path) {
>     List<String> pathTree = null;
>     pathTree = PathsUpdate.parsePath(path);
>     PathsUpdate update = createHMSUpdate();
>     update.newPathChange(authzObj.toLowerCase()).addToAddPaths(pathTree);
>     notifySentryAndApplyLocal(update);
>   }
> {code}
> here parsePath removed the prefix before the split on "/".  This was changed as part of SENTRY-1687. The change was ok for the full update but it seems that it is wrong for delta update.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)