Tabnine Logo
ClusterBlocks.builder
Code IndexAdd Tabnine to your IDE (free)

How to use
builder
method
in
org.elasticsearch.cluster.block.ClusterBlocks

Best Java code snippets using org.elasticsearch.cluster.block.ClusterBlocks.builder (Showing top 20 results out of 315)

origin: org.elasticsearch/elasticsearch

@Override
protected void doStart() {
  DiscoveryNode localNode = transportService.getLocalNode();
  assert localNode != null;
  synchronized (stateMutex) {
    // set initial state
    assert committedState.get() == null;
    assert localNode != null;
    ClusterState.Builder builder = clusterApplier.newClusterStateBuilder();
    ClusterState initialState = builder
      .blocks(ClusterBlocks.builder()
        .addGlobalBlock(STATE_NOT_RECOVERED_BLOCK)
        .addGlobalBlock(discoverySettings.getNoMasterBlock()))
      .nodes(DiscoveryNodes.builder().add(localNode).localNodeId(localNode.getId()))
      .build();
    committedState.set(initialState);
    clusterApplier.setInitialState(initialState);
    nodesFD.setLocalNode(localNode);
    joinThreadControl.start();
  }
  zenPing.start();
}
origin: org.elasticsearch/elasticsearch

protected void rejoin(String reason) {
  assert Thread.holdsLock(stateMutex);
  ClusterState clusterState = committedState.get();
  logger.warn("{}, current nodes: {}", reason, clusterState.nodes());
  nodesFD.stop();
  masterFD.stop(reason);
  // TODO: do we want to force a new thread if we actively removed the master? this is to give a full pinging cycle
  // before a decision is made.
  joinThreadControl.startNewThreadIfNotRunning();
  if (clusterState.nodes().getMasterNodeId() != null) {
    // remove block if it already exists before adding new one
    assert clusterState.blocks().hasGlobalBlock(discoverySettings.getNoMasterBlock().id()) == false :
      "NO_MASTER_BLOCK should only be added by ZenDiscovery";
    ClusterBlocks clusterBlocks = ClusterBlocks.builder().blocks(clusterState.blocks())
      .addGlobalBlock(discoverySettings.getNoMasterBlock())
      .build();
    DiscoveryNodes discoveryNodes = new DiscoveryNodes.Builder(clusterState.nodes()).masterNodeId(null).build();
    clusterState = ClusterState.builder(clusterState)
      .blocks(clusterBlocks)
      .nodes(discoveryNodes)
      .build();
    committedState.set(clusterState);
    clusterApplier.onNewClusterState(reason, this::clusterState, (source, e) -> {}); // don't wait for state to be applied
  }
}
origin: org.elasticsearch/elasticsearch

protected ClusterState createInitialState(DiscoveryNode localNode) {
  ClusterState.Builder builder = clusterApplier.newClusterStateBuilder();
  return builder.nodes(DiscoveryNodes.builder().add(localNode)
      .localNodeId(localNode.getId())
      .masterNodeId(localNode.getId())
      .build())
    .blocks(ClusterBlocks.builder()
      .addGlobalBlock(STATE_NOT_RECOVERED_BLOCK))
    .build();
}
origin: org.elasticsearch/elasticsearch

RoutingTable.Builder routingTableBuilder = RoutingTable.builder(currentState.routingTable());
MetaData.Builder metaDataBuilder = MetaData.builder(meta);
ClusterBlocks.Builder clusterBlocksBuilder = ClusterBlocks.builder().blocks(currentState.blocks());
origin: org.elasticsearch/elasticsearch

ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
RoutingTable.Builder routingTableBuilder = RoutingTable.builder(currentState.routingTable());
final Version minIndexCompatibilityVersion = currentState.getNodes().getMaxNodeVersion()
origin: org.elasticsearch/elasticsearch

ClusterBlocks.Builder blocksBuilder = ClusterBlocks.builder()
  .blocks(currentState.blocks());
for (IndexMetaData openIndexMetadata : indicesToClose) {
origin: org.elasticsearch/elasticsearch

ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
maybeUpdateClusterBlock(actualIndices, blocks, IndexMetaData.INDEX_READ_ONLY_BLOCK,
  IndexMetaData.INDEX_READ_ONLY_SETTING, openSettings);
origin: org.elasticsearch/elasticsearch

private ClusterState.Builder becomeMasterAndTrimConflictingNodes(ClusterState currentState, List<DiscoveryNode> joiningNodes) {
  assert currentState.nodes().getMasterNodeId() == null : currentState;
  DiscoveryNodes currentNodes = currentState.nodes();
  DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder(currentNodes);
  nodesBuilder.masterNodeId(currentState.nodes().getLocalNodeId());
  for (final DiscoveryNode joiningNode : joiningNodes) {
    final DiscoveryNode nodeWithSameId = nodesBuilder.get(joiningNode.getId());
    if (nodeWithSameId != null && nodeWithSameId.equals(joiningNode) == false) {
      logger.debug("removing existing node [{}], which conflicts with incoming join from [{}]", nodeWithSameId, joiningNode);
      nodesBuilder.remove(nodeWithSameId.getId());
    }
    final DiscoveryNode nodeWithSameAddress = currentNodes.findByAddress(joiningNode.getAddress());
    if (nodeWithSameAddress != null && nodeWithSameAddress.equals(joiningNode) == false) {
      logger.debug("removing existing node [{}], which conflicts with incoming join from [{}]", nodeWithSameAddress,
        joiningNode);
      nodesBuilder.remove(nodeWithSameAddress.getId());
    }
  }
  // now trim any left over dead nodes - either left there when the previous master stepped down
  // or removed by us above
  ClusterState tmpState = ClusterState.builder(currentState).nodes(nodesBuilder).blocks(ClusterBlocks.builder()
    .blocks(currentState.blocks())
    .removeGlobalBlock(DiscoverySettings.NO_MASTER_BLOCK_ID)).build();
  return ClusterState.builder(allocationService.deassociateDeadNodes(tmpState, false,
    "removed dead nodes on election"));
}
origin: org.elasticsearch/elasticsearch

  indexMetaData.getNumberOfReplicas(), mappings.keySet());
ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
if (!request.blocks().isEmpty()) {
  for (ClusterBlock block : request.blocks()) {
origin: org.elasticsearch/elasticsearch

    .persistentSettings(Settings.builder().put(persistentFinalSettings).put(unknownOrInvalidPersistentSettings).build());
ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
boolean updatedReadOnly = MetaData.SETTING_READ_ONLY_SETTING.get(metaData.persistentSettings())
    || MetaData.SETTING_READ_ONLY_SETTING.get(metaData.transientSettings());
origin: org.elasticsearch/elasticsearch

ClusterBlocks.Builder blocksBuilder = ClusterBlocks.builder()
    .blocks(currentState.blocks());
final Version minIndexCompatibilityVersion = currentState.getNodes().getMaxNodeVersion()
origin: org.elasticsearch/elasticsearch

ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
RoutingTable.Builder rtBuilder = RoutingTable.builder(currentState.routingTable());
ImmutableOpenMap<ShardId, RestoreInProgress.ShardRestoreStatus> shards;
origin: com.strapdata.elasticsearch/elasticsearch

@Override
public ClusterState execute(ClusterState currentState) {
  logger.debug("releasing the cassandra ring block...");
  
  // remove the block, since we recovered from gateway
  ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks()).removeGlobalBlock(NO_CASSANDRA_RING_BLOCK);
  
  // update the state to reflect 
  ClusterState updatedState = ClusterState.builder(currentState).blocks(blocks).incrementVersion().build();
  return updatedState;
}
origin: org.elasticsearch/elasticsearch

ClusterBlocks.Builder blocks = ClusterBlocks.builder()
    .blocks(currentState.blocks())
    .blocks(recoveredState.blocks())
origin: com.strapdata.elasticsearch/elasticsearch

public BaseClusterService(Settings settings,
           ClusterSettings clusterSettings, ThreadPool threadPool, Supplier<DiscoveryNode> localNodeSupplier) {
  super(settings);
  this.localNodeSupplier = localNodeSupplier;
  this.operationRouting = new OperationRouting(settings, clusterSettings);
  this.threadPool = threadPool;
  this.clusterSettings = clusterSettings;
  this.clusterName = ClusterName.CLUSTER_NAME_SETTING.get(settings);
  // will be replaced on doStart.
  this.state = new AtomicReference<>(ClusterState.builder(clusterName).build());
  this.clusterSettings.addSettingsUpdateConsumer(CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING,
      this::setSlowTaskLoggingThreshold);
  this.slowTaskLoggingThreshold = CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings);
  localNodeMasterListeners = new LocalNodeMasterListeners(threadPool);
  //initialBlocks = ClusterBlocks.builder();
  // Add NO_CASSANDRA_RING_BLOCK to avoid to save metadata while cassandra ring not ready.
  initialBlocks = ClusterBlocks.builder().addGlobalBlock(CassandraGatewayService.NO_CASSANDRA_RING_BLOCK);
}
origin: apache/servicemix-bundles

protected ClusterState createInitialState(DiscoveryNode localNode) {
  ClusterState.Builder builder = clusterApplier.newClusterStateBuilder();
  return builder.nodes(DiscoveryNodes.builder().add(localNode)
      .localNodeId(localNode.getId())
      .masterNodeId(localNode.getId())
      .build())
    .blocks(ClusterBlocks.builder()
      .addGlobalBlock(STATE_NOT_RECOVERED_BLOCK))
    .build();
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

protected ClusterState createInitialState(DiscoveryNode localNode) {
  ClusterState.Builder builder = clusterApplier.newClusterStateBuilder();
  return builder.nodes(DiscoveryNodes.builder().add(localNode)
      .localNodeId(localNode.getId())
      .masterNodeId(localNode.getId())
      .build())
    .blocks(ClusterBlocks.builder()
      .addGlobalBlock(STATE_NOT_RECOVERED_BLOCK))
    .build();
}
origin: harbby/presto-connectors

@Override
public ClusterState execute(ClusterState currentState) {
  DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder();
  for (LocalDiscovery discovery : clusterGroups.get(clusterName).members()) {
    nodesBuilder.put(discovery.localNode());
  }
  nodesBuilder.localNodeId(master.localNode().id()).masterNodeId(master.localNode().id());
  // remove the NO_MASTER block in this case
  ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks()).removeGlobalBlock(discoverySettings.getNoMasterBlock());
  return ClusterState.builder(currentState).nodes(nodesBuilder).blocks(blocks).build();
}
origin: org.codelibs.elasticsearch.module/tribe

@Override
protected ClusterState createInitialState(DiscoveryNode localNode) {
  ClusterBlocks.Builder clusterBlocks = ClusterBlocks.builder(); // don't add no_master / state recovery block
  if (BLOCKS_WRITE_SETTING.get(settings)) {
    clusterBlocks.addGlobalBlock(TRIBE_WRITE_BLOCK);
  }
  if (BLOCKS_METADATA_SETTING.get(settings)) {
    clusterBlocks.addGlobalBlock(TRIBE_METADATA_BLOCK);
  }
  return ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.get(settings))
    .nodes(DiscoveryNodes.builder().add(localNode).localNodeId(localNode.getId()).build())
    .blocks(clusterBlocks).build();
}
origin: com.strapdata.elasticsearch/elasticsearch

@Override
public ClusterState execute(ClusterState currentState) {
  // read metadata from the clusterService thread to avoid freeze in gossip.
  MetaData schemaMetaData = clusterService.checkForNewMetaData(version);
  
  ClusterState.Builder newStateBuilder = ClusterState.builder(currentState).nodes(nodes());
  // update blocks
  ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
  if (schemaMetaData.settings().getAsBoolean("cluster.blocks.read_only", false))
    blocks.addGlobalBlock(MetaData.CLUSTER_READ_ONLY_BLOCK);
  
  if (schemaMetaData != null) {
    newStateBuilder.metaData(schemaMetaData);
    
    // update indices block.
    for (IndexMetaData indexMetaData : schemaMetaData)
      blocks.updateBlocks(indexMetaData);
  }
  return clusterService.updateNumberOfShardsAndReplicas( newStateBuilder.blocks(blocks).build() );
}

org.elasticsearch.cluster.blockClusterBlocksbuilder

Popular methods of ClusterBlocks

  • globalBlockedException
  • indicesBlockedException
  • globalBlockedRaiseException
  • indexBlockedException
  • <init>
  • diff
  • disableStatePersistence
    Returns true if one of the global blocks as its disable state persistence flag set.
  • global
  • globalBlocked
  • hasGlobalBlock
    Is there a global block with the provided status?
  • indexBlocked
  • indexBlockedRaiseException
  • indexBlocked,
  • indexBlockedRaiseException,
  • indices,
  • readBlockSet,
  • readDiffFrom,
  • writeBlockSet,
  • writeTo,
  • blocksForIndex,
  • generateLevelHolders

Popular in Java

  • Reading from database using SQL prepared statement
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • addToBackStack (FragmentTransaction)
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now