-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-8090. When getBlock from a datanode fails, retry other datanodes. #4357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
167466b
8498897
caf94f1
40cee9d
77fc54a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,6 +105,48 @@ public XceiverClientReply sendCommandAsync( | |
| } | ||
| } | ||
|
|
||
| @Test | ||
| @Timeout(5) | ||
| public void testGetBlockRetryAlNodes() { | ||
| final ArrayList<DatanodeDetails> allDNs = new ArrayList<>(dns); | ||
| Assertions.assertTrue(allDNs.size() > 1); | ||
| try (XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated, but looks like the existing tests cases don't close XceiverClientGrpc, potentially leaking resources.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, let me fix the existing problems. |
||
| @Override | ||
| public XceiverClientReply sendCommandAsync( | ||
| ContainerProtos.ContainerCommandRequestProto request, | ||
| DatanodeDetails dn) throws IOException { | ||
| allDNs.remove(dn); | ||
| throw new IOException("Failed " + dn); | ||
| } | ||
| }) { | ||
| invokeXceiverClientGetBlock(client); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| Assertions.assertEquals(0, allDNs.size()); | ||
| } | ||
|
|
||
| @Test | ||
| @Timeout(5) | ||
| public void testReadChunkRetryAllNodes() { | ||
| final ArrayList<DatanodeDetails> allDNs = new ArrayList<>(dns); | ||
| Assertions.assertTrue(allDNs.size() > 1); | ||
| try (XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf) { | ||
| @Override | ||
| public XceiverClientReply sendCommandAsync( | ||
| ContainerProtos.ContainerCommandRequestProto request, | ||
| DatanodeDetails dn) throws IOException { | ||
| allDNs.remove(dn); | ||
| throw new IOException("Failed " + dn); | ||
| } | ||
| }) { | ||
| invokeXceiverClientReadChunk(client); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| Assertions.assertEquals(0, allDNs.size()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testFirstNodeIsCorrectWithTopologyForCommandTarget() | ||
| throws IOException { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO a getXXX() method typically implies a O( 1 ) operation. It would be better off to rename it, such as toValidatorList() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true for TreeMap.get(..), LinkedList.get(..), etc. But I am okay to do the rename.