Skip to content

Commit

Permalink
Set timeout of auto put-follow request to unbounded (#61679)
Browse files Browse the repository at this point in the history
If the master node of the follower cluster is busy, then the 
auto-follower will fail to initialize the following process. This also
occurs when an auto-follow pattern matches multiple indices. We should
set the timeout of put-follow requests issued by the auto-follower to
unbounded to avoid this problem.

Closes #56891
  • Loading branch information
dnhatn authored Aug 31, 2020
1 parent e77c8ef commit 64734ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ private void followLeaderIndex(String autoFollowPattenName,
request.getParameters().setMaxWriteBufferSize(pattern.getMaxWriteBufferSize());
request.getParameters().setMaxRetryDelay(pattern.getMaxRetryDelay());
request.getParameters().setReadPollTimeout(pattern.getReadPollTimeout());
request.masterNodeTimeout(TimeValue.MAX_VALUE);

// Execute if the create and follow api call succeeds:
Runnable successHandler = () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ void createAndFollow(Map<String, String> headers,
assertThat(followRequest.getRemoteCluster(), equalTo("remote"));
assertThat(followRequest.getLeaderIndex(), equalTo("logs-20190101"));
assertThat(followRequest.getFollowerIndex(), equalTo("logs-20190101"));
assertThat(followRequest.masterNodeTimeout(), equalTo(TimeValue.MAX_VALUE));
successHandler.run();
}

Expand Down Expand Up @@ -296,6 +297,7 @@ void createAndFollow(Map<String, String> headers,
assertThat(followRequest.getRemoteCluster(), equalTo("remote"));
assertThat(followRequest.getLeaderIndex(), equalTo("logs-20190101"));
assertThat(followRequest.getFollowerIndex(), equalTo("logs-20190101"));
assertThat(followRequest.masterNodeTimeout(), equalTo(TimeValue.MAX_VALUE));
successHandler.run();
}

Expand Down Expand Up @@ -500,6 +502,7 @@ void getRemoteClusterState(String remote, long metadataVersion, BiConsumer<Clust
void createAndFollow(Map<String, String> headers, PutFollowAction.Request request,
Runnable successHandler, Consumer<Exception> failureHandler) {
assertThat(request.getRemoteCluster(), equalTo(remoteCluster));
assertThat(request.masterNodeTimeout(), equalTo(TimeValue.MAX_VALUE));
assertThat(request.getFollowerIndex(), startsWith("copy-"));
followedIndices.add(request.getLeaderIndex());
successHandler.run();
Expand Down Expand Up @@ -615,6 +618,7 @@ void createAndFollow(Map<String, String> headers,
Runnable successHandler,
Consumer<Exception> failureHandler) {
assertThat(followRequest.getRemoteCluster(), equalTo("remote"));
assertThat(followRequest.masterNodeTimeout(), equalTo(TimeValue.MAX_VALUE));
assertThat(followRequest.getLeaderIndex(), equalTo("logs-20190101"));
assertThat(followRequest.getFollowerIndex(), equalTo("logs-20190101"));
failureHandler.accept(failure);
Expand Down

0 comments on commit 64734ee

Please sign in to comment.