Skip to content

Comments

HDFS-17789. Add NormalUnderReplBlocksCount and BadlyDistributedBlocksCount to getStats() NN RPC#8190

Open
aswinmprabhu wants to merge 2 commits intoapache:trunkfrom
aswinmprabhu:add-badly-distributed-to-getstats-oss
Open

HDFS-17789. Add NormalUnderReplBlocksCount and BadlyDistributedBlocksCount to getStats() NN RPC#8190
aswinmprabhu wants to merge 2 commits intoapache:trunkfrom
aswinmprabhu:add-badly-distributed-to-getstats-oss

Conversation

@aswinmprabhu
Copy link
Contributor

@aswinmprabhu aswinmprabhu commented Jan 18, 2026

Description of PR

Reopening PR: #7963

At LinkedIn, we use the stats from the getStats() NN RPC call to evaluate safety checks that ensure that various maintenance ops are safe to run.

Due to a migration we are undertaking, the badly distributed block count is very high for the cluster undergoing migration. This is not a safety problem. However, to distinguish it from the actual low redundancy block count, we need both these values to be available from the getStats() RPC. The current low redundancy blocks count value available is the sum of all the different types of low redundancy blocks, including normal low redundancy blocks and badly distributed blocks.

This PR adds these 2 values separately to the array returned by getStats() RPC.

How was this patch tested?

Trivial change. It has been running in our prod cluster for a bit now.
Build passes:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  42:50 min
[INFO] Finished at: 2025-05-19T14:51:09+05:30
[INFO] ------------------------------------------------------------------------

Ran a RPC testing script manually:

Raw stats array: [863531924404371456, 593154736167663129, 269347053575775718, 0, 0, 0, 0, 0, 0, 0, 0]

=== NameNode Stats ===
[ 0] Capacity (bytes)                              : 863,531,924,404,371,456
[ 1] Used (bytes)                                  : 593,154,736,167,663,129
[ 2] Remaining (bytes)                             : 269,347,053,575,775,718
[ 3] Under-replicated blocks                       : 0
[ 4] Corrupt blocks                                : 0
[ 5] Missing blocks                                : 0
[ 6] Missing blocks with replication factor 1      : 0
[ 7] Bytes in future blocks                        : 0
[ 8] Pending deletion blocks                       : 0
[ 9] Badly distributed blocks                      : 0
[10] Normal under-replicated blocks                : 0

Code:

long[] stats = namenode.getStats();

System.out.println("Raw stats array: " + Arrays.toString(stats));
System.out.println();
...

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

@ctrezzo
Copy link
Contributor

ctrezzo commented Jan 27, 2026

@aswinmprabhu can you address the failing check-style issues? Thank you!

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 43s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+0 🆗 detsecrets 0m 1s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+0 🆗 mvndep 9m 16s Maven dependency ordering for branch
+1 💚 mvninstall 26m 55s trunk passed
+1 💚 compile 3m 32s trunk passed with JDK Ubuntu-21.0.7+6-Ubuntu-0ubuntu120.04
+1 💚 compile 4m 1s trunk passed with JDK Ubuntu-17.0.15+6-Ubuntu-0ubuntu120.04
+1 💚 checkstyle 0m 46s trunk passed
+1 💚 mvnsite 1m 43s trunk passed
+1 💚 javadoc 1m 20s trunk passed with JDK Ubuntu-21.0.7+6-Ubuntu-0ubuntu120.04
+1 💚 javadoc 1m 21s trunk passed with JDK Ubuntu-17.0.15+6-Ubuntu-0ubuntu120.04
+1 💚 spotbugs 4m 34s trunk passed
-1 ❌ shadedclient 17m 56s branch has errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 19s Maven dependency ordering for patch
-1 ❌ mvninstall 0m 20s /patch-mvninstall-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch failed.
-1 ❌ mvninstall 0m 21s /patch-mvninstall-hadoop-hdfs-project_hadoop-hdfs-client.txt hadoop-hdfs-client in the patch failed.
-1 ❌ compile 0m 20s /patch-compile-hadoop-hdfs-project-jdkUbuntu-21.0.7+6-Ubuntu-0ubuntu120.04.txt hadoop-hdfs-project in the patch failed with JDK Ubuntu-21.0.7+6-Ubuntu-0ubuntu120.04.
-1 ❌ javac 0m 20s /patch-compile-hadoop-hdfs-project-jdkUbuntu-21.0.7+6-Ubuntu-0ubuntu120.04.txt hadoop-hdfs-project in the patch failed with JDK Ubuntu-21.0.7+6-Ubuntu-0ubuntu120.04.
-1 ❌ compile 0m 21s /patch-compile-hadoop-hdfs-project-jdkUbuntu-17.0.15+6-Ubuntu-0ubuntu120.04.txt hadoop-hdfs-project in the patch failed with JDK Ubuntu-17.0.15+6-Ubuntu-0ubuntu120.04.
-1 ❌ javac 0m 21s /patch-compile-hadoop-hdfs-project-jdkUbuntu-17.0.15+6-Ubuntu-0ubuntu120.04.txt hadoop-hdfs-project in the patch failed with JDK Ubuntu-17.0.15+6-Ubuntu-0ubuntu120.04.
+1 💚 blanks 0m 0s The patch has no blanks issues.
-0 ⚠️ checkstyle 0m 19s /buildtool-patch-checkstyle-hadoop-hdfs-project.txt The patch fails to run checkstyle in hadoop-hdfs-project
-1 ❌ mvnsite 0m 21s /patch-mvnsite-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch failed.
-1 ❌ mvnsite 0m 20s /patch-mvnsite-hadoop-hdfs-project_hadoop-hdfs-client.txt hadoop-hdfs-client in the patch failed.
-1 ❌ javadoc 0m 21s /patch-javadoc-hadoop-hdfs-project_hadoop-hdfs-jdkUbuntu-21.0.7+6-Ubuntu-0ubuntu120.04.txt hadoop-hdfs in the patch failed with JDK Ubuntu-21.0.7+6-Ubuntu-0ubuntu120.04.
-1 ❌ javadoc 0m 20s /patch-javadoc-hadoop-hdfs-project_hadoop-hdfs-client-jdkUbuntu-21.0.7+6-Ubuntu-0ubuntu120.04.txt hadoop-hdfs-client in the patch failed with JDK Ubuntu-21.0.7+6-Ubuntu-0ubuntu120.04.
-1 ❌ javadoc 0m 21s /patch-javadoc-hadoop-hdfs-project_hadoop-hdfs-jdkUbuntu-17.0.15+6-Ubuntu-0ubuntu120.04.txt hadoop-hdfs in the patch failed with JDK Ubuntu-17.0.15+6-Ubuntu-0ubuntu120.04.
-1 ❌ javadoc 0m 21s /patch-javadoc-hadoop-hdfs-project_hadoop-hdfs-client-jdkUbuntu-17.0.15+6-Ubuntu-0ubuntu120.04.txt hadoop-hdfs-client in the patch failed with JDK Ubuntu-17.0.15+6-Ubuntu-0ubuntu120.04.
-1 ❌ spotbugs 0m 21s /patch-spotbugs-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch failed.
-1 ❌ spotbugs 0m 20s /patch-spotbugs-hadoop-hdfs-project_hadoop-hdfs-client.txt hadoop-hdfs-client in the patch failed.
+1 💚 shadedclient 5m 49s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 0m 21s /patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch failed.
-1 ❌ unit 0m 21s /patch-unit-hadoop-hdfs-project_hadoop-hdfs-client.txt hadoop-hdfs-client in the patch failed.
+0 🆗 asflicense 0m 21s ASF License check generated no output?
80m 43s
Subsystem Report/Notes
Docker ClientAPI=1.53 ServerAPI=1.53 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8190/2/artifact/out/Dockerfile
GITHUB PR #8190
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 10bb20d61b28 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 20f5e88
Default Java Ubuntu-17.0.15+6-Ubuntu-0ubuntu120.04
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.7+6-Ubuntu-0ubuntu120.04 /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.15+6-Ubuntu-0ubuntu120.04
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8190/2/testReport/
Max. process+thread count 258 (vs. ulimit of 5500)
modules C: hadoop-hdfs-project/hadoop-hdfs hadoop-hdfs-project/hadoop-hdfs-client U: hadoop-hdfs-project
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8190/2/console
versions git=2.25.1 maven=3.9.11 spotbugs=4.9.7
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants