From 4c579d6c8df7d3b8d5c2b28119cc6f74d34aa506 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Mon, 16 Jun 2014 00:51:42 +0200 Subject: [PATCH] Better default size for global index -> alias map The alias -> (index -> alias) map, specifically the index -> alias one, typically just hold one entry, yet we eagerly initialize it to the number of indices. When there are many indices, each with many aliases, this is a very large overhead per alias... closes #6504 --- src/main/java/org/elasticsearch/cluster/metadata/MetaData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java index b1c89b101e2..5d214f53743 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java @@ -191,7 +191,7 @@ public class MetaData implements Iterable { AliasMetaData aliasMd = aliasCursor.value; ImmutableOpenMap.Builder indexAliasMap = (ImmutableOpenMap.Builder) tmpAliases.get(aliasMd.alias()); if (indexAliasMap == null) { - indexAliasMap = ImmutableOpenMap.builder(indices.size()); + indexAliasMap = ImmutableOpenMap.builder(1); // typically, there is 1 alias pointing to an index tmpAliases.put(aliasMd.alias(), indexAliasMap); } indexAliasMap.put(index, aliasMd);