Skip to content

Commit

Permalink
Translog: remove unneeded Versions.readVersion & Versions.writeVersion
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
bleskes committed May 18, 2014
1 parent 682acfc commit 1e51388
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/elasticsearch/index/translog/Translog.java
Expand Up @@ -351,7 +351,7 @@ public void readFrom(StreamInput in) throws IOException {
}
}
if (version >= 3) {
this.version = Versions.readVersion(in);
this.version = in.readLong();
}
if (version >= 4) {
this.timestamp = in.readLong();
Expand Down Expand Up @@ -384,7 +384,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(true);
out.writeString(parent);
}
Versions.writeVersion(version, out);
out.writeLong(version);
out.writeLong(timestamp);
out.writeLong(ttl);
out.writeByte(versionType.getValue());
Expand Down Expand Up @@ -494,7 +494,7 @@ public void readFrom(StreamInput in) throws IOException {
}
}
if (version >= 3) {
this.version = Versions.readVersion(in);
this.version = in.readLong();
}
if (version >= 4) {
this.timestamp = in.readLong();
Expand Down Expand Up @@ -527,7 +527,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(true);
out.writeString(parent);
}
Versions.writeVersion(version, out);
out.writeLong(version);
out.writeLong(timestamp);
out.writeLong(ttl);
out.writeByte(versionType.getValue());
Expand Down Expand Up @@ -586,7 +586,7 @@ public void readFrom(StreamInput in) throws IOException {
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());
Expand All @@ -600,7 +600,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(SERIALIZATION_FORMAT);
out.writeString(uid.field());
out.writeString(uid.text());
Versions.writeVersion(version, out);
out.writeLong(version);
out.writeByte(versionType.getValue());
}
}
Expand Down

0 comments on commit 1e51388

Please sign in to comment.