Java Code Examples for org.elasticsearch.cluster.node.DiscoveryNode#getName()
The following examples show how to use
org.elasticsearch.cluster.node.DiscoveryNode#getName() .
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: NodeDisconnectJobMonitorService.java From crate with Apache License 2.0 | 6 votes |
/** * Broadcast the kill if *this* node is the coordinator and a participating node died * The information which nodes are participating is only available on the coordinator, so other nodes * can not kill the jobs on their own. * * <pre> * n1 n2 n3 * | | | * startJob 1 (n1,n2,n3) | | * | | | * | *dies* | * | | * onNodeDisc(n2) onNodeDisc(n2) * broadcast kill job1 does not know which jobs involve n2 * | * kill job1 <-+----------------------------------> kill job1 * * </pre> */ private void broadcastKillToParticipatingNodes(DiscoveryNode deadNode) { List<UUID> affectedJobs = tasksService .getJobIdsByParticipatingNodes(deadNode.getId()).collect(Collectors.toList()); if (affectedJobs.isEmpty()) { return; } if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Broadcasting kill for {} jobs because they involved disconnected node={}", affectedJobs.size(), deadNode.getId()); } List<String> excludedNodeIds = Collections.singletonList(deadNode.getId()); KillJobsRequest killRequest = new KillJobsRequest(affectedJobs, "Participating node=" + deadNode.getName() + " disconnected."); killJobsNodeAction.broadcast(killRequest, new ActionListener<>() { @Override public void onResponse(Long numKilled) { } @Override public void onFailure(Exception e) { LOGGER.warn("failed to send kill request to nodes"); } }, excludedNodeIds); }
Example 2
Source File: NodeStatsCollectSource.java From crate with Apache License 2.0 | 5 votes |
static Collection<DiscoveryNode> filterNodes(Collection<DiscoveryNode> nodes, Symbol predicate, Functions functions) { var expressions = SysNodesTableInfo.create().expressions(); var nameExpr = expressions.get(SysNodesTableInfo.Columns.NAME).create(); var idExpr = expressions.get(SysNodesTableInfo.Columns.ID).create(); MapBackedRefResolver referenceResolver = new MapBackedRefResolver(Map.of( SysNodesTableInfo.Columns.NAME, nameExpr, SysNodesTableInfo.Columns.ID, idExpr) ); EvaluatingNormalizer normalizer = new EvaluatingNormalizer( functions, RowGranularity.DOC, referenceResolver, null ); List<DiscoveryNode> newNodes = new ArrayList<>(); for (DiscoveryNode node : nodes) { String nodeId = node.getId(); NodeStatsContext statsContext = new NodeStatsContext(nodeId, node.getName()); nameExpr.setNextRow(statsContext); idExpr.setNextRow(statsContext); Symbol normalized = normalizer.normalize(predicate, CoordinatorTxnCtx.systemTransactionContext()); if (normalized.equals(predicate)) { return nodes; // No local available sys nodes columns in where clause } if (WhereClause.canMatch(normalized)) { newNodes.add(node); } } return newNodes; }
Example 3
Source File: InternalTestCluster.java From crate with Apache License 2.0 | 5 votes |
/** * Returns the name of the current master node in the cluster and executes the request via the node specified * in the viaNode parameter. If viaNode isn't specified a random node will be picked to the send the request to. */ public String getMasterName(@Nullable String viaNode) { try { Client client = viaNode != null ? client(viaNode) : client(); final DiscoveryNode masterNode = client.admin().cluster().prepareState().get().getState().nodes().getMasterNode(); assertNotNull(masterNode); return masterNode.getName(); } catch (Exception e) { logger.warn("Can't fetch cluster state", e); throw new RuntimeException("Can't get master node " + e.getMessage(), e); } }
Example 4
Source File: SendRequestTransportException.java From crate with Apache License 2.0 | 4 votes |
public SendRequestTransportException(DiscoveryNode node, String action, Throwable cause) { super(node == null ? null : node.getName(), node == null ? null : node.getAddress(), action, cause); }
Example 5
Source File: ConnectTransportException.java From crate with Apache License 2.0 | 4 votes |
public ConnectTransportException(DiscoveryNode node, String msg, String action, Throwable cause) { super(node == null ? null : node.getName(), node == null ? null : node.getAddress(), action, msg, cause); this.node = node; }
Example 6
Source File: ReceiveTimeoutTransportException.java From crate with Apache License 2.0 | 4 votes |
public ReceiveTimeoutTransportException(DiscoveryNode node, String action, String msg) { super(node.getName(), node.getAddress(), action, msg, null); }
Example 7
Source File: CoordinationMetaData.java From crate with Apache License 2.0 | 4 votes |
public VotingConfigExclusion(DiscoveryNode node) { this(node.getId(), node.getName()); }