Java Code Examples for org.elasticsearch.Version#minimumCompatibilityVersion()

The following examples show how to use org.elasticsearch.Version#minimumCompatibilityVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransportClientNodesService.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportClientNodesService(Settings settings, ClusterName clusterName, TransportService transportService,
                                   ThreadPool threadPool, Headers headers, Version version) {
    super(settings);
    this.clusterName = clusterName;
    this.transportService = transportService;
    this.threadPool = threadPool;
    this.minCompatibilityVersion = version.minimumCompatibilityVersion();
    this.headers = headers;

    this.nodesSamplerInterval = this.settings.getAsTime("client.transport.nodes_sampler_interval", timeValueSeconds(5));
    this.pingTimeout = this.settings.getAsTime("client.transport.ping_timeout", timeValueSeconds(5)).millis();
    this.ignoreClusterName = this.settings.getAsBoolean("client.transport.ignore_cluster_name", false);

    if (logger.isDebugEnabled()) {
        logger.debug("node_sampler_interval[" + nodesSamplerInterval + "]");
    }

    if (this.settings.getAsBoolean("client.transport.sniff", false)) {
        this.nodesSampler = new SniffNodesSampler();
    } else {
        this.nodesSampler = new SimpleNodeSampler();
    }
    this.nodesSamplerFuture = threadPool.schedule(nodesSamplerInterval, ThreadPool.Names.GENERIC, new ScheduledNodeSampler());
}
 
Example 2
Source File: ElectMasterService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public ElectMasterService(Settings settings, Version version) {
    super(settings);
    this.minMasterVersion = version.minimumCompatibilityVersion();
    this.minimumMasterNodes = settings.getAsInt(DISCOVERY_ZEN_MINIMUM_MASTER_NODES,
            DEFAULT_DISCOVERY_ZEN_MINIMUM_MASTER_NODES);
    logger.debug("using minimum_master_nodes [{}]", minimumMasterNodes);
}
 
Example 3
Source File: TcpTransport.java    From crate with Apache License 2.0 5 votes vote down vote up
static void ensureVersionCompatibility(Version version, Version currentVersion, boolean isHandshake) {
    // for handshakes we are compatible with N-2 since otherwise we can't figure out our initial version
    // since we are compatible with N-1 and N+1 so we always send our minCompatVersion as the initial version in the
    // handshake. This looks odd but it's required to establish the connection correctly we check for real compatibility
    // once the connection is established
    final Version compatibilityVersion = isHandshake ? currentVersion.minimumCompatibilityVersion() : currentVersion;
    if (version.isCompatible(compatibilityVersion) == false) {
        final Version minCompatibilityVersion = isHandshake ? compatibilityVersion : compatibilityVersion.minimumCompatibilityVersion();
        String msg = "Received " + (isHandshake ? "handshake " : "") + "message from unsupported version: [";
        throw new IllegalStateException(msg + version + "] minimal compatible version is: [" + minCompatibilityVersion + "]");
    }
}