Skip to content

Commit

Permalink
Implement toString for BulkByScrollTask (#59042)
Browse files Browse the repository at this point in the history
We should implement "toString" of BulkByScrollTask.StatusOrException 
to have a meaningful log message when a reindex task completes.
  • Loading branch information
dnhatn committed Jul 6, 2020
1 parent a9151db commit 62763b1
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -985,6 +986,15 @@ public static StatusOrException fromXContent(XContentParser parser) throws IOExc
}
}

@Override
public String toString() {
if (exception != null) {
return "BulkByScrollTask{error=" + Strings.toString(this) + "}";
} else {
return "BulkByScrollTask{status=" + Strings.toString(this) + "}";
}
}

@Override
public boolean equals(Object obj) {
if (obj == null) {
Expand Down

0 comments on commit 62763b1

Please sign in to comment.