org.elasticsearch.cluster.node.DiscoveryNodes.getMinNodeVersion()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(71)

本文整理了Java中org.elasticsearch.cluster.node.DiscoveryNodes.getMinNodeVersion()方法的一些代码示例,展示了DiscoveryNodes.getMinNodeVersion()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DiscoveryNodes.getMinNodeVersion()方法的具体详情如下:
包路径:org.elasticsearch.cluster.node.DiscoveryNodes
类名称:DiscoveryNodes
方法名:getMinNodeVersion

DiscoveryNodes.getMinNodeVersion介绍

[英]Returns the version of the node with the oldest version in the cluster.
[中]返回集群中具有最旧版本的节点的版本。

代码示例

代码示例来源:origin: floragunncom/search-guard

private static boolean clusterHas5xNodes(ClusterState state) {
  return state.nodes().getMinNodeVersion().before(Version.V_6_0_0_alpha1);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/** ensures that the joining node has a version that's compatible with all current nodes*/
static void ensureNodesCompatibility(final Version joiningNodeVersion, DiscoveryNodes currentNodes) {
  final Version minNodeVersion = currentNodes.getMinNodeVersion();
  final Version maxNodeVersion = currentNodes.getMaxNodeVersion();
  ensureNodesCompatibility(joiningNodeVersion, minNodeVersion, maxNodeVersion);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

void handleJoinRequest(final DiscoveryNode node, final ClusterState state, final MembershipAction.JoinCallback callback) {
  if (nodeJoinController == null) {
    throw new IllegalStateException("discovery module is not yet started");
  } else {
    // we do this in a couple of places including the cluster update thread. This one here is really just best effort
    // to ensure we fail as fast as possible.
    onJoinValidators.stream().forEach(a -> a.accept(node, state));
    if (state.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false) {
      MembershipAction.ensureMajorVersionBarrier(node.getVersion(), state.getNodes().getMinNodeVersion());
    }
    // try and connect to the node, if it fails, we can raise an exception back to the client...
    transportService.connectToNode(node);
    // validate the join request, will throw a failure if it fails, which will get back to the
    // node calling the join request
    try {
      membership.sendValidateJoinRequestBlocking(node, state, joinTimeout);
    } catch (Exception e) {
      logger.warn(() -> new ParameterizedMessage("failed to validate incoming join request from node [{}]", node),
        e);
      callback.onFailure(new IllegalStateException("failure when sending a validation request to node", e));
      return;
    }
    nodeJoinController.handleJoinRequest(node, callback);
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

if (nodes.getMinNodeVersion().onOrAfter(Version.V_6_0_0_alpha1)) {

代码示例来源:origin: org.elasticsearch/elasticsearch

Version minClusterNodeVersion = newState.nodes().getMinNodeVersion();
Version maxClusterNodeVersion = newState.nodes().getMaxNodeVersion();

代码示例来源:origin: org.elasticsearch/elasticsearch

private DefaultSearchContext createSearchContext(ShardSearchRequest request, TimeValue timeout,
                         boolean assertAsyncActions, String source)
    throws IOException {
  IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
  IndexShard indexShard = indexService.getShard(request.shardId().getId());
  SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().getId(),
      indexShard.shardId(), request.getClusterAlias(), OriginalIndices.NONE);
  Engine.Searcher engineSearcher = indexShard.acquireSearcher(source);
  final DefaultSearchContext searchContext = new DefaultSearchContext(idGenerator.incrementAndGet(), request, shardTarget,
    engineSearcher, clusterService, indexService, indexShard, bigArrays, threadPool.estimatedTimeInMillisCounter(), timeout,
    fetchPhase, request.getClusterAlias(), clusterService.state().nodes().getMinNodeVersion());
  boolean success = false;
  try {
    // we clone the query shard context here just for rewriting otherwise we
    // might end up with incorrect state since we are using now() or script services
    // during rewrite and normalized / evaluate templates etc.
    QueryShardContext context = new QueryShardContext(searchContext.getQueryShardContext());
    Rewriteable.rewrite(request.getRewriteable(), context, assertAsyncActions);
    assert searchContext.getQueryShardContext().isCachable();
    success = true;
  } finally {
    if (success == false) {
      IOUtils.closeWhileHandlingException(searchContext);
    }
  }
  return searchContext;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
public ClusterState execute(ClusterState currentState) {
  RestoreInProgress restoreInProgress = currentState.custom(RestoreInProgress.TYPE);
  if (currentState.getNodes().getMinNodeVersion().before(Version.V_6_6_0)) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/** ensures that the joining node has a version that's compatible with all current nodes*/
static void ensureNodesCompatibility(final Version joiningNodeVersion, DiscoveryNodes currentNodes) {
  final Version minNodeVersion = currentNodes.getMinNodeVersion();
  final Version maxNodeVersion = currentNodes.getMaxNodeVersion();
  ensureNodesCompatibility(joiningNodeVersion, minNodeVersion, maxNodeVersion);
}

代码示例来源:origin: apache/servicemix-bundles

/** ensures that the joining node has a version that's compatible with all current nodes*/
static void ensureNodesCompatibility(final Version joiningNodeVersion, DiscoveryNodes currentNodes) {
  final Version minNodeVersion = currentNodes.getMinNodeVersion();
  final Version maxNodeVersion = currentNodes.getMaxNodeVersion();
  ensureNodesCompatibility(joiningNodeVersion, minNodeVersion, maxNodeVersion);
}

代码示例来源:origin: com.floragunn/search-guard-6

private static boolean clusterHas5xNodes(ClusterState state) {
  return state.nodes().getMinNodeVersion().before(Version.V_6_0_0_alpha1);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

void handleJoinRequest(final DiscoveryNode node, final ClusterState state, final MembershipAction.JoinCallback callback) {
  if (nodeJoinController == null) {
    throw new IllegalStateException("discovery module is not yet started");
  } else {
    // we do this in a couple of places including the cluster update thread. This one here is really just best effort
    // to ensure we fail as fast as possible.
    onJoinValidators.stream().forEach(a -> a.accept(node, state));
    if (state.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false) {
      MembershipAction.ensureMajorVersionBarrier(node.getVersion(), state.getNodes().getMinNodeVersion());
    }
    // try and connect to the node, if it fails, we can raise an exception back to the client...
    transportService.connectToNode(node);
    // validate the join request, will throw a failure if it fails, which will get back to the
    // node calling the join request
    try {
      membership.sendValidateJoinRequestBlocking(node, state, joinTimeout);
    } catch (Exception e) {
      logger.warn(() -> new ParameterizedMessage("failed to validate incoming join request from node [{}]", node),
        e);
      callback.onFailure(new IllegalStateException("failure when sending a validation request to node", e));
      return;
    }
    nodeJoinController.handleJoinRequest(node, callback);
  }
}

代码示例来源:origin: apache/servicemix-bundles

void handleJoinRequest(final DiscoveryNode node, final ClusterState state, final MembershipAction.JoinCallback callback) {
  if (nodeJoinController == null) {
    throw new IllegalStateException("discovery module is not yet started");
  } else {
    // we do this in a couple of places including the cluster update thread. This one here is really just best effort
    // to ensure we fail as fast as possible.
    onJoinValidators.stream().forEach(a -> a.accept(node, state));
    if (state.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false) {
      MembershipAction.ensureMajorVersionBarrier(node.getVersion(), state.getNodes().getMinNodeVersion());
    }
    // try and connect to the node, if it fails, we can raise an exception back to the client...
    transportService.connectToNode(node);
    // validate the join request, will throw a failure if it fails, which will get back to the
    // node calling the join request
    try {
      membership.sendValidateJoinRequestBlocking(node, state, joinTimeout);
    } catch (Exception e) {
      logger.warn(() -> new ParameterizedMessage("failed to validate incoming join request from node [{}]", node),
        e);
      callback.onFailure(new IllegalStateException("failure when sending a validation request to node", e));
      return;
    }
    nodeJoinController.handleJoinRequest(node, callback);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

if (nodes.getMinNodeVersion().onOrAfter(Version.V_6_0_0_alpha1)) {

代码示例来源:origin: apache/servicemix-bundles

if (nodes.getMinNodeVersion().onOrAfter(Version.V_6_0_0_alpha1)) {

代码示例来源:origin: apache/servicemix-bundles

Version minClusterNodeVersion = newState.nodes().getMinNodeVersion();
Version maxClusterNodeVersion = newState.nodes().getMaxNodeVersion();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

Version minClusterNodeVersion = newState.nodes().getMinNodeVersion();
Version maxClusterNodeVersion = newState.nodes().getMaxNodeVersion();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private DefaultSearchContext createSearchContext(ShardSearchRequest request, TimeValue timeout,
                         boolean assertAsyncActions)
    throws IOException {
  IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
  IndexShard indexShard = indexService.getShard(request.shardId().getId());
  SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().getId(),
      indexShard.shardId(), request.getClusterAlias(), OriginalIndices.NONE);
  Engine.Searcher engineSearcher = indexShard.acquireSearcher("search");
  final DefaultSearchContext searchContext = new DefaultSearchContext(idGenerator.incrementAndGet(), request, shardTarget,
    engineSearcher, clusterService, indexService, indexShard, bigArrays, threadPool.estimatedTimeInMillisCounter(), timeout,
    fetchPhase, request.getClusterAlias(), clusterService.state().nodes().getMinNodeVersion());
  boolean success = false;
  try {
    // we clone the query shard context here just for rewriting otherwise we
    // might end up with incorrect state since we are using now() or script services
    // during rewrite and normalized / evaluate templates etc.
    QueryShardContext context = new QueryShardContext(searchContext.getQueryShardContext());
    Rewriteable.rewrite(request.getRewriteable(), context, assertAsyncActions);
    assert searchContext.getQueryShardContext().isCachable();
    success = true;
  } finally {
    if (success == false) {
      IOUtils.closeWhileHandlingException(searchContext);
    }
  }
  return searchContext;
}

代码示例来源:origin: apache/servicemix-bundles

fetchPhase, request.getClusterAlias(), clusterService.state().nodes().getMinNodeVersion());
boolean success = false;
try {

相关文章

微信公众号

最新文章

更多