New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle failed request when auto create index is disabled #8163
Conversation
I think adding an explicit handling of IndexMissingException which will not cause the entire request to fail. However, the source of the problem is deeper and lies in the fact that we don't deal with failure correctly in the |
@bleskes can you review the last change please? thx |
@@ -354,6 +359,16 @@ private boolean addFailureIfIndexIsClosed(DocumentRequest request, BulkRequest b | |||
concreteIndex = concreteIndices.resolveIfAbsent(request.index(), request.indicesOptions()); | |||
} catch (IndexClosedException ice) { | |||
isClosed = true; | |||
} catch (IndexMissingException ime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we simplify this code by merging the two use cases. The only difference is the exception that goes into the BulkItemResponse.Failure object. Can we have that as a variable instead of isClosed , i.e., Exception unavailableException = null
and later check:
if (unavailableException != null) {
BulkItemResponse.Failure failure = new BulkItemResponse.Failure(request.index(), request.type(), request.id(), unavailableException);
BulkItemResponse bulkItemResponse = new BulkItemResponse(idx, "index", failure);
responses.set(idx, bulkItemResponse);
// make sure the request gets never processed again
bulkRequest.requests.set(idx, null);
}
@markharwood I left one more comment, once that's done I think it's good. |
If a bulk request contains a mix of indexing requests for an existing index and one that needs to be auto-created but a cluster configuration prevents the auto-create of the new index the ingest process hangs. The exception for the failure to create an index was not caught or reported back properly. Added a Junit test to recreate the issue and the associated fix is in TransportBulkAction. Closes #8125
Rebased and consolidated exception handling |
LGTM. Thx @markharwood |
@bleskes Pushed to master, 1.x and 1.4 but TransportBulkAction in 1.3 looks different and is missing addFailureIfIndexIsClosed() method. |
@markharwood thx. I think this an important bug fix. It can go into 1.3 as well. |
@markharwood @GaelTadh I think #6410 should go into 1.3 as well |
OK - then let's merge this only into 1.4. thanks @GaelTadh |
from the history here this seems to be committed to 1.4 and up, can we close it? |
Committed to 1.4 and up, see d12ae19 |
If a bulk request contains a mix of indexing requests for an existing index and one that needs to be auto-created but a cluster configuration prevents the auto-create of the new index, the ingest process hangs. The exception for the failure to create an index was not caught or reported back properly. Added a Junit test to recreate the issue and the associated fix is in TransportBulkAction.
Closes #8125