cxzl25 commented on code in PR #8976:
URL: https://github.com/apache/hadoop/pull/8976#discussion_r4610576492


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java:
##########
@@ -319,6 +319,8 @@ private void connectToNNAndHandshake() throws IOException {
 
     /* set thread name again to include NamespaceInfo when it's available. */
     this.bpThread.setName(formatThreadName("heartbeating", nnAddr));
+    this.commandProcessingThread.setName(

Review Comment:
   Thanks for the review!
   
   `CommandProcessingThread` is created and started in the `BPServiceActor` 
constructor, before the handshake, so the block pool ID is not available yet 
and `formatThreadName` falls back to the nameservice ID. 
`BPOfferService#getNameserviceId` can be null (e.g. a non-federated, non-HA 
deployment without `dfs.nameservices`), so the thread name changes like this:
   
   | | Thread name |
   |---|---|
   | Before the handshake | `null Command processor to nn-host:8020` |
   | After the handshake, with the rename | `BP-xxx Command processor to 
nn-host:8020` |
   | After the handshake, without the rename | `null Command processor to 
nn-host:8020` |
   
   With `dfs.nameservices` configured, the prefix changes from the nameservice 
ID (e.g. `ns1`) to the block pool ID in the same way.
   
   This follows HDFS-11558, which switched the prefix to the block pool ID and 
added the same rename for the heartbeating thread, because the block pool ID is 
only available after the handshake.



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