mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-30 11:58:36 +00:00
Index / Delete API: timeout should apply automatically to the auto create index API master timeout, closes #1664.
This commit is contained in:
parent
5b62c2ae26
commit
3cee291bc2
@ -251,6 +251,15 @@ public class CreateIndexRequest extends MasterNodeOperationRequest {
|
|||||||
return timeout(TimeValue.parseTimeValue(timeout, null));
|
return timeout(TimeValue.parseTimeValue(timeout, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A timeout value in case the master has not been discovered yet or disconnected.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CreateIndexRequest masterNodeTimeout(TimeValue timeout) {
|
||||||
|
this.masterNodeTimeout = timeout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
super.readFrom(in);
|
||||||
|
@ -75,7 +75,7 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct
|
|||||||
protected void doExecute(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
|
protected void doExecute(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
|
||||||
if (autoCreateIndex && !clusterService.state().metaData().hasConcreteIndex(request.index())) {
|
if (autoCreateIndex && !clusterService.state().metaData().hasConcreteIndex(request.index())) {
|
||||||
request.beforeLocalFork();
|
request.beforeLocalFork();
|
||||||
createIndexAction.execute(new CreateIndexRequest(request.index()), new ActionListener<CreateIndexResponse>() {
|
createIndexAction.execute(new CreateIndexRequest(request.index()).cause("auto(delete api)").masterNodeTimeout(request.timeout()), new ActionListener<CreateIndexResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(CreateIndexResponse result) {
|
public void onResponse(CreateIndexResponse result) {
|
||||||
innerExecute(request, listener);
|
innerExecute(request, listener);
|
||||||
|
@ -93,7 +93,7 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi
|
|||||||
// if we don't have a master, we don't have metadata, that's fine, let it find a master using create index API
|
// if we don't have a master, we don't have metadata, that's fine, let it find a master using create index API
|
||||||
if (autoCreateIndex && !clusterService.state().metaData().hasConcreteIndex(request.index())) {
|
if (autoCreateIndex && !clusterService.state().metaData().hasConcreteIndex(request.index())) {
|
||||||
request.beforeLocalFork(); // we fork on another thread...
|
request.beforeLocalFork(); // we fork on another thread...
|
||||||
createIndexAction.execute(new CreateIndexRequest(request.index()).cause("auto(index api)"), new ActionListener<CreateIndexResponse>() {
|
createIndexAction.execute(new CreateIndexRequest(request.index()).cause("auto(index api)").masterNodeTimeout(request.timeout()), new ActionListener<CreateIndexResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(CreateIndexResponse result) {
|
public void onResponse(CreateIndexResponse result) {
|
||||||
innerExecute(request, listener);
|
innerExecute(request, listener);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user