Description
Looking at NotificationProcessor we see the following:
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); }
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:
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); }
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.