Adjust init map size of user data of index commit (#40965)

The number of user data attributes of an index commit has increased 
from 6 to 8, but we forgot to adjust. This change increases the initial 
size of that map to avoid resizing.
This commit is contained in:
Nhat Nguyen 2019-04-08 15:42:48 -04:00
parent a9416708d0
commit 713e5c987b
1 changed files with 2 additions and 2 deletions

View File

@ -2360,7 +2360,7 @@ public class InternalEngine extends Engine {
* {@link IndexWriter#commit()} call flushes all documents, we defer computation of the maximum sequence number to the time * {@link IndexWriter#commit()} call flushes all documents, we defer computation of the maximum sequence number to the time
* of invocation of the commit data iterator (which occurs after all documents have been flushed to Lucene). * of invocation of the commit data iterator (which occurs after all documents have been flushed to Lucene).
*/ */
final Map<String, String> commitData = new HashMap<>(6); final Map<String, String> commitData = new HashMap<>(8);
commitData.put(Translog.TRANSLOG_GENERATION_KEY, translogFileGeneration); commitData.put(Translog.TRANSLOG_GENERATION_KEY, translogFileGeneration);
commitData.put(Translog.TRANSLOG_UUID_KEY, translogUUID); commitData.put(Translog.TRANSLOG_UUID_KEY, translogUUID);
commitData.put(SequenceNumbers.LOCAL_CHECKPOINT_KEY, localCheckpointValue); commitData.put(SequenceNumbers.LOCAL_CHECKPOINT_KEY, localCheckpointValue);
@ -2612,7 +2612,7 @@ public class InternalEngine extends Engine {
* Gets the commit data from {@link IndexWriter} as a map. * Gets the commit data from {@link IndexWriter} as a map.
*/ */
private static Map<String, String> commitDataAsMap(final IndexWriter indexWriter) { private static Map<String, String> commitDataAsMap(final IndexWriter indexWriter) {
Map<String, String> commitData = new HashMap<>(6); final Map<String, String> commitData = new HashMap<>(8);
for (Map.Entry<String, String> entry : indexWriter.getLiveCommitData()) { for (Map.Entry<String, String> entry : indexWriter.getLiveCommitData()) {
commitData.put(entry.getKey(), entry.getValue()); commitData.put(entry.getKey(), entry.getValue());
} }