Jackie-Jiang commented on code in PR #16964:
URL: https://github.com/apache/pinot/pull/16964#discussion_r2434293445
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -3559,21 +3559,20 @@ public List<TableConfig>
getTableConfigsForSchema(String schemaName) {
return tableConfigs;
}
+ /** Get all server instances that host at least a segment for a given table
based on the ideal state.
+ *
+ * @param tableName Table name with or without type suffix
+ * @param tableType Table type
+ * @return List of server instances
+ */
public List<String> getServerInstancesForTable(String tableName, TableType
tableType) {
- TableConfig tableConfig = getTableConfig(tableName, tableType);
- Preconditions.checkNotNull(tableConfig);
- TenantConfig tenantConfig = tableConfig.getTenantConfig();
Set<String> serverInstances = new HashSet<>();
- List<InstanceConfig> instanceConfigs =
HelixHelper.getInstanceConfigs(_helixZkManager);
- if (tableType == TableType.OFFLINE) {
- serverInstances.addAll(
- HelixHelper.getInstancesWithTag(instanceConfigs,
TagNameUtils.extractOfflineServerTag(tenantConfig)));
- } else if (TableType.REALTIME.equals(tableType)) {
- serverInstances.addAll(
- HelixHelper.getInstancesWithTag(instanceConfigs,
TagNameUtils.extractConsumingServerTag(tenantConfig)));
- serverInstances.addAll(
- HelixHelper.getInstancesWithTag(instanceConfigs,
TagNameUtils.extractCompletedServerTag(tenantConfig)));
+ IdealState idealState =
getTableIdealState(TableNameBuilder.forType(tableType).tableNameWithType(tableName));
+ ZNRecord record = idealState.getRecord();
+ if (record == null) {
+ return new ArrayList<>();
Review Comment:
When table doesn't exist, we probably want to throw exception, instead of
returning an empty list
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]