HDDS-6808. EC: Fix datanode exclusion check in client - #3460
Conversation
|
@guihecheng PTAL. |
|
How did this issue triggered in your case? I am wondering if there is a chance to add some coverage |
I found it by writing some very large key (40 GB) in a real cluster, and to many datanodes are excluded at some point. Maybe we can mock DN to return ContainerNotOpenException to test this? |
|
Got it, thats a good idea. We have mock datanode ( MockDatanodeStorage). We used it for failure testing. Ex: see TestOzoneECClient#testNodeFailuresWhileWriting |
|
Hi @umamaheswararao, I have added the test to detect this problem. |
|
Anyway we are marking nodes failed after key create and and getting the nodes which are part of pipeline. MultiNodePipelineBlockAllocator#allocateBlock is more predictable node selection. So, we will choose first required nodes for first allocate block and then next remaining nodes in order for next allocateBlock. So, by default we initialize this class with 15 nodes in cluster. So, if we just create one key with one block in it, it should always choose first required nodes. Probably you can create your own client like this test doing, so that other tests would not have used that nodes. |
| Assert.assertTrue(out.getOutputStream() instanceof ECKeyOutputStream); | ||
| ECKeyOutputStream ecKeyOut = (ECKeyOutputStream) out.getOutputStream(); | ||
|
|
||
| List<HddsProtos.DatanodeDetailsProto> dns = allocator.getClusterDns(); |
There was a problem hiding this comment.
This test using default initialized Allocator. One we marked some nodes failed, they may be reflected to other tests.
It would be good to have own allocator and client created for the failure related tests, so that state would not interfere with others.
|
@umamaheswararao Thanks for the advice, I have tested each of these 100x and it seems stable. |
|
Thanks for verifying. |
|
Thanks @umamaheswararao for the review. |
What changes were proposed in this pull request?
We should call HddsClientUtils.checkForException before calling checkIfContainerToExclude.
This bug was introduced in HDDS-6400 (#3372).
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-6808
How was this patch tested?