public Builder add(IndexRoutingTable indexRoutingTable) { if (indicesRouting == null) { throw new IllegalStateException("once build is called the builder cannot be reused"); } indicesRouting.put(indexRoutingTable.getIndex().getName(), indexRoutingTable); return this; }
public Builder(RoutingTable routingTable) { version = routingTable.version; for (IndexRoutingTable indexRoutingTable : routingTable) { indicesRouting.put(indexRoutingTable.getIndex().getName(), indexRoutingTable); } }
public boolean hasIndex(Index index) { IndexRoutingTable indexRouting = index(index.getName()); return indexRouting != null && indexRouting.getIndex().equals(index); }
private IndexShardRoutingTable shardRoutingTable(IndexRoutingTable indexRouting, int shardId) { IndexShardRoutingTable indexShard = indexRouting.shard(shardId); if (indexShard == null) { throw new ShardNotFoundException(new ShardId(indexRouting.getIndex(), shardId)); } return indexShard; }
/** * All shards for the provided index and shard id * @return All the shard routing entries for the given index and shard id * @throws IndexNotFoundException if provided index does not exist * @throws ShardNotFoundException if provided shard id is unknown */ public IndexShardRoutingTable shardRoutingTable(String index, int shardId) { IndexRoutingTable indexRouting = index(index); if (indexRouting == null) { throw new IndexNotFoundException(index); } IndexShardRoutingTable shard = indexRouting.shard(shardId); if (shard == null) { throw new ShardNotFoundException(new ShardId(indexRouting.getIndex(), shardId)); } return shard; }
builder.startObject("indices"); for (IndexRoutingTable indexRoutingTable : routingTable()) { builder.startObject(indexRoutingTable.getIndex().getName()); builder.startObject("shards"); for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) {
/** * Validate the name for an index against some static rules and a cluster state. */ public static void validateIndexName(String index, ClusterState state) { validateIndexOrAliasName(index, InvalidIndexNameException::new); if (!index.toLowerCase(Locale.ROOT).equals(index)) { throw new InvalidIndexNameException(index, "must be lowercase"); } if (state.routingTable().hasIndex(index)) { throw new ResourceAlreadyExistsException(state.routingTable().index(index).getIndex()); } if (state.metaData().hasIndex(index)) { throw new ResourceAlreadyExistsException(state.metaData().index(index).getIndex()); } if (state.metaData().hasAlias(index)) { throw new InvalidIndexNameException(index, "already exists as alias"); } }
/** * All shards for the provided {@link ShardId} * @return All the shard routing entries for the given index and shard id * @throws IndexNotFoundException if provided index does not exist * @throws ShardNotFoundException if provided shard id is unknown */ public IndexShardRoutingTable shardRoutingTable(ShardId shardId) { IndexRoutingTable indexRouting = index(shardId.getIndexName()); if (indexRouting == null || indexRouting.getIndex().equals(shardId.getIndex()) == false) { throw new IndexNotFoundException(shardId.getIndex()); } IndexShardRoutingTable shard = indexRouting.shard(shardId.id()); if (shard == null) { throw new ShardNotFoundException(shardId); } return shard; }
IndexRoutingTable.Builder builder = new IndexRoutingTable.Builder(indexRoutingTable.getIndex());
ShardId shardId = indexShardRoutingTable.shardId(); if (folderNotFoundCache.contains(shardId) == false && shardCanBeDeleted(localNodeId, indexShardRoutingTable)) { IndexService indexService = indicesService.indexService(indexRoutingTable.getIndex()); final IndexSettings indexSettings; if (indexService == null) { IndexMetaData indexMetaData = event.state().getMetaData().getIndexSafe(indexRoutingTable.getIndex()); indexSettings = new IndexSettings(indexMetaData, settings); } else {
public Builder add(IndexRoutingTable indexRoutingTable) { if (indicesRouting == null) { throw new IllegalStateException("once build is called the builder cannot be reused"); } indicesRouting.put(indexRoutingTable.getIndex().getName(), indexRoutingTable); return this; }
public Builder(RoutingTable routingTable) { version = routingTable.version; for (IndexRoutingTable indexRoutingTable : routingTable) { indicesRouting.put(indexRoutingTable.getIndex().getName(), indexRoutingTable); } }
public Builder(RoutingTable routingTable) { version = routingTable.version; for (IndexRoutingTable indexRoutingTable : routingTable) { indicesRouting.put(indexRoutingTable.getIndex().getName(), indexRoutingTable); } }
public Builder(RoutingTable routingTable) { version = routingTable.version; for (IndexRoutingTable indexRoutingTable : routingTable) { indicesRouting.put(indexRoutingTable.getIndex().getName(), indexRoutingTable); } }
public Builder add(IndexRoutingTable indexRoutingTable) { if (indicesRouting == null) { throw new IllegalStateException("once build is called the builder cannot be reused"); } if (indexRoutingTable.shards().size() > 0) indicesRouting.put(indexRoutingTable.getIndex().getName(), indexRoutingTable); return this; }
public boolean hasIndex(Index index) { IndexRoutingTable indexRouting = index(index.getName()); return indexRouting != null && indexRouting.getIndex().equals(index); }
public boolean hasIndex(Index index) { IndexRoutingTable indexRouting = index(index.getName()); return indexRouting != null && indexRouting.getIndex().equals(index); }
private IndexShardRoutingTable shardRoutingTable(IndexRoutingTable indexRouting, int shardId) { IndexShardRoutingTable indexShard = indexRouting.shard(shardId); if (indexShard == null) { throw new ShardNotFoundException(new ShardId(indexRouting.getIndex(), shardId)); } return indexShard; }
private IndexShardRoutingTable shardRoutingTable(IndexRoutingTable indexRouting, int shardId) { IndexShardRoutingTable indexShard = indexRouting.shard(shardId); if (indexShard == null) { throw new ShardNotFoundException(new ShardId(indexRouting.getIndex(), shardId)); } return indexShard; }
private IndexShardRoutingTable shardRoutingTable(IndexRoutingTable indexRouting, int shardId) { IndexShardRoutingTable indexShard = indexRouting.shard(shardId); if (indexShard == null) { throw new ShardNotFoundException(new ShardId(indexRouting.getIndex(), shardId)); } return indexShard; }