Skip to content

Commit 9523da9

Browse files
committed
WIP
1 parent 46e42ce commit 9523da9

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

server/src/main/java/org/elasticsearch/ingest/ESONXContentParser.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.nio.CharBuffer;
2424
import java.util.ArrayDeque;
2525
import java.util.Deque;
26+
import java.util.List;
2627

2728
/**
2829
* Simplified XContentParser for flattened ESON structures.
@@ -40,7 +41,7 @@ public class ESONXContentParser extends AbstractXContentParser {
4041
private final XContentType xContentType;
4142

4243
// Key array iteration state
43-
private final ESONSource.KeyEntry[] keyArray;
44+
private final List<ESONSource.KeyEntry> keyArray;
4445
private int currentIndex = 0;
4546

4647
// Current token state
@@ -85,7 +86,7 @@ public ESONXContentParser(
8586
this.xContentType = xContentType;
8687

8788
// Convert to array for efficient indexed access
88-
this.keyArray = root.getKeyArray().toArray(new ESONSource.KeyEntry[0]);
89+
this.keyArray = root.getKeyArray();
8990
}
9091

9192
@Override
@@ -108,20 +109,22 @@ public Token nextToken() throws IOException {
108109
currentValue = null;
109110
valueComputed = false;
110111

112+
int size = keyArray.size();
113+
111114
// First token - start root object
112115
if (currentToken == null) {
113-
if (currentIndex >= keyArray.length) {
116+
if (currentIndex >= size) {
114117
return null;
115118
}
116-
ESONSource.ObjectEntry rootEntry = (ESONSource.ObjectEntry) keyArray[currentIndex];
119+
ESONSource.ObjectEntry rootEntry = (ESONSource.ObjectEntry) keyArray.get(currentIndex);
117120
containerStack.push(new ContainerContext(ContainerContext.Type.OBJECT, rootEntry.fieldCount));
118121
currentIndex++;
119122
currentToken = Token.START_OBJECT;
120123
return currentToken;
121124
}
122125

123126
// Check if we've finished parsing
124-
if (containerStack.isEmpty() && currentIndex >= keyArray.length) {
127+
if (containerStack.isEmpty() && currentIndex >= size) {
125128
return null;
126129
}
127130

@@ -133,14 +136,14 @@ public Token nextToken() throws IOException {
133136
}
134137

135138
// If we've exhausted the array but still have containers, close them
136-
if (currentIndex >= keyArray.length) {
139+
if (currentIndex >= size) {
137140
ContainerContext ctx = containerStack.pop();
138141
currentToken = ctx.type == ContainerContext.Type.OBJECT ? Token.END_OBJECT : Token.END_ARRAY;
139142
return currentToken;
140143
}
141144

142145
// Process next entry
143-
ESONSource.KeyEntry entry = keyArray[currentIndex];
146+
ESONSource.KeyEntry entry = keyArray.get(currentIndex);
144147
ContainerContext currentContainer = containerStack.peek();
145148

146149
if (currentContainer == null) {

server/src/main/java/org/elasticsearch/ingest/IngestService.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,13 +1343,7 @@ static String getProcessorName(Processor processor) {
13431343
private static IngestDocument newIngestDocument(final IndexRequest request) {
13441344
BytesReference source = request.source();
13451345
ESONSource.Builder builder = new ESONSource.Builder((int) (source.length() * 0.70));
1346-
try (
1347-
XContentParser parser = XContentHelper.createParser(
1348-
XContentParserConfiguration.EMPTY,
1349-
source,
1350-
request.getContentType()
1351-
);
1352-
) {
1346+
try (XContentParser parser = XContentHelper.createParser(XContentParserConfiguration.EMPTY, source, request.getContentType());) {
13531347
ESONSource.ESONObject esonObject = builder.parse(parser);
13541348
return new IngestDocument(
13551349
request.index(),

server/src/main/java/org/elasticsearch/threadpool/DefaultBuiltInExecutorBuilders.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public Map<String, ExecutorBuilder> getBuilders(Settings settings, int allocated
5353
new FixedExecutorBuilder(
5454
settings,
5555
ThreadPool.Names.WRITE,
56-
(int) (allocatedProcessors * 1.25),
56+
allocatedProcessors,
5757
// 10,000 for all nodes with 8 cores or fewer. Scale up once we have more than 8 cores.
5858
Math.max(allocatedProcessors * 750, 10000),
5959
EsExecutors.TaskTrackingConfig.builder()

server/src/main/java/org/elasticsearch/threadpool/ExecutorBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected static int applyHardSizeLimit(final Settings settings, final String na
4343
if (name.equals("bulk")
4444
|| name.equals(ThreadPool.Names.WRITE_COORDINATION)
4545
|| name.equals(ThreadPool.Names.SYSTEM_WRITE_COORDINATION)
46-
// || name.equals(ThreadPool.Names.WRITE)
46+
|| name.equals(ThreadPool.Names.WRITE)
4747
|| name.equals(ThreadPool.Names.SYSTEM_WRITE)
4848
|| name.equals(ThreadPool.Names.SYSTEM_CRITICAL_WRITE)) {
4949
return 1 + EsExecutors.allocatedProcessors(settings);

0 commit comments

Comments
 (0)