XorSum commented on PR #8179:
URL: https://github.com/apache/hadoop/pull/8179#issuecomment-3744010793

   > Good corner case catch. Just wonder in what case that request one path 
which is not in mount point frequently. Thanks.
   
   Thanks for the question! This issue occurs not only when paths are 
completely unmounted, but also **when querying sibling directories** that don't 
have mount points. Let me provide a concrete example:
   
   ### Example
   
   Assume the default namespace is `ns1`, and we have mount points configured 
like this:
   
   ```
   ns2  /user/hive/warehouse/default.db
   ns2  /user/hive/warehouse/default.db/aaa
   ns2  /user/hive/warehouse/default.db/bbb
   ns2  /user/hive/warehouse/default.db/ccc
   ...
   ns2  /user/hive/warehouse/default.db/xxx
   ns2  /user/hive/warehouse/default.db/yyy
   ```
   
   
   Now, consider a query for path: `/user/hive/warehouse/default.db/zzz`
   
   ### What Happens with the Original Method
   
   1. `floorEntry("/user/hive/warehouse/default.db/zzz")` returns 
`/user/hive/warehouse/default.db/yyy`
   2. Check `isParentEntry()` → false (yyy is a sibling, not a parent)
   3. Call `lowerEntry()` → returns `/user/hive/warehouse/default.db/xxx`
   4. Check `isParentEntry()` → false
   5. Keep calling `lowerEntry()` → iterates through `xxx`, `www`, ..., `ccc`, 
`bbb`, `aaa`
   6. Finally finds `/user/hive/warehouse/default.db/` (the actual parent)
   
   The original method iterates through all sibling directories (yyy → xxx → 
... → aaa) before finding the parent mount point.
   
   However, the  improved method avoids this by walking up the path hierarchy 
directly:
   `/user/hive/warehouse/default.db/zzz` → `/user/hive/warehouse/default.db`.


-- 
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