Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
quux00 committed Aug 7, 2023
1 parent 790b9da commit 364668d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -431,22 +431,6 @@ The API returns the following response:
--------------------------------------------------
// TEST[skip: terminated_early is absent from final results so is hard to reproduce here]

x // TESTRESPONSE[s/FklQYndoTDJ2VEFlMEVBTzFJMGhJVFEaLVlKYndBWWZSMUdicUc4WVlEaFl4ZzoxNTU=/$body.id/]
x // TESTRESPONSE[s/"is_partial": true/"is_partial": $body.is_partial/]
x // TESTRESPONSE[s/"is_running": true/"is_running": $body.is_running/]
x // TESTRESPONSE[s/1685563581380/$body.start_time_in_millis/]
x // TESTRESPONSE[s/1685995581380/$body.expiration_time_in_millis/]
x // TESTRESPONSE[s/"response"/"completion_time_in_millis": $body.completion_time_in_millis,\n "response"/]
x // TESTRESPONSE[s/"num_reduce_phases": 0/"num_reduce_phases": "$body.response.num_reduce_phases"/]
x // TESTRESPONSE[s/"took": 1020/"took": "$body.response.took"/]
x // TESTRESPONSE[s/"total": 8/"total": $body.response._shards.total/]
x // TESTRESPONSE[s/"successful": 0/"successful": $body.response._shards.successful/]
x // TESTRESPONSE[s/"successful" : 0/"successful": $body.response._clusters.successful/]
x // TESTRESPONSE[s/"value": 0/"value": "$body.response.hits.total.value"/]
x // TESTRESPONSE[s/"max_score": null/"max_score": "$body.response.hits.max_score"/]
x // TESTRESPONSE[s/"hits": \[\]/"hits": $body.response.hits.hits/]


<1> The async search id.
<2> When `ccs_minimize_roundtrips` = `true` and searches on the remote clusters
are still running, this section indicates the number of shards in scope for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@
import org.elasticsearch.transport.TransportRequestOptions;
import org.elasticsearch.transport.TransportResponseHandler;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xcontent.ToXContent;
import org.elasticsearch.xcontent.XContentFactory;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -539,7 +536,6 @@ public void onResponse(SearchResponse searchResponse) {
@Override
public void onFailure(Exception e) {
ShardSearchFailure failure = new ShardSearchFailure(e);
logCCSError(failure, clusterAlias, skipUnavailable);
ccsClusterInfoUpdate(failure, clusters.getCluster(clusterAlias), skipUnavailable);
if (skipUnavailable) {
listener.onResponse(SearchResponse.empty(timeProvider::buildTookInMillis, clusters));
Expand Down Expand Up @@ -1411,7 +1407,6 @@ public final void onResponse(Response response) {
@Override
public final void onFailure(Exception e) {
ShardSearchFailure f = new ShardSearchFailure(e);
logCCSError(f, clusterAlias, skipUnavailable);
if (skipUnavailable) {
if (cluster != null) {
ccsClusterInfoUpdate(f, cluster, skipUnavailable);
Expand Down Expand Up @@ -1456,30 +1451,6 @@ private void maybeFinish() {
abstract FinalResponse createFinalResponse();
}

/**
* In order to gather data on what types of CCS errors happen in the field, we will log
* them using the ShardSearchFailure XContent (JSON), which supplies information about underlying
* causes of shard failures.
* @param f ShardSearchFailure to log
* @param clusterAlias cluster on which the failure occurred
* @param skipUnavailable the skip_unavailable setting of the cluster with the search error
*/
private static void logCCSError(ShardSearchFailure f, String clusterAlias, boolean skipUnavailable) {
String errorInfo;
try {
errorInfo = Strings.toString(f.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS));
} catch (IOException ex) {
// use the toString as a fallback if for some reason the XContent conversion to JSON fails
errorInfo = f.toString();
}
logger.info(
"CCS remote cluster failure. Cluster [{}]. skip_unavailable: [{}]. Error: {}",
clusterAlias,
skipUnavailable,
errorInfo
);
}

private static RemoteTransportException wrapRemoteClusterFailure(String clusterAlias, Exception e) {
return new RemoteTransportException("error while communicating with remote cluster [" + clusterAlias + "]", e);
}
Expand Down

0 comments on commit 364668d

Please sign in to comment.