Skip to content

Commit 02e8c4e

Browse files
nicer logging
1 parent 99872cb commit 02e8c4e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

server/src/main/java/org/elasticsearch/cluster/routing/allocation/AllocationService.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ private void resetFailedAllocationCounter(RoutingAllocation allocation) {
332332
* @param <T> The list element type.
333333
* @return A comma-separated string of the first few elements.
334334
*/
335-
static <T> String firstListElementsToCommaDelimitedString(List<T> elements, Function<T, String> formatter, boolean isDebugEnabled) {
335+
public static <T> String firstListElementsToCommaDelimitedString(List<T> elements, Function<T, String> formatter,
336+
boolean isDebugEnabled) {
336337
final int maxNumberOfElements = 10;
337338
if (isDebugEnabled || elements.size() <= maxNumberOfElements) {
338339
return elements.stream().map(formatter).collect(Collectors.joining(", "));

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.elasticsearch.cluster.metadata.RepositoriesMetaData;
4848
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
4949
import org.elasticsearch.cluster.node.DiscoveryNode;
50+
import org.elasticsearch.cluster.routing.allocation.AllocationService;
5051
import org.elasticsearch.cluster.service.ClusterService;
5152
import org.elasticsearch.common.Nullable;
5253
import org.elasticsearch.common.Numbers;
@@ -1270,7 +1271,8 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS
12701271
@Override
12711272
public void onResponse(Collection<Void> voids) {
12721273
logger.info("Successfully loaded all snapshot's version information for {} from snapshot metadata",
1273-
snapshotIdsWithoutVersion);
1274+
AllocationService.firstListElementsToCommaDelimitedString(
1275+
snapshotIdsWithoutVersion, SnapshotId::toString, logger.isDebugEnabled()));
12741276
}
12751277

12761278
@Override

0 commit comments

Comments
 (0)