This is an automated email from the ASF dual-hosted git repository.
arafat2198 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 82c6bf3c82 HDDS-11023. Recon Disk Usage null conditions not handled
properly for null response (#6894)
82c6bf3c82 is described below
commit 82c6bf3c82598d2896c4121600af011c87414204
Author: Smita <[email protected]>
AuthorDate: Mon Jul 29 13:25:44 2024 +0530
HDDS-11023. Recon Disk Usage null conditions not handled properly for null
response (#6894)
---
.../webapps/recon/ozone-recon-web/api/routes.json | 10 +-
.../recon/ozone-recon-web/src/utils/common.tsx | 16 +-
.../src/views/diskUsage/diskUsage.tsx | 278 +++++++++++----------
3 files changed, 167 insertions(+), 137 deletions(-)
diff --git
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json
index 86d7a51a56..7f3c86684b 100644
---
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json
+++
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json
@@ -4,7 +4,7 @@
"/utilization/fileCount": "/fileSizeCounts",
"/utilization/containerCount": "/containerCount",
"/namespace/du?path=/&files=true&sortSubpaths=true": "/root",
- "/namespace/du?path=/vol:id&files=true&sortSubpaths=true": "/volume",
+ "/namespace/du?path=/vol:id&files=true&sortSubPaths=true": "/volume",
"/namespace/du?path=/vol:id/&files=true&sortSubPaths=true": "/volume",
"/namespace/du?path=/dummyVolume&files=true&sortSubPaths=true": "/volume",
"/namespace/du?path=/vol:id/bucket:id&files=true&sortSubPaths=true":
"/bucket",
@@ -15,10 +15,10 @@
"/namespace/du?path=/dummyVolume/dummyBucket/dir:id&files=true&sortSubPaths=true":
"/dir",
"/namespace/du?path=/dummyVolume/dummyBucket/dir:id/&files=true&sortSubPaths=true":
"/dir",
"/namespace/du?path=/dummyVolume/dummyBucket/dummyDir&files=true&sortSubPaths=true":
"/dir",
- "/namespace/du?path=/vol:id/bucket:id/dir:id/key:id*": "/key",
- "/namespace/du?path=/dummyVolume/dummyBucket/dummyDir/key:id*": "/key",
- "/namespace/du?path=/vol:id/bucket:id/key:id*": "/key",
- "/namespace/du?path=/dummyVolume/dummyBucket/key:id*": "/key",
+ "/namespace/du?path=/vol:id/bucket:id/dir:id/key:id*&sortSubPaths=true":
"/key",
+
"/namespace/du?path=/dummyVolume/dummyBucket/dummyDir/key:id*&sortSubPaths=true":
"/key",
+ "/namespace/du?path=/vol:id/bucket:id/key:id*&sortSubPaths=true": "/key",
+ "/namespace/du?path=/dummyVolume/dummyBucket/key:id*&sortSubPaths=true":
"/key",
"/namespace/du?path=/vol1/bucket1/empty&files=true&sortSubPaths=true":
"/empty",
"/namespace/du?path=/clunky&files=true&sortSubpaths=true": "/clunky",
"/namespace/du?path=/*&replica=true": "/replica",
diff --git
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx
index d68db094fd..6886fd189f 100644
---
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx
+++
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx
@@ -33,11 +33,25 @@ const showErrorNotification = (title: string, description:
string) => {
notification.error(args);
};
+const showInfoNotification = (title: string, description: string) => {
+ const args = {
+ message: title,
+ description,
+ duration: 15
+ };
+ notification.warn(args);
+};
+
export const showDataFetchError = (error: string) => {
- const title = 'Error while fetching data';
+ let title = 'Error while fetching data';
if (error.includes('CanceledError')) {
error = 'Previous request cancelled because context changed'
}
+ if (error.includes('metadata')) {
+ title = 'Metadata Initialization:';
+ showInfoNotification(title, error);
+ return;
+ }
showErrorNotification(title, error);
};
diff --git
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx
index 873d8a16d9..3f11765250 100644
---
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx
+++
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx
@@ -314,163 +314,172 @@ export class DiskUsage extends
React.Component<Record<string, object>, IDUState>
keys.push('Entity Type');
values.push(summaryResponse.type);
- if (summaryResponse.type === 'KEY') {
- const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`;
- const { request: metadataRequest, controller: metadataNewController }
= AxiosGetHelper(keyEndpoint, cancelKeyMetadataSignal);
- cancelKeyMetadataSignal = metadataNewController;
- metadataRequest.then(response => {
- keys.push('File Size');
- values.push(byteToSize(response.data.size, 3));
- keys.push('File Size With Replication');
- values.push(byteToSize(response.data.sizeWithReplica, 3));
- this.setState({
- showPanel: true,
- panelKeys: keys,
- panelValues: values
- });
- }).catch(error => {
- this.setState({
- isLoading: false,
- showPanel: false
- });
- showDataFetchError(error.toString());
- });
+ // If status is INITIALIZING, we cannot add entities for metadata as it
will cause null failures and showing Warning message
+ // Hence we only add Entities if the status is not INITIALIZING
+ if (summaryResponse.status === 'INITIALIZING') {
+ showDataFetchError(`The metadata is currently initializing. Please
wait a moment and try again later`);
return;
}
- if (summaryResponse.countStats.status === 'PATH_NOT_FOUND') {
- showDataFetchError(`Invalid Path: ${path}`);
- return;
- }
+ if (summaryResponse.status !== 'INITIALIZING' && summaryResponse.status
!== 'PATH_NOT_FOUND') {
+ if (summaryResponse.type === 'KEY') {
+ const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`;
+ const { request: metadataRequest, controller: metadataNewController
} = AxiosGetHelper(keyEndpoint, cancelKeyMetadataSignal);
+ cancelKeyMetadataSignal = metadataNewController;
+ metadataRequest.then(response => {
+ keys.push('File Size');
+ values.push(byteToSize(response.data.size, 3));
+ keys.push('File Size With Replication');
+ values.push(byteToSize(response.data.sizeWithReplica, 3));
+ this.setState({
+ showPanel: true,
+ panelKeys: keys,
+ panelValues: values
+ });
+ }).catch(error => {
+ this.setState({
+ isLoading: false,
+ showPanel: false
+ });
+ showDataFetchError(error.toString());
+ });
+ return;
+ }
- if (summaryResponse.countStats.numVolume !== -1) {
- keys.push('Volumes');
- values.push(summaryResponse.countStats.numVolume);
- }
+ if (summaryResponse.countStats?.status === 'PATH_NOT_FOUND') {
+ showDataFetchError(`Invalid Path: ${path}`);
+ return;
+ }
- if (summaryResponse.countStats.numBucket !== -1) {
- keys.push('Buckets');
- values.push(summaryResponse.countStats.numBucket);
- }
+ if (summaryResponse.countStats?.numVolume !== undefined &&
summaryResponse.countStats?.numVolume !== -1) {
+ keys.push('Volumes');
+ values.push(summaryResponse.countStats.numVolume);
+ }
- if (summaryResponse.countStats.numDir !== -1) {
- keys.push('Total Directories');
- values.push(summaryResponse.countStats.numDir);
- }
+ if (summaryResponse.countStats?.numBucket !== undefined &&
summaryResponse.countStats?.numBucket !== -1) {
+ keys.push('Buckets');
+ values.push(summaryResponse.countStats.numBucket);
+ }
- if (summaryResponse.countStats.numKey !== -1) {
- keys.push('Total Keys');
- values.push(summaryResponse.countStats.numKey);
- }
+ if (summaryResponse.countStats?.numDir !== undefined &&
summaryResponse.countStats?.numDir !== -1) {
+ keys.push('Total Directories');
+ values.push(summaryResponse.countStats.numDir);
+ }
- if (summaryResponse.objectInfo.bucketName &&
summaryResponse.objectInfo.bucketName !== -1) {
- keys.push('Bucket Name');
- values.push(summaryResponse.objectInfo.bucketName);
- }
+ if (summaryResponse.countStats?.numKey !== undefined &&
summaryResponse.countStats?.numKey !== -1) {
+ keys.push('Total Keys');
+ values.push(summaryResponse.countStats.numKey);
+ }
- if (summaryResponse.objectInfo.bucketLayout &&
summaryResponse.objectInfo.bucketLayout !== -1) {
- keys.push('Bucket Layout');
- values.push(summaryResponse.objectInfo.bucketLayout);
- }
+ if (summaryResponse.objectInfo?.bucketName !== undefined &&
summaryResponse.objectInfo?.bucketName !== -1) {
+ keys.push('Bucket Name');
+ values.push(summaryResponse.objectInfo.bucketName);
+ }
- if (summaryResponse.objectInfo.creationTime &&
summaryResponse.objectInfo.creationTime !== -1) {
- keys.push('Creation Time');
- values.push(moment(summaryResponse.objectInfo.creationTime).format('ll
LTS'));
- }
+ if (summaryResponse.objectInfo?.bucketLayout !== undefined &&
summaryResponse.objectInfo?.bucketLayout !== -1) {
+ keys.push('Bucket Layout');
+ values.push(summaryResponse.objectInfo.bucketLayout);
+ }
- if (summaryResponse.objectInfo.dataSize &&
summaryResponse.objectInfo.dataSize !== -1) {
- keys.push('Data Size');
- values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3));
- }
+ if (summaryResponse.objectInfo?.creationTime !== undefined &&
summaryResponse.objectInfo?.creationTime !== -1) {
+ keys.push('Creation Time');
+
values.push(moment(summaryResponse.objectInfo.creationTime).format('ll LTS'));
+ }
- if (summaryResponse.objectInfo.encInfo &&
summaryResponse.objectInfo.encInfo !== -1) {
- keys.push('ENC Info');
- values.push(summaryResponse.objectInfo.encInfo);
- }
+ if (summaryResponse.objectInfo?.dataSize !== undefined &&
summaryResponse.objectInfo?.dataSize !== -1) {
+ keys.push('Data Size');
+ values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3));
+ }
- if (summaryResponse.objectInfo.fileName &&
summaryResponse.objectInfo.fileName !== -1) {
- keys.push('File Name');
- values.push(summaryResponse.objectInfo.fileName);
- }
+ if (summaryResponse.objectInfo?.encInfo !== undefined &&
summaryResponse.objectInfo?.encInfo !== -1) {
+ keys.push('ENC Info');
+ values.push(summaryResponse.objectInfo.encInfo);
+ }
- if (summaryResponse.objectInfo.keyName &&
summaryResponse.objectInfo.keyName !== -1) {
- keys.push('Key Name');
- values.push(summaryResponse.objectInfo.keyName);
- }
+ if (summaryResponse.objectInfo?.fileName !== undefined &&
summaryResponse.objectInfo?.fileName !== -1) {
+ keys.push('File Name');
+ values.push(summaryResponse.objectInfo.fileName);
+ }
- if (summaryResponse.objectInfo.modificationTime &&
summaryResponse.objectInfo.modificationTime !== -1) {
- keys.push('Modification Time');
-
values.push(moment(summaryResponse.objectInfo.modificationTime).format('ll
LTS'));
- }
+ if (summaryResponse.objectInfo?.keyName !== undefined &&
summaryResponse.objectInfo?.keyName !== -1) {
+ keys.push('Key Name');
+ values.push(summaryResponse.objectInfo.keyName);
+ }
- if (summaryResponse.objectInfo.name && summaryResponse.objectInfo.name
!== -1) {
- keys.push('Name');
- values.push(summaryResponse.objectInfo.name);
- }
+ if (summaryResponse.objectInfo?.modificationTime !== undefined &&
summaryResponse.objectInfo?.modificationTime !== -1) {
+ keys.push('Modification Time');
+
values.push(moment(summaryResponse.objectInfo.modificationTime).format('ll
LTS'));
+ }
- if (summaryResponse.objectInfo.owner && summaryResponse.objectInfo.owner
!== -1) {
- keys.push('Owner');
- values.push(summaryResponse.objectInfo.owner);
- }
+ if (summaryResponse.objectInfo?.name !== undefined &&
summaryResponse.objectInfo?.name !== -1) {
+ keys.push('Name');
+ values.push(summaryResponse.objectInfo.name);
+ }
- if (summaryResponse.objectInfo.quotaInBytes &&
summaryResponse.objectInfo.quotaInBytes !== -1) {
- keys.push('Quota In Bytes');
- values.push(byteToSize(summaryResponse.objectInfo.quotaInBytes, 3));
- }
+ if (summaryResponse.objectInfo?.owner !== undefined &&
summaryResponse.objectInfo?.owner !== -1) {
+ keys.push('Owner');
+ values.push(summaryResponse.objectInfo.owner);
+ }
- if (summaryResponse.objectInfo.quotaInNamespace &&
summaryResponse.objectInfo.quotaInNamespace !== -1) {
- keys.push('Quota In Namespace');
- values.push(byteToSize(summaryResponse.objectInfo.quotaInNamespace,
3));
- }
+ if (summaryResponse.objectInfo?.quotaInBytes !== undefined &&
summaryResponse.objectInfo?.quotaInBytes !== -1) {
+ keys.push('Quota In Bytes');
+ values.push(byteToSize(summaryResponse.objectInfo.quotaInBytes, 3));
+ }
- if (summaryResponse.objectInfo.replicationConfig &&
summaryResponse.objectInfo.replicationConfig.replicationFactor &&
summaryResponse.objectInfo.replicationConfig.replicationFactor !== -1) {
- keys.push('Replication Factor');
-
values.push(summaryResponse.objectInfo.replicationConfig.replicationFactor);
- }
+ if (summaryResponse.objectInfo?.quotaInNamespace !== undefined &&
summaryResponse.objectInfo?.quotaInNamespace !== -1) {
+ keys.push('Quota In Namespace');
+ values.push(byteToSize(summaryResponse.objectInfo.quotaInNamespace,
3));
+ }
- if (summaryResponse.objectInfo.replicationConfig &&
summaryResponse.objectInfo.replicationConfig.replicationType &&
summaryResponse.objectInfo.replicationConfig.replicationType !== -1) {
- keys.push('Replication Type');
-
values.push(summaryResponse.objectInfo.replicationConfig.replicationType);
- }
+ if (summaryResponse.objectInfo?.replicationConfig?.replicationFactor
!== undefined &&
summaryResponse.objectInfo?.replicationConfig?.replicationFactor !== -1) {
+ keys.push('Replication Factor');
+
values.push(summaryResponse.objectInfo.replicationConfig.replicationFactor);
+ }
- if (summaryResponse.objectInfo.replicationConfig &&
summaryResponse.objectInfo.replicationConfig.requiredNodes &&
summaryResponse.objectInfo.replicationConfig.requiredNodes !== -1) {
- keys.push('Replication Required Nodes');
-
values.push(summaryResponse.objectInfo.replicationConfig.requiredNodes);
- }
+ if (summaryResponse.objectInfo?.replicationConfig?.replicationType !==
undefined && summaryResponse.objectInfo?.replicationConfig?.replicationType !==
-1) {
+ keys.push('Replication Type');
+
values.push(summaryResponse.objectInfo.replicationConfig.replicationType);
+ }
- if (summaryResponse.objectInfo.sourceBucket &&
summaryResponse.objectInfo.sourceBucket !== -1) {
- keys.push('Source Bucket');
- values.push(summaryResponse.objectInfo.sourceBucket);
- }
+ if (summaryResponse.objectInfo?.replicationConfig?.requiredNodes !==
undefined && summaryResponse.objectInfo?.replicationConfig?.requiredNodes !==
-1) {
+ keys.push('Replication Required Nodes');
+
values.push(summaryResponse.objectInfo.replicationConfig.requiredNodes);
+ }
- if (summaryResponse.objectInfo.sourceVolume &&
summaryResponse.objectInfo.sourceVolume !== -1) {
- keys.push('Source Volume');
- values.push(summaryResponse.objectInfo.sourceVolume);
- }
+ if (summaryResponse.objectInfo?.sourceBucket !== undefined &&
summaryResponse.objectInfo?.sourceBucket !== -1) {
+ keys.push('Source Bucket');
+ values.push(summaryResponse.objectInfo.sourceBucket);
+ }
- if (summaryResponse.objectInfo.storageType &&
summaryResponse.objectInfo.storageType !== -1) {
- keys.push('Storage Type');
- values.push(summaryResponse.objectInfo.storageType);
- }
+ if (summaryResponse.objectInfo?.sourceVolume !== undefined &&
summaryResponse.objectInfo?.sourceVolume !== -1) {
+ keys.push('Source Volume');
+ values.push(summaryResponse.objectInfo.sourceVolume);
+ }
- if (summaryResponse.objectInfo.usedBytes &&
summaryResponse.objectInfo.usedBytes !== -1) {
- keys.push('Used Bytes');
- values.push(summaryResponse.objectInfo.usedBytes);
- }
+ if (summaryResponse.objectInfo?.storageType !== undefined &&
summaryResponse.objectInfo?.storageType !== -1) {
+ keys.push('Storage Type');
+ values.push(summaryResponse.objectInfo.storageType);
+ }
- if (summaryResponse.objectInfo.usedNamespace &&
summaryResponse.objectInfo.usedNamespace !== -1) {
- keys.push('Used NameSpaces');
- values.push(summaryResponse.objectInfo.usedNamespace);
- }
+ if (summaryResponse.objectInfo?.usedBytes !== undefined &&
summaryResponse.objectInfo?.usedBytes !== -1) {
+ keys.push('Used Bytes');
+ values.push(summaryResponse.objectInfo.usedBytes);
+ }
- if (summaryResponse.objectInfo.volumeName &&
summaryResponse.objectInfo.volumeName !== -1) {
- keys.push('Volume Name');
- values.push(summaryResponse.objectInfo.volumeName);
- }
+ if (summaryResponse.objectInfo?.usedNamespace !== undefined &&
summaryResponse.objectInfo?.usedNamespace !== -1) {
+ keys.push('Used NameSpaces');
+ values.push(summaryResponse.objectInfo.usedNamespace);
+ }
+
+ if (summaryResponse.objectInfo?.volumeName !== undefined &&
summaryResponse.objectInfo?.volumeName !== -1) {
+ keys.push('Volume Name');
+ values.push(summaryResponse.objectInfo.volumeName);
+ }
- if (summaryResponse.objectInfo.volume &&
summaryResponse.objectInfo.volume !== -1) {
- keys.push('Volume');
- values.push(summaryResponse.objectInfo.volume);
+ if (summaryResponse.objectInfo?.volume !== undefined &&
summaryResponse.objectInfo?.volume !== -1) {
+ keys.push('Volume');
+ values.push(summaryResponse.objectInfo.volume);
+ }
}
// Show the right drawer
@@ -503,15 +512,22 @@ export class DiskUsage extends
React.Component<Record<string, object>, IDUState>
return;
}
+ // If Quota status is INITIALIZING then do not append entities to
metadata to avoid null
+ if (quotaResponse.status === 'INITIALIZING') {
+ return;
+ }
+
// Append quota information
// In case the object's quota isn't set
- if (quotaResponse.allowed !== -1) {
+ if (quotaResponse.allowed !== undefined && quotaResponse.allowed !== -1)
{
keys.push('Quota Allowed');
values.push(byteToSize(quotaResponse.allowed, 3));
}
- keys.push('Quota Used');
- values.push(byteToSize(quotaResponse.used, 3));
+ if (quotaResponse.used !== undefined && quotaResponse.used !== -1) {
+ keys.push('Quota Used');
+ values.push(byteToSize(quotaResponse.used, 3));
+ }
this.setState({
showPanel: true,
panelKeys: keys,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]