Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -284,20 +283,14 @@ List<Object> tags() {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.getClass().getSimpleName()).append("[");
sb.append("shards = ").append(sortedUnion(processedShards, sliceQueue.remainingShardsIdentifiers()));
sb.append("shards = ")
.append(sliceQueue.partitioningStrategies().keySet().stream().sorted().collect(Collectors.joining(",", "[", "]")));
Copy link
Member

Choose a reason for hiding this comment

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

I think it was a mistake to stuff status-like-things things into toString. We have this information in the status already as a Map. Maybe we should just do getClass().getSimpleName() and call it good. If map_page_size isn't in the status we can put it there. This was all useful in a time before we had .status(). But we have it now and we don't need all the string stuff.

Copy link
Member Author

Choose a reason for hiding this comment

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

++ I can look into this later.

sb.append(", maxPageSize = ").append(maxPageSize);
describe(sb);
sb.append("]");
return sb.toString();
}

private static Set<String> sortedUnion(Collection<String> a, Collection<String> b) {
var result = new TreeSet<String>();
result.addAll(a);
result.addAll(b);
return result;
}

protected abstract void describe(StringBuilder sb);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
Expand Down Expand Up @@ -178,17 +177,6 @@ public Map<String, PartitioningStrategy> partitioningStrategies() {
return partitioningStrategies;
}

public Collection<String> remainingShardsIdentifiers() {
List<String> remaining = new ArrayList<>(slices.length());
for (int i = 0; i < slices.length(); i++) {
LuceneSlice slice = slices.get(i);
if (slice != null) {
remaining.add(slice.shardContext().shardIdentifier());
}
}
return remaining;
}

public static LuceneSliceQueue create(
List<? extends ShardContext> contexts,
Function<ShardContext, List<QueryAndTags>> queryFunction,
Expand Down