private void ensureCanFlush() { // translog recover happens after the engine is fully constructed // if we are in this stage we have to prevent flushes from this // engine otherwise we might loose documents if the flush succeeds // and the translog recover fails we we "commit" the translog on flush. if (pendingTranslogRecovery.get()) { throw new IllegalStateException(shardId.toString() + " flushes are disabled - pending translog recovery"); } }
private static String buildMessage(ShardId shardId, String message) { StringBuilder sb = new StringBuilder(); sb.append(shardId.toString()); sb.append(": "); sb.append(message); return sb.toString(); } }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { return builder.value(toString()); } }
/** * Method that incorporates the ShardId for the shard into a string that * includes a 'p' or 'r' depending on whether the shard is a primary. */ static String shardIdentifierFromRouting(ShardRouting shardRouting) { return shardRouting.shardId().toString() + "[" + (shardRouting.primary() ? "p" : "r") + "]"; } }
assert version == VERSION_START || version == VERSION_STACK_TRACE; String msg = input.readString(); StringBuilder builder = new StringBuilder(shardId.toString()); builder.append(" Preexisting corrupted index ["); builder.append(file).append("] caused by: ");
/** * Applies the started shards. Note, only initializing ShardRouting instances that exist in the routing table should be * provided as parameter and no duplicates should be contained. * <p> * If the same instance of the {@link ClusterState} is returned, then no change has been made.</p> */ public ClusterState applyStartedShards(ClusterState clusterState, List<ShardRouting> startedShards) { if (startedShards.isEmpty()) { return clusterState; } RoutingNodes routingNodes = getMutableRoutingNodes(clusterState); // shuffle the unassigned nodes, just so we won't have things like poison failed shards routingNodes.unassigned().shuffle(); RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, routingNodes, clusterState, clusterInfoService.getClusterInfo(), currentNanoTime()); // as starting a primary relocation target can reinitialize replica shards, start replicas first startedShards = new ArrayList<>(startedShards); Collections.sort(startedShards, Comparator.comparing(ShardRouting::primary)); applyStartedShards(allocation, startedShards); gatewayAllocator.applyStartedShards(allocation, startedShards); reroute(allocation); String startedShardsAsString = firstListElementsToCommaDelimitedString(startedShards, s -> s.shardId().toString()); return buildResultAndLogHealthChange(clusterState, allocation, "shards started [" + startedShardsAsString + "] ..."); }
@Override public String toString() { if (shardId != null) { return shardId.toString(); } else { return index; } }
@Override public String toString() { if (shardId != null) { return shardId.toString(); } else { return index; } }
private void ensureCanFlush() { // translog recover happens after the engine is fully constructed // if we are in this stage we have to prevent flushes from this // engine otherwise we might loose documents if the flush succeeds // and the translog recover fails we we "commit" the translog on flush. if (pendingTranslogRecovery.get()) { throw new IllegalStateException(shardId.toString() + " flushes are disabled - pending translog recovery"); } }
private void ensureCanFlush() { // translog recover happens after the engine is fully constructed // if we are in this stage we have to prevent flushes from this // engine otherwise we might loose documents if the flush succeeds // and the translog recover fails we we "commit" the translog on flush. if (pendingTranslogRecovery.get()) { throw new IllegalStateException(shardId.toString() + " flushes are disabled - pending translog recovery"); } }
private void ensureCanFlush() { // translog recover happens after the engine is fully constructed // if we are in this stage we have to prevent flushes from this // engine otherwise we might loose documents if the flush succeeds // and the translog recover fails we we "commit" the translog on flush. if (pendingTranslogRecovery.get()) { throw new IllegalStateException(shardId.toString() + " flushes are disabled - pending translog recovery"); } }
private static String buildMessage(ShardId shardId, String message) { StringBuilder sb = new StringBuilder(); sb.append(shardId.toString()); sb.append(": "); sb.append(message); return sb.toString(); } }
private static String buildMessage(ShardId shardId, String message) { StringBuilder sb = new StringBuilder(); sb.append(shardId.toString()); sb.append(": "); sb.append(message); return sb.toString(); } }
private static String buildMessage(ShardId shardId, String message) { StringBuilder sb = new StringBuilder(); sb.append(shardId.toString()); sb.append(": "); sb.append(message); return sb.toString(); } }
String failedShardsAsString = firstListElementsToCommaDelimitedString(failedShards, s -> s.getRoutingEntry().shardId().toString()); return buildResultAndLogHealthChange(clusterState, allocation, "shards failed [" + failedShardsAsString + "] ...");
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { return builder.value(toString()); } }
@Override public String apply(FailedRerouteAllocation.FailedShard s) { return s.shard.shardId().toString(); } });
/** * Method that incorporates the ShardId for the shard into a string that * includes a 'p' or 'r' depending on whether the shard is a primary. */ static String shardIdentifierFromRouting(ShardRouting shardRouting) { return shardRouting.shardId().toString() + "[" + (shardRouting.primary() ? "p" : "r") + "]"; } }
/** * Method that incorporates the ShardId for the shard into a string that * includes a 'p' or 'r' depending on whether the shard is a primary. */ static String shardIdentifierFromRouting(ShardRouting shardRouting) { return shardRouting.shardId().toString() + "[" + (shardRouting.primary() ? "p" : "r") + "]"; } }
/** * Method that incorporates the ShardId for the shard into a string that * includes a 'p' or 'r' depending on whether the shard is a primary. */ static String shardIdentifierFromRouting(ShardRouting shardRouting) { return shardRouting.shardId().toString() + "[" + (shardRouting.primary() ? "p" : "r") + "]"; } }