Implement toString for BulkByScrollTask (#59042)

We should implement "toString" of BulkByScrollTask.StatusOrException 
to have a meaningful log message when a reindex task completes.
This commit is contained in:
Nhat Nguyen 2020-07-05 22:05:38 -04:00
parent a9151db735
commit 62763b177d
1 changed files with 10 additions and 0 deletions

View File

@ -22,6 +22,7 @@ package org.elasticsearch.index.reindex;
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;
@ -985,6 +986,15 @@ public class BulkByScrollTask extends CancellableTask {
}
}
@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) {