dongjoon-hyun commented on code in PR #7063:
URL: https://github.com/apache/hadoop/pull/7063#discussion_r1836973959


##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PacketReceiver.java:
##########
@@ -162,8 +162,10 @@ private void doRead(ReadableByteChannel ch, InputStream in)
 
     // Sanity check the buffer size so we don't allocate too much memory
     // and OOME.
+    int maxPacketSize = MAX_PACKET_SIZE == 0 ?
+        HdfsClientConfigKeys.DFS_DATA_TRANSFER_MAX_PACKET_SIZE_DEFAULT : 
MAX_PACKET_SIZE;
     int totalLen = payloadLen + headerLen;
-    if (totalLen < 0 || totalLen > MAX_PACKET_SIZE) {
+    if (totalLen < 0 || totalLen > maxPacketSize) {

Review Comment:
   Why do we check this static final variable, `MAX_PACKET_SIZE`,  at this 
runtime layer instead of the initialization ?
   
   
https://github.com/apache/hadoop/blob/9a743bd17f55245841db3de5d1c785282306d408/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PacketReceiver.java#L80-L85



-- 
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]

Reply via email to