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 committed Aug 31, 2020
1 parent 64cd229 commit e37ce56
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 @@ -147,6 +147,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 @@ -295,6 +296,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 @@ -499,6 +501,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 @@ -614,6 +617,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 e37ce56

Please sign in to comment.