From 0946271a0d0cfc4182eb9507741927e2f9042fd7 Mon Sep 17 00:00:00 2001 From: Jyotinder Singh Date: Mon, 14 Feb 2022 12:36:48 +0530 Subject: [PATCH] HDDS-6311. Fix number of keys displayed in Recon Overview. --- .../ozone/recon/api/ClusterStateEndpoint.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ClusterStateEndpoint.java b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ClusterStateEndpoint.java index 2b6e0f8a4732..17c5a271f578 100644 --- a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ClusterStateEndpoint.java +++ b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ClusterStateEndpoint.java @@ -44,6 +44,7 @@ import static org.apache.hadoop.ozone.om.OmMetadataManagerImpl.BUCKET_TABLE; import static org.apache.hadoop.ozone.om.OmMetadataManagerImpl.KEY_TABLE; import static org.apache.hadoop.ozone.om.OmMetadataManagerImpl.VOLUME_TABLE; +import static org.apache.hadoop.ozone.om.OmMetadataManagerImpl.FILE_TABLE; /** * Endpoint to fetch current state of ozone cluster. @@ -92,17 +93,29 @@ public Response getClusterState() { TableCountTask.getRowKeyFromTable(VOLUME_TABLE)); GlobalStats bucketRecord = globalStatsDao.findById( TableCountTask.getRowKeyFromTable(BUCKET_TABLE)); + // Keys from OBJECT_STORE buckets. GlobalStats keyRecord = globalStatsDao.findById( TableCountTask.getRowKeyFromTable(KEY_TABLE)); + // Keys from FILE_SYSTEM_OPTIMIZED buckets + GlobalStats fileRecord = globalStatsDao.findById( + TableCountTask.getRowKeyFromTable(FILE_TABLE)); + if (volumeRecord != null) { builder.setVolumes(volumeRecord.getValue()); } if (bucketRecord != null) { builder.setBuckets(bucketRecord.getValue()); } + + Long totalKeys = 0L; if (keyRecord != null) { - builder.setKeys(keyRecord.getValue()); + totalKeys += keyRecord.getValue(); } + if (fileRecord != null) { + totalKeys += fileRecord.getValue(); + } + builder.setKeys(totalKeys); + ClusterStateResponse response = builder .setStorageReport(storageReport) .setPipelines(pipelines)