Index / Delete API when causing auto index creation can cause buffer data overrun, closes #1122.
This commit is contained in:
parent
e98860dc29
commit
848638d53c
|
@ -71,24 +71,25 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct
|
|||
return ThreadPool.Names.INDEX;
|
||||
}
|
||||
|
||||
@Override protected void doExecute(final DeleteRequest deleteRequest, final ActionListener<DeleteResponse> listener) {
|
||||
if (autoCreateIndex && !clusterService.state().metaData().hasConcreteIndex(deleteRequest.index())) {
|
||||
createIndexAction.execute(new CreateIndexRequest(deleteRequest.index()), new ActionListener<CreateIndexResponse>() {
|
||||
@Override protected void doExecute(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
|
||||
if (autoCreateIndex && !clusterService.state().metaData().hasConcreteIndex(request.index())) {
|
||||
request.beforeLocalFork();
|
||||
createIndexAction.execute(new CreateIndexRequest(request.index()), new ActionListener<CreateIndexResponse>() {
|
||||
@Override public void onResponse(CreateIndexResponse result) {
|
||||
innerExecute(deleteRequest, listener);
|
||||
innerExecute(request, listener);
|
||||
}
|
||||
|
||||
@Override public void onFailure(Throwable e) {
|
||||
if (ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException) {
|
||||
// we have the index, do it
|
||||
innerExecute(deleteRequest, listener);
|
||||
innerExecute(request, listener);
|
||||
} else {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
innerExecute(deleteRequest, listener);
|
||||
innerExecute(request, listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi
|
|||
}
|
||||
}
|
||||
if (autoCreateIndex && !clusterService.state().metaData().hasConcreteIndex(request.index())) {
|
||||
request.beforeLocalFork(); // we fork on another thread...
|
||||
createIndexAction.execute(new CreateIndexRequest(request.index()).cause("auto(index api)"), new ActionListener<CreateIndexResponse>() {
|
||||
@Override public void onResponse(CreateIndexResponse result) {
|
||||
innerExecute(request, listener);
|
||||
|
|
Loading…
Reference in New Issue