Skip to content

Additional trace logging for desired balance computer #105910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Additional trace logging for desired balance computer
  • Loading branch information
idegtiarenko committed Mar 4, 2024
commit 3d79cd364573b9a9f067703160a7820a0d891c08
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ public void testRestoreSnapshotAllocationDoesNotExceedWatermark() throws Excepti
}

@TestIssueLogging(
value = "org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceReconciler:DEBUG,"
value = "org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceComputer:TRACE,"
+ "org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceReconciler:DEBUG,"
+ "org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceShardsAllocator:TRACE",
issueUrl = "https://github.com/elastic/elasticsearch/issues/105331"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,17 @@ public DesiredBalance compute(
Predicate<DesiredBalanceInput> isFresh
) {

logger.debug("Recomputing desired balance for [{}]", desiredBalanceInput.index());
if (logger.isTraceEnabled()) {
logger.trace(
"Recomputing desired balance for {}, {}, {}, {}",
previousDesiredBalance,
desiredBalanceInput.routingAllocation().routingNodes().toString(),
desiredBalanceInput.routingAllocation().clusterInfo().toString(),
desiredBalanceInput.routingAllocation().snapshotShardSizeInfo().toString()
);
} else {
logger.debug("Recomputing desired balance for [{}]", desiredBalanceInput.index());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be useful to see the .index() even if trace logging

}

final var routingAllocation = desiredBalanceInput.routingAllocation().mutableCloneForSimulation();
final var routingNodes = routingAllocation.routingNodes();
Expand Down Expand Up @@ -283,7 +293,6 @@ public DesiredBalance compute(
hasChanges = true;
clusterInfoSimulator.simulateShardStarted(shardRouting);
routingNodes.startShard(logger, shardRouting, changes, 0L);
logger.trace("starting shard {}", shardRouting);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as it is easy to deduct shard starting from above huge log entry

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public long getShardSize(ShardRouting shardRouting, long fallback) {
}
return shardSize;
}

@Override
public String toString() {
return "SnapshotShardSizeInfo{snapshotShardSizes=" + snapshotShardSizes + '}';
}
}