Skip to content

Commit

Permalink
fix case
Browse files Browse the repository at this point in the history
  • Loading branch information
wjp719 committed Aug 25, 2021
1 parent edde35d commit 4dc6a9f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.elasticsearch.cluster.metadata;

import org.elasticsearch.Version;
import org.elasticsearch.cluster.AbstractDiffable;
import org.elasticsearch.cluster.Diff;
import org.elasticsearch.core.Nullable;
Expand Down Expand Up @@ -284,7 +285,11 @@ public DataStreamTemplate(boolean hidden, boolean allowCustomRouting) {

DataStreamTemplate(StreamInput in) throws IOException {
hidden = in.readBoolean();
allowCustomRouting = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
allowCustomRouting = in.readBoolean();
} else {
allowCustomRouting = false;
}
}

public String getTimestampField() {
Expand All @@ -310,7 +315,9 @@ public boolean isAllowCustomRouting() {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(hidden);
out.writeBoolean(allowCustomRouting);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
out.writeBoolean(allowCustomRouting);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package org.elasticsearch.cluster.metadata;

import org.elasticsearch.Version;
import org.elasticsearch.cluster.AbstractDiffable;
import org.elasticsearch.cluster.Diff;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -280,8 +281,17 @@ public static String getDefaultBackingIndexName(String dataStreamName, long gene
}

public DataStream(StreamInput in) throws IOException {
this(in.readString(), new TimestampField(in), in.readList(Index::new), in.readVLong(),
in.readMap(), in.readBoolean(), in.readBoolean(), in.readBoolean(), in.readBoolean());
this(
in.readString(),
new TimestampField(in),
in.readList(Index::new),
in.readVLong(),
in.readMap(),
in.readBoolean(),
in.readBoolean(),
in.readBoolean(),
in.getVersion().onOrAfter(Version.V_8_0_0) ? in.readBoolean() : false
);
}

public static Diff<DataStream> readDiffFrom(StreamInput in) throws IOException {
Expand All @@ -298,7 +308,9 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(hidden);
out.writeBoolean(replicated);
out.writeBoolean(system);
out.writeBoolean(allowCustomRouting);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
out.writeBoolean(allowCustomRouting);
}
}

public static final ParseField NAME_FIELD = new ParseField("name");
Expand Down

0 comments on commit 4dc6a9f

Please sign in to comment.