Store Template's mappings as bytes for disk serialization (#78746) (#79522)

This change the way we store mappings in `Template` during serialization
to disk - instead storing it as map we use byte array that we already
have. This avoids deserialization-serialization cycle during storing
cluster state on disk.
# Conflicts:
#	server/src/main/java/org/elasticsearch/cluster/coordination/ElasticsearchNodeCommand.java
This commit is contained in:
Przemko Robakowski 2021-10-20 01:14:54 +02:00 committed by GitHub
parent c993176e5f
commit 8fe8e6f039
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 19 deletions

View file

@ -13,6 +13,7 @@ import org.elasticsearch.cluster.metadata.ComponentTemplate;
import org.elasticsearch.cluster.metadata.Template;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xcontent.ToXContent;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase;
@ -79,7 +80,7 @@ public class GetComponentTemplatesResponseTests extends ESTestCase {
builder.startObject();
builder.field("name", e.getKey());
builder.field("component_template");
e.getValue().toXContent(builder, null);
e.getValue().toXContent(builder, ToXContent.EMPTY_PARAMS);
builder.endObject();
}
builder.endArray();

View file

@ -10,6 +10,7 @@ package org.elasticsearch.client.indices;
import org.elasticsearch.cluster.metadata.ComposableIndexTemplate;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.ToXContent;
import org.elasticsearch.test.ESTestCase;
import java.io.IOException;
@ -53,7 +54,7 @@ public class GetComposableIndexTemplatesResponseTests extends ESTestCase {
builder.startObject();
builder.field("name", e.getKey());
builder.field("index_template");
e.getValue().toXContent(builder, null);
e.getValue().toXContent(builder, ToXContent.EMPTY_PARAMS);
builder.endObject();
}
builder.endArray();