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 20:53:00 UTC
[jira] [Created] (SENTRY-1807) NotificationProcessor may put the
wrong path in the update
Alexander Kolbasov created SENTRY-1807:
------------------------------------------
Summary: 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
Fix For: sentry-ha-redesign
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)