From 1e5138889ed0eff44dc6777eae7a34f4f2091bcb Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Sun, 18 May 2014 09:22:51 +0200 Subject: [PATCH] Translog: remove unneeded Versions.readVersion & Versions.writeVersion These calls were introduced in pr #6149 as a backward compatibility layer for the previous value of `Versions.MATCH_ANY`. This is not needed as the translog never contains these values. On top of that, the calls are not effective as the stream the translog used is effectively not versioned (versioining is done on an item by item basis) --- .../org/elasticsearch/index/translog/Translog.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/translog/Translog.java b/src/main/java/org/elasticsearch/index/translog/Translog.java index 5a86ec09bfd..3771558e281 100644 --- a/src/main/java/org/elasticsearch/index/translog/Translog.java +++ b/src/main/java/org/elasticsearch/index/translog/Translog.java @@ -351,7 +351,7 @@ public interface Translog extends IndexShardComponent, CloseableIndexComponent { } } if (version >= 3) { - this.version = Versions.readVersion(in); + this.version = in.readLong(); } if (version >= 4) { this.timestamp = in.readLong(); @@ -384,7 +384,7 @@ public interface Translog extends IndexShardComponent, CloseableIndexComponent { out.writeBoolean(true); out.writeString(parent); } - Versions.writeVersion(version, out); + out.writeLong(version); out.writeLong(timestamp); out.writeLong(ttl); out.writeByte(versionType.getValue()); @@ -494,7 +494,7 @@ public interface Translog extends IndexShardComponent, CloseableIndexComponent { } } if (version >= 3) { - this.version = Versions.readVersion(in); + this.version = in.readLong(); } if (version >= 4) { this.timestamp = in.readLong(); @@ -527,7 +527,7 @@ public interface Translog extends IndexShardComponent, CloseableIndexComponent { out.writeBoolean(true); out.writeString(parent); } - Versions.writeVersion(version, out); + out.writeLong(version); out.writeLong(timestamp); out.writeLong(ttl); out.writeByte(versionType.getValue()); @@ -586,7 +586,7 @@ public interface Translog extends IndexShardComponent, CloseableIndexComponent { int version = in.readVInt(); // version uid = new Term(in.readString(), in.readString()); if (version >= 1) { - this.version = Versions.readVersion(in); + this.version = in.readLong(); } if (version >= 2) { this.versionType = VersionType.fromValue(in.readByte()); @@ -600,7 +600,7 @@ public interface Translog extends IndexShardComponent, CloseableIndexComponent { out.writeVInt(SERIALIZATION_FORMAT); out.writeString(uid.field()); out.writeString(uid.text()); - Versions.writeVersion(version, out); + out.writeLong(version); out.writeByte(versionType.getValue()); } }