kfaraz commented on code in PR #19532:
URL: https://github.com/apache/druid/pull/19532#discussion_r3593018167
##########
server/src/main/java/org/apache/druid/server/coordinator/duty/PrepareBalancerAndLoadQueues.java:
##########
@@ -203,14 +203,14 @@ private void collectHistoricalStats(
private void collectUsedSegmentStats(DruidCoordinatorRuntimeParams params,
CoordinatorRunStats stats)
{
- params.getUsedSegmentsTimelinesPerDataSource().forEach((dataSource,
timeline) -> {
- long totalSizeOfUsedSegments = timeline.iterateAllObjects().stream()
-
.mapToLong(DataSegment::getSize).sum();
+ for (final ImmutableDruidDataSource dataSource :
params.getDataSourcesSnapshot().getDataSourcesWithAllUsedSegments()) {
+ final long totalSizeOfUsedSegments = dataSource.getTotalSizeOfSegments();
+ final int numUsedSegments = dataSource.getSegments().size();
Review Comment:
We should also add a method `ImmutableDataSource.getNumSegments()` to avoid
materializing the collection inside `ImmutableDataSource.getSegments()`.
--
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]