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 269f483c3c add server status to all instance tables (#14720)
269f483c3c is described below
commit 269f483c3c585db1ab6e94ac53ff8d2eeca500d1
Author: Johan Adami <[email protected]>
AuthorDate: Mon Jan 13 22:03:05 2025 -0500
add server status to all instance tables (#14720)
---
.../app/components/AsyncInstanceTable.tsx | 19 +++-------------
.../app/components/Homepage/InstancesTables.tsx | 3 +--
.../src/main/resources/app/pages/TenantDetails.tsx | 7 ++++--
.../src/main/resources/app/pages/Tenants.tsx | 25 +++++++++++++++-------
.../main/resources/app/utils/PinotMethodUtils.ts | 16 +++++++++++++-
5 files changed, 41 insertions(+), 29 deletions(-)
diff --git
a/pinot-controller/src/main/resources/app/components/AsyncInstanceTable.tsx
b/pinot-controller/src/main/resources/app/components/AsyncInstanceTable.tsx
index 12d6b94a0c..c6a06b9a24 100644
--- a/pinot-controller/src/main/resources/app/components/AsyncInstanceTable.tsx
+++ b/pinot-controller/src/main/resources/app/components/AsyncInstanceTable.tsx
@@ -25,28 +25,15 @@ import PinotMethodUtils from '../utils/PinotMethodUtils';
import Utils from '../utils/Utils';
import Loading from './Loading';
-type BaseProps = {
+type Props = {
instanceType: InstanceType;
showInstanceDetails?: boolean;
instanceNames: string[] | null;
liveInstanceNames?: string[];
};
-type ClusterProps = BaseProps & {
- cluster: string;
- tenant?: never;
-};
-
-type TenantProps = BaseProps & {
- tenant: string;
- cluster?: never;
-};
-
-type Props = ClusterProps | TenantProps;
-
export const AsyncInstanceTable = ({
instanceType,
- cluster,
instanceNames,
liveInstanceNames,
showInstanceDetails = false,
@@ -70,10 +57,10 @@ export const AsyncInstanceTable = ({
useEffect(() => {
// async load all the other details
- if(showInstanceDetails && cluster && instanceNames && liveInstanceNames) {
+ if(showInstanceDetails && instanceNames && liveInstanceNames) {
fetchAdditionalInstanceDetails();
}
- }, [showInstanceDetails, cluster, instanceNames, liveInstanceNames]);
+ }, [showInstanceDetails, instanceNames, liveInstanceNames]);
const fetchAdditionalInstanceDetails = async () => {
const additionalData = await PinotMethodUtils.getInstanceData(
diff --git
a/pinot-controller/src/main/resources/app/components/Homepage/InstancesTables.tsx
b/pinot-controller/src/main/resources/app/components/Homepage/InstancesTables.tsx
index dd5621f447..3b466165c8 100644
---
a/pinot-controller/src/main/resources/app/components/Homepage/InstancesTables.tsx
+++
b/pinot-controller/src/main/resources/app/components/Homepage/InstancesTables.tsx
@@ -30,7 +30,7 @@ type Props = {
};
-const Instances = ({ clusterName, instanceType, instances, liveInstanceNames
}: Props) => {
+const Instances = ({ instanceType, instances, liveInstanceNames }: Props) => {
const order = [
InstanceType.CONTROLLER,
InstanceType.BROKER,
@@ -45,7 +45,6 @@ const Instances = ({ clusterName, instanceType, instances,
liveInstanceNames }:
return (
<AsyncInstanceTable
key={startCase(key)}
- cluster={clusterName}
instanceType={key}
showInstanceDetails
instanceNames={instances?.[key] || null}
diff --git a/pinot-controller/src/main/resources/app/pages/TenantDetails.tsx
b/pinot-controller/src/main/resources/app/pages/TenantDetails.tsx
index a761f15fba..6054a0d353 100644
--- a/pinot-controller/src/main/resources/app/pages/TenantDetails.tsx
+++ b/pinot-controller/src/main/resources/app/pages/TenantDetails.tsx
@@ -130,7 +130,7 @@ const TenantPageDetails = ({ match }:
RouteComponentProps<Props>) => {
const [showEditConfig, setShowEditConfig] = useState(false);
const [config, setConfig] = useState('{}');
- const instanceColumns = ["Instance Name", "# of segments"];
+ const instanceColumns = ["Instance Name", "# of segments", "Status"];
const loadingInstanceData = Utils.getLoadingTableData(instanceColumns);
const [instanceCountData, setInstanceCountData] =
useState<TableData>(loadingInstanceData);
@@ -187,10 +187,13 @@ const TenantPageDetails = ({ match }:
RouteComponentProps<Props>) => {
const fetchSegmentData = async () => {
const result = await PinotMethodUtils.getSegmentList(tableName);
const data = await
PinotMethodUtils.fetchServerToSegmentsCountData(tableName, tableType);
+ const liveInstanceNames = await PinotMethodUtils.getLiveInstances();
const {columns, records} = result;
setInstanceCountData({
columns: instanceColumns,
- records: data.records
+ records: data.records.map((record) => {
+ return [...record, liveInstanceNames.data.includes(record[0]) ?
'Alive' : 'Dead'];
+ })
});
const segmentTableRows = [];
diff --git a/pinot-controller/src/main/resources/app/pages/Tenants.tsx
b/pinot-controller/src/main/resources/app/pages/Tenants.tsx
index e43c17c36b..e1a1697c91 100644
--- a/pinot-controller/src/main/resources/app/pages/Tenants.tsx
+++ b/pinot-controller/src/main/resources/app/pages/Tenants.tsx
@@ -46,6 +46,7 @@ const TenantPage = ({ match }: RouteComponentProps<Props>) =>
{
[InstanceType.BROKER]: null,
[InstanceType.SERVER]: null,
})
+ const [liveInstanceNames, setLiveInstanceNames] = useState<string[]>();
useEffect(() => {
fetchInstanceData();
@@ -58,6 +59,10 @@ const TenantPage = ({ match }: RouteComponentProps<Props>)
=> {
[InstanceType.BROKER]: Array.isArray(brokerNames) ? brokerNames : [],
[InstanceType.SERVER]: Array.isArray(serverNames) ? serverNames : [],
});
+
+ const liveInstanceNames = await PinotMethodUtils.getLiveInstances();
+ setLiveInstanceNames(liveInstanceNames.data || []);
+
}
return (
@@ -76,16 +81,18 @@ const TenantPage = ({ match }: RouteComponentProps<Props>)
=> {
<div>
<CustomButton
onClick={() => {}}
- tooltipTitle="Recalculates the segment to server mapping for all
tables in this tenant"
- enableTooltip={true}
+ // Tooltips do not render on disabled buttons. Add this back
when we have a working implementation.
+ // tooltipTitle="Recalculates the segment to server mapping for
all tables in this tenant"
+ // enableTooltip={true}
isDisabled={true}
>
Rebalance Server Tenant
</CustomButton>
<CustomButton
onClick={() => {}}
- tooltipTitle="Rebuilds brokerResource mappings for all tables in
this tenant"
- enableTooltip={true}
+ // Tooltips do not render on disabled buttons. Add this back
when we have a working implementation.
+ // tooltipTitle="Rebuilds brokerResource mappings for all tables
in this tenant"
+ // enableTooltip={true}
isDisabled={true}
>
Rebuild Broker Resource
@@ -99,18 +106,20 @@ const TenantPage = ({ match }: RouteComponentProps<Props>)
=> {
baseUrl={`/tenants/${tenantName}/table/`}
/>
<Grid container spacing={2}>
- <Grid item xs={6}>
+ <Grid item xs={12}>
<AsyncInstanceTable
instanceNames={instanceNames[InstanceType.BROKER]}
instanceType={InstanceType.BROKER}
- tenant={tenantName}
+ liveInstanceNames={liveInstanceNames}
+ showInstanceDetails
/>
</Grid>
- <Grid item xs={6}>
+ <Grid item xs={12}>
<AsyncInstanceTable
instanceNames={instanceNames[InstanceType.SERVER]}
instanceType={InstanceType.SERVER}
- tenant={tenantName}
+ liveInstanceNames={liveInstanceNames}
+ showInstanceDetails
/>
</Grid>
</Grid>
diff --git a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
index 4207e59f47..a4f1bae1fc 100644
--- a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
+++ b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
@@ -199,13 +199,26 @@ const getClusterName = () => {
// This method is used to fetch array of live instances name
// API: /zk/ls?path=:ClusterName/LIVEINSTANCES
// Expected Output: []
-const getLiveInstance = (clusterName) => {
+const getLiveInstance = (clusterName: string) => {
const params = encodeURIComponent(`/${clusterName}/LIVEINSTANCES`);
return zookeeperGetList(params).then((data) => {
return data;
});
};
+const getLiveInstances = () => {
+ let localclusterName: string | null =
localStorage.getItem('pinot_ui:clusterName');
+ let clusterNameRes: Promise<string>;
+ if(!localclusterName || localclusterName === ''){
+ clusterNameRes = getClusterName();
+ } else {
+ clusterNameRes = Promise.resolve(localclusterName);
+ }
+ return clusterNameRes.then((clusterName) => {
+ return getLiveInstance(clusterName);
+ });
+};
+
// This method is used to diaplay cluster congifuration on cluster manager
home page
// API: /cluster/configs
// Expected Output: {columns: [], records: []}
@@ -1277,6 +1290,7 @@ export default {
getSegmentCountAndStatus,
getClusterName,
getLiveInstance,
+ getLiveInstances,
getLiveInstanceConfig,
getInstanceConfig,
getInstanceDetails,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]