Akira Ajisaka Thanks for your comments and your patience.
When setting maxDataLength, would you use dnConf instead of dn.getConf()? Null check is not needed.
Agree to use dnConf instead of dn.getConf(). But the null check can not be deleted. I've found some code from TestDatanodeRegister#setUpsetUp
DataNode mockDN = mock(DataNode.class);
it uses mock to test some functions. I've no knowledge about mock in unit test, but it will cause nullpoint exception when I write code in BPServiceActor like this:
I hope to get your thoughts before I upload v5 patch.
Thank you again for your time.