ayushtkn commented on code in PR #6091:
URL: https://github.com/apache/hadoop/pull/6091#discussion_r1355790939
##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java:
##########
@@ -477,7 +477,10 @@ int getDatanodeWriteTimeout(int numNodes) {
int getDatanodeReadTimeout(int numNodes) {
final int t = dfsClientConf.getSocketTimeout();
- return t > 0? HdfsConstants.READ_TIMEOUT_EXTENSION*numNodes + t: 0;
+ int readTimeout = HdfsConstants.READ_TIMEOUT_EXTENSION*numNodes + t;
+ Preconditions.checkArgument(readTimeout >= 0,
+ "Read timeout should be non-negative.");
+ return t > 0? readTimeout: 0;
Review Comment:
should be something like?
```
int getDatanodeReadTimeout(int numNodes) {
final int t = dfsClientConf.getSocketTimeout();
if (t > 0) {
int readTimeout = HdfsConstants.READ_TIMEOUT_EXTENSION * numNodes + t;
Preconditions.checkArgument(readTimeout >= 0, "Read timeout should be
non-negative.");
return readTimeout;
}
return 0;
}
```
--
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]