This is an automated email from the ASF dual-hosted git repository. jackie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push: new dc25cb3 all getSegmentStatus to handle segments missing in externalview (#7803) dc25cb3 is described below commit dc25cb35147cf14ac3dfb3b5c179987bdc5f42cc Author: Johan Adami <4760722+jadam...@users.noreply.github.com> AuthorDate: Fri Nov 19 19:57:57 2021 -0500 all getSegmentStatus to handle segments missing in externalview (#7803) --- pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts index 8634a11..86208d0 100644 --- a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts +++ b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts @@ -486,15 +486,17 @@ const getSegmentStatus = (idealSegment, externalViewSegment) => { return 'Good'; } let goodCount = 0; - const totalCount = Object.keys(externalViewSegment).length; + // There is a possibility that the segment is in ideal state but not in external view + // making external view segment as null. + const totalCount = externalViewSegment ? Object.keys(externalViewSegment).length : 0; Object.keys(idealSegment).map((replicaName)=>{ const idealReplicaState = idealSegment[replicaName]; - const externalReplicaState = externalViewSegment[replicaName]; + const externalReplicaState = externalViewSegment ? externalViewSegment[replicaName] : ''; if(idealReplicaState === externalReplicaState || (externalReplicaState === 'CONSUMING')){ goodCount += 1; } }); - if(goodCount === 0){ + if(goodCount === 0 || totalCount === 0){ return 'Bad'; } else if(goodCount === totalCount){ return 'Good'; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org