Skip to content

Commit 318df2a

Browse files
committed
Adjust BWC version on mapping version
The introduction of mapping version on index metadata has been backported to 6.x. This commit adjusts the BWC version around mapping version to account for this backport.
1 parent 5d9c270 commit 318df2a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ private static class IndexMetaDataDiff implements Diff<IndexMetaData> {
684684
index = in.readString();
685685
routingNumShards = in.readInt();
686686
version = in.readLong();
687-
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
687+
if (in.getVersion().onOrAfter(Version.V_6_5_0)) {
688688
mappingVersion = in.readVLong();
689689
} else {
690690
mappingVersion = 1;
@@ -724,7 +724,7 @@ public void writeTo(StreamOutput out) throws IOException {
724724
out.writeString(index);
725725
out.writeInt(routingNumShards);
726726
out.writeLong(version);
727-
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
727+
if (out.getVersion().onOrAfter(Version.V_6_5_0)) {
728728
out.writeVLong(mappingVersion);
729729
}
730730
out.writeByte(state.id);
@@ -760,7 +760,7 @@ public IndexMetaData apply(IndexMetaData part) {
760760
public static IndexMetaData readFrom(StreamInput in) throws IOException {
761761
Builder builder = new Builder(in.readString());
762762
builder.version(in.readLong());
763-
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
763+
if (in.getVersion().onOrAfter(Version.V_6_5_0)) {
764764
builder.mappingVersion(in.readVLong());
765765
} else {
766766
builder.mappingVersion(1);
@@ -804,7 +804,7 @@ public static IndexMetaData readFrom(StreamInput in) throws IOException {
804804
public void writeTo(StreamOutput out) throws IOException {
805805
out.writeString(index.getName()); // uuid will come as part of settings
806806
out.writeLong(version);
807-
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
807+
if (out.getVersion().onOrAfter(Version.V_6_5_0)) {
808808
out.writeVLong(mappingVersion);
809809
}
810810
out.writeInt(routingNumShards);
@@ -1370,8 +1370,8 @@ public static IndexMetaData fromXContent(XContentParser parser) throws IOExcepti
13701370
throw new IllegalArgumentException("Unexpected token " + token);
13711371
}
13721372
}
1373-
if (Assertions.ENABLED && Version.indexCreated(builder.settings).onOrAfter(Version.V_7_0_0_alpha1)) {
1374-
assert mappingVersion : "mapping version should be present for indices created on or after 7.0.0";
1373+
if (Assertions.ENABLED && Version.indexCreated(builder.settings).onOrAfter(Version.V_6_5_0)) {
1374+
assert mappingVersion : "mapping version should be present for indices created on or after 6.5.0";
13751375
}
13761376
return builder.build();
13771377
}

server/src/main/java/org/elasticsearch/index/mapper/MapperService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ private void assertMappingVersion(
249249
final Map<String, DocumentMapper> updatedEntries) {
250250
if (Assertions.ENABLED
251251
&& currentIndexMetaData != null
252-
&& currentIndexMetaData.getCreationVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
252+
&& currentIndexMetaData.getCreationVersion().onOrAfter(Version.V_6_5_0)) {
253253
if (currentIndexMetaData.getMappingVersion() == newIndexMetaData.getMappingVersion()) {
254254
// if the mapping version is unchanged, then there should not be any updates and all mappings should be the same
255255
assert updatedEntries.isEmpty() : updatedEntries;

0 commit comments

Comments
 (0)