-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Zen2: Add basic Zen1 transport-level BWC #35443
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
Changes from all commits
7ffb8cf
9402687
dae6add
9b12b05
cf3d83e
f050b18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
package org.elasticsearch.cluster.coordination; | ||
|
||
import org.apache.logging.log4j.message.ParameterizedMessage; | ||
import org.elasticsearch.cluster.ClusterName; | ||
import org.elasticsearch.cluster.ClusterState; | ||
import org.elasticsearch.cluster.coordination.Coordinator.Mode; | ||
import org.elasticsearch.cluster.node.DiscoveryNode; | ||
import org.elasticsearch.cluster.node.DiscoveryNodes; | ||
|
@@ -30,6 +32,7 @@ | |
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.common.unit.TimeValue; | ||
import org.elasticsearch.common.util.concurrent.AbstractRunnable; | ||
import org.elasticsearch.discovery.zen.NodesFaultDetection; | ||
import org.elasticsearch.threadpool.ThreadPool.Names; | ||
import org.elasticsearch.transport.ConnectTransportException; | ||
import org.elasticsearch.transport.TransportChannel; | ||
|
@@ -77,6 +80,8 @@ public class FollowersChecker extends AbstractComponent { | |
public static final Setting<Integer> FOLLOWER_CHECK_RETRY_COUNT_SETTING = | ||
Setting.intSetting("cluster.fault_detection.follower_check.retry_count", 3, 1, Setting.Property.NodeScope); | ||
|
||
private final Settings settings; | ||
|
||
private final TimeValue followerCheckInterval; | ||
private final TimeValue followerCheckTimeout; | ||
private final int followerCheckRetryCount; | ||
|
@@ -94,6 +99,7 @@ public class FollowersChecker extends AbstractComponent { | |
public FollowersChecker(Settings settings, TransportService transportService, | ||
Consumer<FollowerCheckRequest> handleRequestAndUpdateState, | ||
BiConsumer<DiscoveryNode, String> onNodeFailure) { | ||
this.settings = settings; | ||
this.transportService = transportService; | ||
this.handleRequestAndUpdateState = handleRequestAndUpdateState; | ||
this.onNodeFailure = onNodeFailure; | ||
|
@@ -103,8 +109,12 @@ public FollowersChecker(Settings settings, TransportService transportService, | |
followerCheckRetryCount = FOLLOWER_CHECK_RETRY_COUNT_SETTING.get(settings); | ||
|
||
updateFastResponseState(0, Mode.CANDIDATE); | ||
transportService.registerRequestHandler(FOLLOWER_CHECK_ACTION_NAME, Names.SAME, FollowerCheckRequest::new, | ||
transportService.registerRequestHandler(FOLLOWER_CHECK_ACTION_NAME, Names.SAME, false, false, FollowerCheckRequest::new, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell this change is to set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good question. I wonder if it's something we should discuss with a larger group, but go with Zen1 defaults for now. |
||
(request, transportChannel, task) -> handleFollowerCheck(request, transportChannel)); | ||
transportService.registerRequestHandler( | ||
NodesFaultDetection.PING_ACTION_NAME, NodesFaultDetection.PingRequest::new, Names.SAME, false, false, | ||
(request, channel, task) -> // TODO: check that we're a follower of the requesting node? | ||
channel.sendResponse(new NodesFaultDetection.PingResponse())); | ||
transportService.addConnectionListener(new TransportConnectionListener() { | ||
@Override | ||
public void onNodeDisconnected(DiscoveryNode node) { | ||
|
@@ -290,7 +300,18 @@ private void handleWakeUp() { | |
|
||
final FollowerCheckRequest request = new FollowerCheckRequest(fastResponseState.term, transportService.getLocalNode()); | ||
logger.trace("handleWakeUp: checking {} with {}", discoveryNode, request); | ||
transportService.sendRequest(discoveryNode, FOLLOWER_CHECK_ACTION_NAME, request, | ||
|
||
final String actionName; | ||
final TransportRequest transportRequest; | ||
if (Coordinator.isZen1Node(discoveryNode)) { | ||
actionName = NodesFaultDetection.PING_ACTION_NAME; | ||
transportRequest = new NodesFaultDetection.PingRequest(discoveryNode, ClusterName.CLUSTER_NAME_SETTING.get(settings), | ||
transportService.getLocalNode(), ClusterState.UNKNOWN_VERSION); | ||
} else { | ||
actionName = FOLLOWER_CHECK_ACTION_NAME; | ||
transportRequest = request; | ||
} | ||
transportService.sendRequest(discoveryNode, actionName, transportRequest, | ||
TransportRequestOptions.builder().withTimeout(followerCheckTimeout).withType(Type.PING).build(), | ||
new TransportResponseHandler<Empty>() { | ||
@Override | ||
|
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.
Perhaps insert:
Assuming we are going to remove this before GA?
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.
added in 9b12b05