szetszwo commented on code in PR #10479:
URL: https://github.com/apache/ozone/pull/10479#discussion_r3478128613
##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/StreamBlockInputStream.java:
##########
@@ -340,6 +355,40 @@ private void handleExceptions(IOException cause) throws
IOException {
}
}
+ private IOException unwrapCause(IOException ex) {
+ Throwable t = ex;
+ while (t != null) {
+ if (t instanceof TimeoutIOException || t instanceof
StorageContainerException) {
+ return (IOException) t;
+ }
+ if (t instanceof ExecutionException && t.getCause() != null) {
+ t = t.getCause();
+ continue;
+ }
+ if (t.getCause() instanceof IOException) {
+ t = t.getCause();
+ continue;
+ }
+ break;
+ }
+ return ex;
+ }
+
+ private void recordFailedStreamingDatanode() {
+ if (streamingReader == null) {
+ return;
+ }
+ final StreamingReadResponse response = streamingReader.getResponse();
+ if (response == null) {
+ return;
+ }
+ final DatanodeDetails dn = response.getDatanodeDetails();
+ if (failedStreamingDatanodes.add(dn.getID())) {
+ LOG.warn("Excluding datanode {} (uuid={}) from streaming read retries
for block {}",
+ dn, dn.getUuidString(), blockID);
Review Comment:
Uuid is already included in dn.toString(). So, dn.getUuidString() is not
needed.
##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java:
##########
@@ -577,9 +578,22 @@ public void streamRead(ContainerCommandRequestProto
request,
@Override
public void initStreamRead(BlockID blockID, StreamingReaderSpi
streamObserver) throws IOException {
+ initStreamRead(blockID, streamObserver, Collections.emptySet());
+ }
+
+ /**
+ * Start a streaming read, skipping datanodes that previously failed for
this block stream.
+ */
+ public void initStreamRead(BlockID blockID, StreamingReaderSpi
streamObserver,
+ Set<DatanodeID> excludedDatanodes) throws IOException {
final List<DatanodeDetails> datanodeList = sortDatanodes(null,
ContainerProtos.Type.ReadBlock);
IOException lastException = null;
for (DatanodeDetails dn : datanodeList) {
+ if (excludedDatanodes.contains(dn.getID())) {
+ LOG.info("Skipping excluded datanode {} (uuid={}) for initStreamRead
{}",
Review Comment:
Let's change it to debug.
##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/StreamBlockInputStream.java:
##########
@@ -340,6 +355,40 @@ private void handleExceptions(IOException cause) throws
IOException {
}
}
+ private IOException unwrapCause(IOException ex) {
+ Throwable t = ex;
+ while (t != null) {
+ if (t instanceof TimeoutIOException || t instanceof
StorageContainerException) {
+ return (IOException) t;
+ }
+ if (t instanceof ExecutionException && t.getCause() != null) {
+ t = t.getCause();
+ continue;
+ }
+ if (t.getCause() instanceof IOException) {
+ t = t.getCause();
+ continue;
+ }
+ break;
+ }
+ return ex;
+ }
Review Comment:
Let's move it to ConnectionFailureUtils. Cc @kerneltime
--
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]