LiuGuH commented on code in PR #6291:
URL: https://github.com/apache/hadoop/pull/6291#discussion_r1404159749


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/MountTableResolver.java:
##########
@@ -357,7 +357,7 @@ public void refreshEntries(final Collection<MountTable> 
entries) {
   @VisibleForTesting
   public static boolean isTrashPath(String path) throws IOException {
     Pattern pattern = Pattern.compile(
-        "^" + getTrashRoot() + TRASH_PATTERN + "/");
+        "^" + getTrashRoot() + TRASH_PATTERN);

Review Comment:
   In  other word, if client listStatus trashpath like 
'/user/test-trash/.Trash/Current',  this is not consider a trash path
   `   if (isTrashPath(path)) {
         path = subtractTrashCurrentPath(path);
       }`
   
   And then it will not find any mountpoint for this trash path,and only return 
defalut nameservice mountpoint
   
   ` public PathLocation getDestinationForPath(final String path)
         throws IOException {
       verifyMountTable();
       PathLocation res;
       readLock.lock();
       try {
         if (this.locationCache == null) {
           res = lookupLocation(processTrashPath(path));
         } else {
           Callable<? extends PathLocation> meh = (Callable<PathLocation>) () 
-> {
             this.getLocCacheMiss().increment();
             return lookupLocation(processTrashPath(path));
           };
           res = this.locationCache.get(processTrashPath(path), meh);
           this.getLocCacheAccess().increment();
         }
         if (isTrashPath(path)) {
           List<RemoteLocation> remoteLocations = new ArrayList<>();
           for (RemoteLocation remoteLocation : res.getDestinations()) {
             remoteLocations.add(new RemoteLocation(remoteLocation, path));
           }
           return new PathLocation(path, remoteLocations,
               res.getDestinationOrder());
         } else {
           return res;
         }
       } catch (ExecutionException e) {
         Throwable cause = e.getCause();
         final IOException ioe;
         if (cause instanceof IOException) {
           ioe = (IOException) cause;
         } else {
           ioe = new IOException(cause);
         }
         throw ioe;
       } finally {
         readLock.unlock();
       }
     }`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to