Skip to content

Commit

Permalink
Additional trace logging for desired balance computer (#105910)
Browse files Browse the repository at this point in the history
  • Loading branch information
idegtiarenko committed Mar 6, 2024
1 parent 8d93a93 commit eeecdbf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
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,18 @@ public DesiredBalance compute(
Predicate<DesiredBalanceInput> isFresh
) {

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

final var routingAllocation = desiredBalanceInput.routingAllocation().mutableCloneForSimulation();
final var routingNodes = routingAllocation.routingNodes();
Expand Down Expand Up @@ -283,7 +294,6 @@ public DesiredBalance compute(
hasChanges = true;
clusterInfoSimulator.simulateShardStarted(shardRouting);
routingNodes.startShard(logger, shardRouting, changes, 0L);
logger.trace("starting shard {}", shardRouting);
}
}
}
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 + '}';
}
}

0 comments on commit eeecdbf

Please sign in to comment.