fannaihao opened a new pull request, #6722:
URL: https://github.com/apache/hadoop/pull/6722

   <!--
     Thanks for sending a pull request!
       1. If this is your first time, please read our contributor guidelines: 
https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
       2. Make sure your PR title starts with JIRA issue id, e.g., 
'HADOOP-17799. Your PR title ...'.
   -->
   
   ### Description of PR
   When trg of Router concat is an empty file, it will trigger NPE in Router, 
and the concat will fail, example:
   
![image](https://github.com/apache/hadoop/assets/40593494/4edc0aed-08ee-4e1d-8236-84c20f61d15d)
   
   This is because when trg is an empty file, NameNode will return 
lastLocatedBlock as null in the response of getBlockLocations. And Router will 
not check null of lastLocatedBlock returned, instead Router will use it to get 
block pool id directly.
   Trg of concat is an empty file should be allowed in router since this case 
is supported by concat of NameNode.
   This PR fix this NPE exception.
   
   ### How was this patch tested?
   
![image](https://github.com/apache/hadoop/assets/40593494/23a46672-cd3a-4a54-8f4d-9c833b2d560c)
   
   
   ### For code changes:
   If lastLocatedBlock returned from getBlockLocations is null in Router 
concat, it will not be used to get block pool id.
   In this case, the block pool id check of trg will be delayed, i.e., concat 
continues to get and check block pool id of files in src, and only check them.
   And the check of trg block pool id can be achieved in following steps, i.e., 
getLocationForPath and the request of concat forwarded to NameNode.
   And exceptions will be thrown if block pool id of trg is not match with the 
block pool id of any file in src.
   
   - [ ] Does the title or this PR starts with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: have the integration tests been executed and the 
endpoint declared according to the connector-specific documentation?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   


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