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 c419c2c  Showing partial status of segment and counting CONSUMING 
state as good segment status (#7327)
c419c2c is described below

commit c419c2cf667b9cbb72a110b9feace7d82e7b0403
Author: Sanket Shah <shahsan...@users.noreply.github.com>
AuthorDate: Wed Aug 25 00:12:38 2021 +0530

    Showing partial status of segment and counting CONSUMING state as good 
segment status (#7327)
    
    Good - If all Ideal segment matches with the external view
    Bad - If none Ideal segment matches with the external view
    n/x - n denotes good replicas out of total x replicas showing how many are 
in a good state instead of all Bad
---
 .../src/main/resources/app/components/Table.tsx    |  9 ++++++++
 .../main/resources/app/utils/PinotMethodUtils.ts   | 25 +++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/pinot-controller/src/main/resources/app/components/Table.tsx 
b/pinot-controller/src/main/resources/app/components/Table.tsx
index 8b2d17c..b546327 100644
--- a/pinot-controller/src/main/resources/app/components/Table.tsx
+++ b/pinot-controller/src/main/resources/app/components/Table.tsx
@@ -345,6 +345,15 @@ export default function CustomizedTables({
         />
       );
     }
+    if (str?.toLowerCase()?.search('partial-') !== -1) {
+      return (
+        <StyledChip
+          label={str?.replace('Partial-','')}
+          className={classes.cellStatusConsuming}
+          variant="outlined"
+        />
+      );
+    }
     return str.toString();
   };
 
diff --git a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts 
b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
index dde32f7..b81bb37 100644
--- a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
+++ b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
@@ -462,7 +462,7 @@ const getSegmentList = (tableName) => {
       records: Object.keys(idealStateObj).map((key) => {
         return [
           key,
-          _.isEqual(idealStateObj[key], externalViewObj[key]) ? 'Good' : 'Bad',
+          getSegmentStatus(idealStateObj[key], externalViewObj[key])
         ];
       }),
       externalViewObj
@@ -470,6 +470,28 @@ const getSegmentList = (tableName) => {
   });
 };
 
+const getSegmentStatus = (idealSegment, externalViewSegment) => {
+  if(_.isEqual(idealSegment, externalViewSegment)){
+    return 'Good';
+  }
+  let goodCount = 0;
+  const totalCount = Object.keys(externalViewSegment).length;
+  Object.keys(idealSegment).map((replicaName)=>{
+    const idealReplicaState = idealSegment[replicaName];
+    const externalReplicaState = externalViewSegment[replicaName];
+    if(idealReplicaState === externalReplicaState || (externalReplicaState === 
'CONSUMING')){
+      goodCount += 1;
+    }
+  });
+  if(goodCount === 0){
+    return 'Bad';
+  } else if(goodCount === totalCount){
+    return  'Good';
+  } else {
+    return `Partial-${goodCount}/${totalCount}`;
+  }
+};
+
 // This method is used to display JSON format of a particular tenant table
 // API: /tables/:tableName/idealstate
 //      /tables/:tableName/externalview
@@ -779,6 +801,7 @@ export default {
   getAllTableDetails,
   getTableSummaryData,
   getSegmentList,
+  getSegmentStatus,
   getTableDetails,
   getSegmentDetails,
   getClusterName,

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

Reply via email to