This is an automated email from the ASF dual-hosted git repository.

hexiaoqiao pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ddb805951ecd HDFS-17471. Correct the percentage of sample range. 
(#6742). Contributed by fuchaohong.
ddb805951ecd is described below

commit ddb805951ecd7602926afbc024fcb83794bc8489
Author: fuchaohong <1783129...@qq.com>
AuthorDate: Tue Apr 30 12:18:47 2024 +0800

    HDFS-17471. Correct the percentage of sample range. (#6742). Contributed by 
fuchaohong.
    
    Signed-off-by: He Xiaoqiao <hexiaoq...@apache.org>
---
 .../apache/hadoop/hdfs/client/impl/metrics/BlockReaderIoProvider.java   | 2 +-
 .../org/apache/hadoop/hdfs/server/datanode/ProfilingFileIoEvents.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/metrics/BlockReaderIoProvider.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/metrics/BlockReaderIoProvider.java
index 0792db80b623..7e535a071dfa 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/metrics/BlockReaderIoProvider.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/metrics/BlockReaderIoProvider.java
@@ -65,7 +65,7 @@ public class BlockReaderIoProvider {
   public int read(FileChannel dataIn, ByteBuffer dst, long position)
       throws IOException{
     final int nRead;
-    if (isEnabled && (ThreadLocalRandom.current().nextInt() < sampleRangeMax)) 
{
+    if (isEnabled && (ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE) < 
sampleRangeMax)) {
       long begin = timer.monotonicNow();
       nRead = dataIn.read(dst, position);
       long latency = timer.monotonicNow() - begin;
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ProfilingFileIoEvents.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ProfilingFileIoEvents.java
index c22401b645f1..dbaf047ef3e4 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ProfilingFileIoEvents.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ProfilingFileIoEvents.java
@@ -80,7 +80,7 @@ class ProfilingFileIoEvents {
 
   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) {
       DataNodeVolumeMetrics metrics = getVolumeMetrics(volume);
       if (metrics != null) {
         return Time.monotonicNow();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to