Bump BWC version for settings serialization to 6.1.0

This commit is contained in:
Simon Willnauer 2017-10-05 14:03:46 +02:00
parent b27e408ed2
commit 41925e1171
2 changed files with 6 additions and 6 deletions

View File

@ -545,7 +545,7 @@ public final class Settings implements ToXContentFragment {
public static Settings readSettingsFromStream(StreamInput in) throws IOException {
Builder builder = new Builder();
int numberOfSettings = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
for (int i = 0; i < numberOfSettings; i++) {
String key = in.readString();
Object value = in.readGenericValue();
@ -570,7 +570,7 @@ public final class Settings implements ToXContentFragment {
public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException {
// pull settings to exclude secure settings in size()
Set<Map.Entry<String, Object>> entries = settings.settings.entrySet();
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
out.writeVInt(entries.size());
for (Map.Entry<String, Object> entry : entries) {
out.writeString(entry.getKey());

View File

@ -648,7 +648,7 @@ public class SettingsTests extends ESTestCase {
public void testReadLegacyFromStream() throws IOException {
BytesStreamOutput output = new BytesStreamOutput();
output.setVersion(VersionUtils.getPreviousVersion(Version.CURRENT));
output.setVersion(VersionUtils.getPreviousVersion(Version.V_6_1_0));
output.writeVInt(5);
output.writeString("foo.bar.1");
output.writeOptionalString("1");
@ -661,7 +661,7 @@ public class SettingsTests extends ESTestCase {
output.writeString("foo.bar.baz");
output.writeOptionalString("baz");
StreamInput in = StreamInput.wrap(BytesReference.toBytes(output.bytes()));
in.setVersion(VersionUtils.getPreviousVersion(Version.CURRENT));
in.setVersion(VersionUtils.getPreviousVersion(Version.V_6_1_0));
Settings settings = Settings.readSettingsFromStream(in);
assertEquals(2, settings.size());
assertArrayEquals(new String[]{"0", "1", "2", "3"}, settings.getAsArray("foo.bar"));
@ -670,7 +670,7 @@ public class SettingsTests extends ESTestCase {
public void testWriteLegacyOutput() throws IOException {
BytesStreamOutput output = new BytesStreamOutput();
output.setVersion(VersionUtils.getPreviousVersion(Version.CURRENT));
output.setVersion(VersionUtils.getPreviousVersion(Version.V_6_1_0));
Settings settings = Settings.builder().putArray("foo.bar", "0", "1", "2", "3")
.put("foo.bar.baz", "baz").putNull("foo.null").build();
Settings.writeSettingsToStream(settings, output);
@ -700,7 +700,7 @@ public class SettingsTests extends ESTestCase {
public void testReadWriteArray() throws IOException {
BytesStreamOutput output = new BytesStreamOutput();
output.setVersion(Version.CURRENT);
output.setVersion(randomFrom(Version.CURRENT, Version.V_6_1_0));
Settings settings = Settings.builder().putArray("foo.bar", "0", "1", "2", "3").put("foo.bar.baz", "baz").build();
Settings.writeSettingsToStream(settings, output);
StreamInput in = StreamInput.wrap(BytesReference.toBytes(output.bytes()));