[ 
https://issues.apache.org/jira/browse/HDFS-17471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17841880#comment-17841880
 ] 

ASF GitHub Bot commented on HDFS-17471:
---------------------------------------

Hexiaoqiao commented on code in PR #6742:
URL: https://github.com/apache/hadoop/pull/6742#discussion_r1582649920


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ProfilingFileIoEvents.java:
##########
@@ -80,7 +80,7 @@ public void afterMetadataOp(@Nullable FsVolumeSpi volume,
 
   public long beforeFileIo(@Nullable FsVolumeSpi volume,
       FileIoProvider.OPERATION op, long len) {
-    if (isEnabled && ThreadLocalRandom.current().nextInt() < sampleRangeMax) {
+    if (isEnabled && ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE) < 
sampleRangeMax) {

Review Comment:
   Great catch! some other same logic should be corrected too, such as 
org.apache.hadoop.hdfs.client.impl.metrics.BlockReaderIoProvider#read, please 
also check them together.





> Correct the percentage of file I/O events.
> ------------------------------------------
>
>                 Key: HDFS-17471
>                 URL: https://issues.apache.org/jira/browse/HDFS-17471
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs
>            Reporter: fuchaohong
>            Priority: Major
>              Labels: pull-request-available
>
> The percentage of file I/O events to be profiled for DataNode disk statistics 
> is inaccurate.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to