ayushtkn commented on code in PR #6566:
URL: https://github.com/apache/hadoop/pull/6566#discussion_r1509893467
##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java:
##########
@@ -414,6 +414,10 @@ synchronized void markFirstNodeIfNotMarked() {
}
synchronized void adjustState4RestartingNode() {
+ if (restartingNodeIndex == -1) {
+ return;
+ }
+
Review Comment:
Thanx, I checked the PR, the failure is due to ArrayIndexBound in our new
code
```
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at
org.apache.hadoop.hdfs.DataStreamer.setupPipelineForCreate(DataStreamer.java:1848)
at org.apache.hadoop.hdfs.DataStreamer.run(DataStreamer.java:751)
```
Because we need the badNode & we are extracting like:
```
final DatanodeInfo badNode = nodes[errorState.getBadNodeIndex()];
```
The badNodeIndex is reset to -1, post this check, but the node is stored in
the ``failed`` arraylist, can you extract the badNode from the ``failed``
ArrayList rather than tweaking this logic?
Maybe something like this
```
final DatanodeInfo badNode = Iterables.getLast(failed);
```
--
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]