org.elasticsearch.cluster.ClusterState.stateUUID()方法的使用及代码示例

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

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

ClusterState.stateUUID介绍

[英]This stateUUID is automatically generated for for each version of cluster state. It is used to make sure that we are applying diffs to the right previous state.
[中]此stateUUID是为集群状态的每个版本自动生成的。它用于确保将差异应用到正确的前一个状态。

代码示例

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

public String stateUUID() {
  return state.stateUUID();
}

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

final ClusterStateContext failedContext = findState(state.stateUUID());
if (failedContext == null) {
  throw new IllegalArgumentException("can't resolve failed cluster state with uuid [" + state.stateUUID()
    + "], version [" + state.version() + "]");
assert findState(state.stateUUID()) == null : "state was marked as processed but can still be found in pending list " + state;

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

@Override
  public void handleException(TransportException exp) {
    logger.debug(() -> new ParameterizedMessage("failed to commit cluster state (uuid [{}], version [{}]) to {}",
        clusterState.stateUUID(), clusterState.version(), node), exp);
    sendingController.getPublishResponseHandler().onFailure(node, exp);
  }
});

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

if (findState(state.stateUUID()) == null) {
  throw new IllegalStateException("can't resolve processed cluster state with uuid [" + state.stateUUID()
    + "], version [" + state.version() + "]");
          pendingState.stateUUID(), pendingState.version(), pendingMasterNode, currentMaster);
      pendingContext.listener.onNewClusterStateFailed(
          new IllegalStateException("cluster state from a different master than the current one," +
      logger.trace("removing non-committed state with uuid[{}]/v[{}] from [{}] - a state from" +
          " [{}] was successfully processed",
          pendingState.stateUUID(), pendingState.version(), pendingMasterNode, currentMaster);
  } else if (pendingState.stateUUID().equals(state.stateUUID())) {
    assert pendingContext.committed() : "processed cluster state is not committed " + state;
    contextsToRemove.add(pendingContext);
  } else if (state.version() >= pendingState.version()) {
    logger.trace("processing pending state uuid[{}]/v[{}] together with state uuid[{}]/v[{}]",
        pendingState.stateUUID(), pendingState.version(), state.stateUUID(), state.version()
    );
    contextsToRemove.add(pendingContext);
assert findState(state.stateUUID()) == null : "state was marked as processed but can still be found in pending list " + state;

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

private void sendCommitToNode(final DiscoveryNode node, final ClusterState clusterState, final SendingController sendingController) {
  try {
    logger.trace("sending commit for cluster state (uuid: [{}], version [{}]) to [{}]",
      clusterState.stateUUID(), clusterState.version(), node);
    transportService.sendRequest(node, COMMIT_ACTION_NAME,
        new CommitClusterStateRequest(clusterState.stateUUID()),
        stateRequestOptions,
        new EmptyTransportResponseHandler(ThreadPool.Names.SAME) {
          @Override
          public void handleResponse(TransportResponse.Empty response) {
            if (sendingController.getPublishingTimedOut()) {
              logger.debug("node {} responded to cluster state commit [{}]", node, clusterState.version());
            }
            sendingController.getPublishResponseHandler().onResponse(node);
          }
          @Override
          public void handleException(TransportException exp) {
            logger.debug(() -> new ParameterizedMessage("failed to commit cluster state (uuid [{}], version [{}]) to {}",
                clusterState.stateUUID(), clusterState.version(), node), exp);
            sendingController.getPublishResponseHandler().onFailure(node, exp);
          }
        });
  } catch (Exception t) {
    logger.warn(() -> new ParameterizedMessage("error sending cluster state commit (uuid [{}], version [{}]) to {}",
        clusterState.stateUUID(), clusterState.version(), node), t);
    sendingController.getPublishResponseHandler().onFailure(node, t);
  }
}

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

/**
 * does simple sanity check of the incoming cluster state. Throws an exception on rejections.
 */
static void validateIncomingState(Logger logger, ClusterState incomingState, ClusterState lastState) {
  final ClusterName incomingClusterName = incomingState.getClusterName();
  if (!incomingClusterName.equals(lastState.getClusterName())) {
    logger.warn("received cluster state from [{}] which is also master but with a different cluster name [{}]",
      incomingState.nodes().getMasterNode(), incomingClusterName);
    throw new IllegalStateException("received state from a node that is not part of the cluster");
  }
  if (lastState.nodes().getLocalNode().equals(incomingState.nodes().getLocalNode()) == false) {
    logger.warn("received a cluster state from [{}] and not part of the cluster, should not happen",
      incomingState.nodes().getMasterNode());
    throw new IllegalStateException("received state with a local node that does not match the current local node");
  }
  if (shouldIgnoreOrRejectNewClusterState(logger, lastState, incomingState)) {
    String message = String.format(
      Locale.ROOT,
      "rejecting cluster state version [%d] uuid [%s] received from [%s]",
      incomingState.version(),
      incomingState.stateUUID(),
      incomingState.nodes().getMasterNodeId()
    );
    logger.warn(message);
    throw new IllegalStateException(message);
  }
}

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

public Builder(ClusterState state) {
  this.clusterName = state.clusterName;
  this.version = state.version();
  this.uuid = state.stateUUID();
  this.nodes = state.nodes();
  this.routingTable = state.routingTable();
  this.metaData = state.metaData();
  this.blocks = state.blocks();
  this.customs = ImmutableOpenMap.builder(state.customs());
  this.fromDiff = false;
}

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

logger.debug("processing [{}]: took [{}] done applying updated cluster state (version: {}, uuid: {})", task.source,
    executionTime, newClusterState.version(),
    newClusterState.stateUUID());
  warnAboutSlowTaskIfNeeded(executionTime, task.source);
} catch (Exception e) {
  TimeValue executionTime = TimeValue.timeValueMillis(Math.max(0, TimeValue.nsecToMSec(currentTimeInNanos() - startTimeNS)));
  final long version = newClusterState.version();
  final String stateUUID = newClusterState.stateUUID();
  final String fullState = newClusterState.toString();
  logger.warn(() -> new ParameterizedMessage(

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

logger.debug("processing [{}]: took [{}] done publishing updated cluster state (version: {}, uuid: {})", summary,
    executionTime, newClusterState.version(),
    newClusterState.stateUUID());
  warnAboutSlowTaskIfNeeded(executionTime, summary);
} catch (Exception e) {
  TimeValue executionTime = TimeValue.timeValueMillis(Math.max(0, TimeValue.nsecToMSec(currentTimeInNanos() - startTimeNS)));
  final long version = newClusterState.version();
  final String stateUUID = newClusterState.stateUUID();
  final String fullState = newClusterState.toString();
  logger.warn(() -> new ParameterizedMessage(

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

final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean processedOrFailed = new AtomicBoolean();
pendingStatesQueue.markAsCommitted(newState.stateUUID(),
  new PendingClusterStatesQueue.StateProcessedListener() {
    @Override

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

compatibleClusterStateDiffReceivedCount.incrementAndGet();
  logger.debug("received diff cluster state version [{}] with uuid [{}], diff size [{}]",
    incomingState.version(), incomingState.stateUUID(), request.bytes().length());
} else {
  logger.debug("received diff for but don't have any local cluster state - requesting full state");

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

"rejecting cluster state version [%d] uuid [%s] received from [%s]",
  newClusterState.version(),
  newClusterState.stateUUID(),
  newClusterState.nodes().getMasterNodeId()
);

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
  public void handleException(TransportException exp) {
    logger.debug((org.apache.logging.log4j.util.Supplier<?>) () ->
      new ParameterizedMessage("failed to commit cluster state (uuid [{}], version [{}]) to {}",
        clusterState.stateUUID(), clusterState.version(), node), exp);
    sendingController.getPublishResponseHandler().onFailure(node, exp);
  }
});

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

@Override
  public void handleException(TransportException exp) {
    logger.debug(() -> new ParameterizedMessage("failed to commit cluster state (uuid [{}], version [{}]) to {}",
        clusterState.stateUUID(), clusterState.version(), node), exp);
    sendingController.getPublishResponseHandler().onFailure(node, exp);
  }
});

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

@Override
  public void handleException(TransportException exp) {
    logger.debug(() -> new ParameterizedMessage("failed to commit cluster state (uuid [{}], version [{}]) to {}",
        clusterState.stateUUID(), clusterState.version(), node), exp);
    sendingController.getPublishResponseHandler().onFailure(node, exp);
  }
});

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

ClusterState.Builder builder = ClusterState.builder(currentState.getClusterName());
builder.version(currentState.version());
builder.stateUUID(currentState.stateUUID());
if (request.nodes()) {
  builder.nodes(currentState.nodes());

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

public Builder(ClusterState state) {
  this.clusterName = state.clusterName;
  this.version = state.version();
  this.uuid = state.stateUUID();
  this.nodes = state.nodes();
  this.routingTable = state.routingTable();
  this.metaData = state.metaData();
  this.blocks = state.blocks();
  this.customs = ImmutableOpenMap.builder(state.customs());
  this.fromDiff = false;
}

代码示例来源:origin: harbby/presto-connectors

public Builder(ClusterState state) {
  this.clusterName = state.clusterName;
  this.version = state.version();
  this.uuid = state.stateUUID();
  this.nodes = state.nodes();
  this.routingTable = state.routingTable();
  this.metaData = state.metaData();
  this.blocks = state.blocks();
  this.customs = ImmutableOpenMap.builder(state.customs());
  this.fromDiff = false;
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public Builder(ClusterState state) {
  this.clusterName = state.clusterName;
  this.version = state.version();
  this.uuid = state.stateUUID();
  this.nodes = state.nodes();
  this.routingTable = state.routingTable();
  this.metaData = state.metaData();
  this.blocks = state.blocks();
  this.customs = ImmutableOpenMap.builder(state.customs());
  this.fromDiff = false;
}

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

public Builder(ClusterState state) {
  this.clusterName = state.clusterName;
  this.version = state.version();
  this.uuid = state.stateUUID();
  this.nodes = state.nodes();
  this.routingTable = state.routingTable();
  this.metaData = state.metaData();
  this.blocks = state.blocks();
  this.customs = ImmutableOpenMap.builder(state.customs());
  this.fromDiff = false;
}

相关文章