Skip to content

Commit 936dbb0

Browse files
authored
Isolate Zen1 (#39470)
Cherry-picks a few commits from #39466 to align 7.x with master branch.
1 parent c72a799 commit 936dbb0

24 files changed

+559
-1139
lines changed

docs/plugins/integrations.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ releases 2.0 and later do not support rivers.
194194
A pluggable elastic JavaScript query DSL builder for Elasticsearch
195195

196196
* https://www.wireshark.org/[Wireshark]:
197-
Protocol dissection for Zen discovery, HTTP and the binary protocol
197+
Protocol dissection for HTTP and the transport protocol
198198

199199
* https://www.itemsapi.com/[ItemsAPI]:
200200
Search backend for mobile and web

docs/reference/getting-started.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ If everything goes well with installation, you should see a bunch of messages th
248248
[2018-09-13T12:20:05,202][INFO ][o.e.t.TransportService ] [localhost.localdomain] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
249249
[2018-09-13T12:20:05,221][WARN ][o.e.b.BootstrapChecks ] [localhost.localdomain] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
250250
[2018-09-13T12:20:05,221][WARN ][o.e.b.BootstrapChecks ] [localhost.localdomain] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
251-
[2018-09-13T12:20:08,355][INFO ][o.e.c.s.MasterService ] [localhost.localdomain] zen-disco-elected-as-master ([0] nodes joined)[, ], reason: master node changed {previous [], current [{localhost.localdomain}{B0aEHNagTiWx7SYj-l4NTw}{hzsQz6CVQMCTpMCVLM4IHg}{127.0.0.1}{127.0.0.1:9300}{testattr=test}]}
252-
[2018-09-13T12:20:08,360][INFO ][o.e.c.s.ClusterApplierService] [localhost.localdomain] master node changed {previous [], current [{localhost.localdomain}{B0aEHNagTiWx7SYj-l4NTw}{hzsQz6CVQMCTpMCVLM4IHg}{127.0.0.1}{127.0.0.1:9300}{testattr=test}]}, reason: apply cluster state (from master [master {localhost.localdomain}{B0aEHNagTiWx7SYj-l4NTw}{hzsQz6CVQMCTpMCVLM4IHg}{127.0.0.1}{127.0.0.1:9300}{testattr=test} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)[, ]]])
251+
[2018-09-13T12:20:08,355][INFO ][o.e.c.s.MasterService ] [localhost.localdomain] elected-as-master ([0] nodes joined)[, ], reason: master node changed {previous [], current [{localhost.localdomain}{B0aEHNagTiWx7SYj-l4NTw}{hzsQz6CVQMCTpMCVLM4IHg}{127.0.0.1}{127.0.0.1:9300}{testattr=test}]}
252+
[2018-09-13T12:20:08,360][INFO ][o.e.c.s.ClusterApplierService] [localhost.localdomain] master node changed {previous [], current [{localhost.localdomain}{B0aEHNagTiWx7SYj-l4NTw}{hzsQz6CVQMCTpMCVLM4IHg}{127.0.0.1}{127.0.0.1:9300}{testattr=test}]}, reason: apply cluster state (from master [master {localhost.localdomain}{B0aEHNagTiWx7SYj-l4NTw}{hzsQz6CVQMCTpMCVLM4IHg}{127.0.0.1}{127.0.0.1:9300}{testattr=test} committed version [1] source [elected-as-master ([0] nodes joined)[, ]]])
253253
[2018-09-13T12:20:08,384][INFO ][o.e.h.n.Netty4HttpServerTransport] [localhost.localdomain] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
254254
[2018-09-13T12:20:08,384][INFO ][o.e.n.Node ] [localhost.localdomain] started
255255

docs/reference/modules/transport.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ PUT _cluster/settings
156156
{
157157
"transient" : {
158158
"transport.tracer.include" : "*",
159-
"transport.tracer.exclude" : "internal:discovery/zen/fd*"
159+
"transport.tracer.exclude" : "internal:coordination/fault_detection/*"
160160
}
161161
}
162162
--------------------------------------------------

server/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.elasticsearch.cluster.ClusterState;
2828
import org.elasticsearch.cluster.ClusterStateObserver;
2929
import org.elasticsearch.cluster.block.ClusterBlockException;
30+
import org.elasticsearch.cluster.coordination.PublicationTransportHandler;
3031
import org.elasticsearch.cluster.metadata.IndexMetaData;
3132
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
3233
import org.elasticsearch.cluster.metadata.MetaData;
@@ -42,8 +43,6 @@
4243
import java.io.IOException;
4344
import java.util.function.Predicate;
4445

45-
import static org.elasticsearch.discovery.zen.PublishClusterStateAction.serializeFullClusterState;
46-
4746
public class TransportClusterStateAction extends TransportMasterNodeReadAction<ClusterStateRequest, ClusterStateResponse> {
4847

4948

@@ -185,7 +184,7 @@ private void buildResponse(final ClusterStateRequest request,
185184
}
186185
}
187186
listener.onResponse(new ClusterStateResponse(currentState.getClusterName(), builder.build(),
188-
serializeFullClusterState(currentState, Version.CURRENT).length(), false));
187+
PublicationTransportHandler.serializeFullClusterState(currentState, Version.CURRENT).length(), false));
189188
}
190189

191190

server/src/main/java/org/elasticsearch/cluster/ClusterState.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import org.elasticsearch.common.xcontent.XContentBuilder;
6161
import org.elasticsearch.common.xcontent.XContentHelper;
6262
import org.elasticsearch.discovery.Discovery;
63-
import org.elasticsearch.discovery.zen.PublishClusterStateAction;
6463

6564
import java.io.IOException;
6665
import java.util.EnumSet;
@@ -80,9 +79,8 @@
8079
* The cluster state can be updated only on the master node. All updates are performed by on a
8180
* single thread and controlled by the {@link ClusterService}. After every update the
8281
* {@link Discovery#publish} method publishes a new version of the cluster state to all other nodes in the
83-
* cluster. The actual publishing mechanism is delegated to the {@link Discovery#publish} method and depends on
84-
* the type of discovery. In the Zen Discovery it is handled in the {@link PublishClusterStateAction#publish} method. The
85-
* publishing mechanism can be overridden by other discovery.
82+
* cluster. The actual publishing mechanism is delegated to the {@link Discovery#publish} method and depends on
83+
* the type of discovery.
8684
* <p>
8785
* The cluster state implements the {@link Diffable} interface in order to support publishing of cluster state
8886
* differences instead of the entire state on each change. The publishing mechanism should only send differences

server/src/main/java/org/elasticsearch/cluster/NodeConnectionsService.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import org.apache.logging.log4j.LogManager;
2222
import org.apache.logging.log4j.Logger;
2323
import org.apache.logging.log4j.message.ParameterizedMessage;
24+
import org.elasticsearch.cluster.coordination.FollowersChecker;
25+
import org.elasticsearch.cluster.coordination.LeaderChecker;
2426
import org.elasticsearch.cluster.node.DiscoveryNode;
2527
import org.elasticsearch.cluster.node.DiscoveryNodes;
2628
import org.elasticsearch.common.component.AbstractLifecycleComponent;
@@ -32,8 +34,6 @@
3234
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
3335
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
3436
import org.elasticsearch.common.util.concurrent.KeyedLock;
35-
import org.elasticsearch.discovery.zen.MasterFaultDetection;
36-
import org.elasticsearch.discovery.zen.NodesFaultDetection;
3737
import org.elasticsearch.threadpool.Scheduler;
3838
import org.elasticsearch.threadpool.ThreadPool;
3939
import org.elasticsearch.transport.TransportService;
@@ -51,8 +51,7 @@
5151
* This component is responsible for connecting to nodes once they are added to the cluster state, and disconnect when they are
5252
* removed. Also, it periodically checks that all connections are still open and if needed restores them.
5353
* Note that this component is *not* responsible for removing nodes from the cluster if they disconnect / do not respond
54-
* to pings. This is done by {@link NodesFaultDetection}. Master fault detection
55-
* is done by {@link MasterFaultDetection}.
54+
* to pings. This is done by {@link FollowersChecker}. Master fault detection is done by {@link LeaderChecker}.
5655
*/
5756
public class NodeConnectionsService extends AbstractLifecycleComponent {
5857
private static final Logger logger = LogManager.getLogger(NodeConnectionsService.class);

server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,10 @@ private void cancelActivePublication(String reason) {
10711071
}
10721072
}
10731073

1074+
public Collection<BiConsumer<DiscoveryNode, ClusterState>> getOnJoinValidators() {
1075+
return onJoinValidators;
1076+
}
1077+
10741078
public enum Mode {
10751079
CANDIDATE, LEADER, FOLLOWER
10761080
}

server/src/main/java/org/elasticsearch/cluster/coordination/JoinHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public ClusterTasksResult<JoinTaskExecutor.Task> execute(ClusterState currentSta
131131
});
132132

133133
transportService.registerRequestHandler(VALIDATE_JOIN_ACTION_NAME,
134-
MembershipAction.ValidateJoinRequest::new, ThreadPool.Names.GENERIC,
134+
ValidateJoinRequest::new, ThreadPool.Names.GENERIC,
135135
(request, channel, task) -> {
136136
final ClusterState localState = currentStateSupplier.get();
137137
if (localState.metaData().clusterUUIDCommitted() &&
@@ -145,7 +145,7 @@ public ClusterTasksResult<JoinTaskExecutor.Task> execute(ClusterState currentSta
145145
});
146146

147147
transportService.registerRequestHandler(MembershipAction.DISCOVERY_JOIN_VALIDATE_ACTION_NAME,
148-
MembershipAction.ValidateJoinRequest::new, ThreadPool.Names.GENERIC,
148+
ValidateJoinRequest::new, ThreadPool.Names.GENERIC,
149149
(request, channel, task) -> {
150150
joinValidators.forEach(action -> action.accept(transportService.getLocalNode(), request.getState()));
151151
channel.sendResponse(Empty.INSTANCE);
@@ -276,7 +276,7 @@ public void sendValidateJoinRequest(DiscoveryNode node, ClusterState state, Acti
276276
actionName = VALIDATE_JOIN_ACTION_NAME;
277277
}
278278
transportService.sendRequest(node, actionName,
279-
new MembershipAction.ValidateJoinRequest(state),
279+
new ValidateJoinRequest(state),
280280
TransportRequestOptions.builder().withTimeout(joinTimeout).build(),
281281
new EmptyTransportResponseHandler(ThreadPool.Names.GENERIC) {
282282
@Override
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.elasticsearch.cluster.coordination;
20+
21+
import org.elasticsearch.cluster.ClusterState;
22+
import org.elasticsearch.common.io.stream.StreamInput;
23+
import org.elasticsearch.common.io.stream.StreamOutput;
24+
import org.elasticsearch.transport.TransportRequest;
25+
26+
import java.io.IOException;
27+
28+
public class ValidateJoinRequest extends TransportRequest {
29+
private ClusterState state;
30+
31+
public ValidateJoinRequest() {}
32+
33+
public ValidateJoinRequest(ClusterState state) {
34+
this.state = state;
35+
}
36+
37+
@Override
38+
public void readFrom(StreamInput in) throws IOException {
39+
super.readFrom(in);
40+
this.state = ClusterState.readFrom(in, null);
41+
}
42+
43+
@Override
44+
public void writeTo(StreamOutput out) throws IOException {
45+
super.writeTo(out);
46+
this.state.writeTo(out);
47+
}
48+
49+
public ClusterState getState() {
50+
return state;
51+
}
52+
}

server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
import org.elasticsearch.discovery.DiscoveryModule;
6868
import org.elasticsearch.discovery.DiscoverySettings;
6969
import org.elasticsearch.discovery.PeerFinder;
70+
import org.elasticsearch.discovery.SeedHostsResolver;
71+
import org.elasticsearch.discovery.SettingsBasedSeedHostsProvider;
7072
import org.elasticsearch.discovery.zen.ElectMasterService;
7173
import org.elasticsearch.discovery.zen.FaultDetection;
72-
import org.elasticsearch.discovery.SettingsBasedSeedHostsProvider;
73-
import org.elasticsearch.discovery.zen.UnicastZenPing;
7474
import org.elasticsearch.discovery.zen.ZenDiscovery;
7575
import org.elasticsearch.env.Environment;
7676
import org.elasticsearch.env.NodeEnvironment;
@@ -407,10 +407,10 @@ public void apply(Settings value, Settings current, Settings previous) {
407407
ZenDiscovery.MAX_PENDING_CLUSTER_STATES_SETTING,
408408
SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING,
409409
SettingsBasedSeedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING,
410-
UnicastZenPing.DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING,
411-
UnicastZenPing.DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING,
412-
UnicastZenPing.LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING,
413-
UnicastZenPing.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT,
410+
SeedHostsResolver.DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING,
411+
SeedHostsResolver.DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING,
412+
SeedHostsResolver.LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING,
413+
SeedHostsResolver.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT,
414414
SearchService.DEFAULT_KEEPALIVE_SETTING,
415415
SearchService.KEEPALIVE_INTERVAL_SETTING,
416416
SearchService.MAX_KEEPALIVE_SETTING,

0 commit comments

Comments
 (0)