Reindex: do not log when can't clear old scroll (#22942)
Versions of Elasticsearch prior to 2.0 would return a scroll id even with the last scroll response. They'd then automatically clear the scroll because it is empty. When terminating reindex will attempt to clear the last scroll it received, regardless of the remote version. This quiets the warning when the scroll cannot be cleared for versions before 2.0. Closes #22937
This commit is contained in:
parent
9a0b216c36
commit
18eb0827e6
|
@ -120,10 +120,23 @@ public class RemoteScrollableHitSource extends ScrollableHitSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Exception t) {
|
public void onFailure(Exception e) {
|
||||||
logger.warn((Supplier<?>) () -> new ParameterizedMessage("Failed to clear scroll [{}]", scrollId), t);
|
logFailure(e);
|
||||||
onCompletion.run();
|
onCompletion.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void logFailure(Exception e) {
|
||||||
|
if (e instanceof ResponseException) {
|
||||||
|
ResponseException re = (ResponseException) e;
|
||||||
|
if (remoteVersion.before(Version.V_2_0_0) && re.getResponse().getStatusLine().getStatusCode() == 404) {
|
||||||
|
logger.debug((Supplier<?>) () -> new ParameterizedMessage(
|
||||||
|
"Failed to clear scroll [{}] from pre-2.0 Elasticsearch. This is normal if the request terminated "
|
||||||
|
+ "normally as the scroll has already been cleared automatically.", scrollId), e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.warn((Supplier<?>) () -> new ParameterizedMessage("Failed to clear scroll [{}]", scrollId), e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +147,7 @@ public class RemoteScrollableHitSource extends ScrollableHitSource {
|
||||||
threadPool.generic().submit(() -> {
|
threadPool.generic().submit(() -> {
|
||||||
try {
|
try {
|
||||||
client.close();
|
client.close();
|
||||||
logger.info("Shut down remote connection");
|
logger.debug("Shut down remote connection");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("Failed to shutdown the remote connection", e);
|
logger.error("Failed to shutdown the remote connection", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue