public Set<String> inSyncAllocationIds(int shardId) { assert shardId >= 0 && shardId < numberOfShards; return inSyncAllocationIds.get(shardId); }
public IndexShardRoutingTable shard(int shardId) { return shards.get(shardId); }
ImmutableOpenIntMapDiff(ImmutableOpenIntMap<T> before, ImmutableOpenIntMap<T> after, KeySerializer<Integer> keySerializer, ValueSerializer<Integer, T> valueSerializer) { super(keySerializer, valueSerializer); assert after != null && before != null; for (IntCursor key : before.keys()) { if (!after.containsKey(key.value)) { deletes.add(key.value); } } for (IntObjectCursor<T> partIter : after) { T beforePart = before.get(partIter.key); if (beforePart == null) { upserts.put(partIter.key, partIter.value); } else if (partIter.value.equals(beforePart) == false) { if (valueSerializer.supportsDiffableValues()) { diffs.put(partIter.key, valueSerializer.diff(partIter.value, beforePart)); } else { upserts.put(partIter.key, partIter.value); } } } }
public Set<String> inSyncAllocationIds(int shardId) { assert shardId >= 0 && shardId < numberOfShards; return inSyncAllocationIds.get(shardId); }
public Set<String> inSyncAllocationIds(int shardId) { assert shardId >= 0 && shardId < numberOfShards; return inSyncAllocationIds.get(shardId); }
public IndexShardRoutingTable shard(int shardId) { return shards.get(shardId); }
public IndexShardRoutingTable shard(int shardId) { return shards.get(shardId); }
public IndexShardRoutingTable shard(int shardId) { return shards.get(shardId); }
public IndexShardRoutingTable shard(int shardId) { return shards.get(shardId); }
int currentNumberOfReplicas = indexRoutingTable.shards().get(0).size() - 1; // remove the required primary IndexRoutingTable.Builder builder = new IndexRoutingTable.Builder(indexRoutingTable.getIndex());
/** * Sometimes, the default mapping exists and an actual mapping is not created yet (introduced), * in this case, we want to return the default mapping in case it has some default mapping definitions. * <p> * Note, once the mapping type is introduced, the default mapping is applied on the actual typed MappingMetaData, * setting its routing, timestamp, and so on if needed. */ @Nullable public MappingMetaData mappingOrDefault(String mappingType) { MappingMetaData mapping = mappings.get(mappingType); if (mapping != null) { return mapping; } return mappings.get(MapperService.DEFAULT_MAPPING); }
private Map<Integer, List<ShardRouting>> getShardRoutings(ClusterStateResponse clusterStateResponse, Map.Entry<String, ClusterIndexHealth> index) { Map<Integer, List<ShardRouting>> shardRoutings = new HashMap<>(); for (Map.Entry<Integer, ClusterShardHealth> shard : index.getValue().getShards().entrySet()) { List<ShardRouting> shardRoutingList = clusterStateResponse.getState() .getRoutingTable() .index(index.getValue().getIndex()) .getShards() .get(shard.getKey()) .getShards(); shardRoutings.put(shard.getKey(), shardRoutingList); } return shardRoutings; } }
ImmutableOpenIntMapDiff(ImmutableOpenIntMap<T> before, ImmutableOpenIntMap<T> after, KeySerializer<Integer> keySerializer, ValueSerializer<Integer, T> valueSerializer) { super(keySerializer, valueSerializer); assert after != null && before != null; for (IntCursor key : before.keys()) { if (!after.containsKey(key.value)) { deletes.add(key.value); } } for (IntObjectCursor<T> partIter : after) { T beforePart = before.get(partIter.key); if (beforePart == null) { upserts.put(partIter.key, partIter.value); } else if (partIter.value.equals(beforePart) == false) { if (valueSerializer.supportsDiffableValues()) { diffs.put(partIter.key, valueSerializer.diff(partIter.value, beforePart)); } else { upserts.put(partIter.key, partIter.value); } } } }
ImmutableOpenIntMapDiff(ImmutableOpenIntMap<T> before, ImmutableOpenIntMap<T> after, KeySerializer<Integer> keySerializer, ValueSerializer<Integer, T> valueSerializer) { super(keySerializer, valueSerializer); assert after != null && before != null; for (IntCursor key : before.keys()) { if (!after.containsKey(key.value)) { deletes.add(key.value); } } for (IntObjectCursor<T> partIter : after) { T beforePart = before.get(partIter.key); if (beforePart == null) { upserts.put(partIter.key, partIter.value); } else if (partIter.value.equals(beforePart) == false) { if (valueSerializer.supportsDiffableValues()) { diffs.put(partIter.key, valueSerializer.diff(partIter.value, beforePart)); } else { upserts.put(partIter.key, partIter.value); } } } }
ImmutableOpenIntMapDiff(ImmutableOpenIntMap<T> before, ImmutableOpenIntMap<T> after, KeySerializer<Integer> keySerializer, ValueSerializer<Integer, T> valueSerializer) { super(keySerializer, valueSerializer); assert after != null && before != null; for (IntCursor key : before.keys()) { if (!after.containsKey(key.value)) { deletes.add(key.value); } } for (IntObjectCursor<T> partIter : after) { T beforePart = before.get(partIter.key); if (beforePart == null) { upserts.put(partIter.key, partIter.value); } else if (partIter.value.equals(beforePart) == false) { if (valueSerializer.supportsDiffableValues()) { diffs.put(partIter.key, valueSerializer.diff(partIter.value, beforePart)); } else { upserts.put(partIter.key, partIter.value); } } } }
public boolean isLocalShardsStarted() { for (IndexRoutingTable indexRoutingTable : this) { IndexShardRoutingTable indexShardRoutingTable = indexRoutingTable.shards().get(0); if (indexShardRoutingTable != null & indexShardRoutingTable.getPrimaryShardRouting() != null) { switch(indexShardRoutingTable.getPrimaryShardRouting().state()) { case UNASSIGNED: case INITIALIZING: case RELOCATING: return false; case STARTED : } } } return true; }
int currentNumberOfReplicas = indexRoutingTable.shards().get(0).size() - 1; // remove the required primary IndexRoutingTable.Builder builder = new IndexRoutingTable.Builder(index);
int currentNumberOfReplicas = indexRoutingTable.shards().get(0).size() - 1; // remove the required primary IndexRoutingTable.Builder builder = new IndexRoutingTable.Builder(indexRoutingTable.getIndex());