|
31 | 31 | import org.elasticsearch.common.settings.Setting.Property;
|
32 | 32 | import org.elasticsearch.common.unit.ByteSizeUnit;
|
33 | 33 | import org.elasticsearch.common.unit.ByteSizeValue;
|
| 34 | +import org.elasticsearch.common.unit.MemorySizeValue; |
34 | 35 | import org.elasticsearch.common.unit.TimeValue;
|
35 | 36 | import org.elasticsearch.index.IndexSettings;
|
36 | 37 | import org.elasticsearch.index.codec.CodecService;
|
@@ -129,10 +130,19 @@ public EngineConfig(OpenMode openMode, ShardId shardId, ThreadPool threadPool,
|
129 | 130 | this.codecService = codecService;
|
130 | 131 | this.eventListener = eventListener;
|
131 | 132 | codecName = indexSettings.getValue(INDEX_CODEC_SETTING);
|
132 |
| - // We give IndexWriter a "huge" (256 MB) buffer, so it won't flush on its own unless the ES indexing buffer is also huge and/or |
133 |
| - // there are not too many shards allocated to this node. Instead, IndexingMemoryController periodically checks |
134 |
| - // and refreshes the most heap-consuming shards when total indexing heap usage across all shards is too high: |
135 |
| - indexingBufferSize = new ByteSizeValue(256, ByteSizeUnit.MB); |
| 133 | + // We add an escape hatch to allow users to configure larger indexing |
| 134 | + // buffers if necessary. The default 256MB proved to be too little for |
| 135 | + // users with lots of fields. |
| 136 | + final String escapeHatchProperty = "es.index.memory.max_index_buffer_size"; |
| 137 | + String maxBufferSize = System.getProperty(escapeHatchProperty); |
| 138 | + if (maxBufferSize != null) { |
| 139 | + indexingBufferSize = MemorySizeValue.parseBytesSizeValueOrHeapRatio(maxBufferSize, escapeHatchProperty); |
| 140 | + } else { |
| 141 | + // We give IndexWriter a "huge" (256 MB) buffer, so it won't flush on its own unless the ES indexing buffer is also huge and/or |
| 142 | + // there are not too many shards allocated to this node. Instead, IndexingMemoryController periodically checks |
| 143 | + // and refreshes the most heap-consuming shards when total indexing heap usage across all shards is too high: |
| 144 | + indexingBufferSize = new ByteSizeValue(256, ByteSizeUnit.MB); |
| 145 | + } |
136 | 146 | this.translogRecoveryPerformer = translogRecoveryPerformer;
|
137 | 147 | this.queryCache = queryCache;
|
138 | 148 | this.queryCachingPolicy = queryCachingPolicy;
|
|
0 commit comments