timsants commented on a change in pull request #8358:
URL: https://github.com/apache/pinot/pull/8358#discussion_r832089983
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/util/TableSizeReader.java
##########
@@ -101,16 +105,46 @@ public TableSizeDetails getTableSizeDetails(@Nonnull
String tableName, @Nonnegat
tableSizeDetails._realtimeSegments =
getTableSubtypeSize(realtimeTableName, timeoutMsec);
tableSizeDetails._reportedSizeInBytes +=
tableSizeDetails._realtimeSegments._reportedSizeInBytes;
tableSizeDetails._estimatedSizeInBytes +=
tableSizeDetails._realtimeSegments._estimatedSizeInBytes;
+
+ // Get size in bytes per replica
+ TableConfig realtimeTableConfig =
+
ZKMetadataProvider.getRealtimeTableConfig(_helixResourceManager.getPropertyStore(),
realtimeTableName);
+ long sizeInBytesPerReplica = tableSizeDetails._estimatedSizeInBytes /
getNumReplicas(realtimeTableConfig);
+
+ // Update table size metrics
+ _controllerMetrics.setValueOfTableGauge(realtimeTableName,
+ ControllerGauge.REALTIME_TABLE_ESTIMATED_SIZE_PER_REPLICA,
sizeInBytesPerReplica);
}
if (hasOfflineTable) {
String offlineTableName =
TableNameBuilder.OFFLINE.tableNameWithType(tableName);
tableSizeDetails._offlineSegments =
getTableSubtypeSize(offlineTableName, timeoutMsec);
tableSizeDetails._reportedSizeInBytes +=
tableSizeDetails._offlineSegments._reportedSizeInBytes;
tableSizeDetails._estimatedSizeInBytes +=
tableSizeDetails._offlineSegments._estimatedSizeInBytes;
+
+ // Get size in bytes per replica
+ TableConfig offlineTableConfig =
+
ZKMetadataProvider.getOfflineTableConfig(_helixResourceManager.getPropertyStore(),
offlineTableName);
+ long sizeInBytesPerReplica = tableSizeDetails._estimatedSizeInBytes /
getNumReplicas(offlineTableConfig);
+
+ // Update table size metrics
+ _controllerMetrics.setValueOfTableGauge(offlineTableName,
+ ControllerGauge.OFFLINE_TABLE_ESTIMATED_SIZE_PER_REPLICA,
sizeInBytesPerReplica);
}
return tableSizeDetails;
}
+ private int getNumReplicas(TableConfig tableConfig) {
+ if (tableConfig.isDimTable()) {
+ // If the table is a dimension table then fetch the tenant config and
get the number of server belonging
+ // to the tenant
+ TenantConfig tenantConfig = tableConfig.getTenantConfig();
+ Set<String> serverInstances =
_helixResourceManager.getAllInstancesForServerTenant(tenantConfig.getServer());
+ return serverInstances.size();
+ }
+
+ return tableConfig.getValidationConfig().getReplicationNumber();
Review comment:
Aside from checking `if (tableConfig.getTableType() ==
TableType.REALTIME)` do we need to add/check a field in TableConfig to indicate
that it is LLC? I see that only the TableConfigBuilder has an `_isLLC` flag.
--
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]