Skip to content

Commit

Permalink
Backported synced-flush PR to v5.6.8 and v6.2.2
Browse files Browse the repository at this point in the history
Relates #28464
  • Loading branch information
dnhatn committed Feb 14, 2018
1 parent b59b1cf commit 452bfc0
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,19 @@ int numDocs() {
return numDocs;
}

boolean includeNumDocs(Version version) {
if (version.major == Version.V_5_6_8.major) {
return version.onOrAfter(Version.V_5_6_8);
} else {
return version.onOrAfter(Version.V_6_2_2);
}
}

@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
commitId = new Engine.CommitId(in);
if (in.getVersion().onOrAfter(Version.V_6_3_0)) {
if (includeNumDocs(in.getVersion())) {
numDocs = in.readInt();
} else {
numDocs = UNKNOWN_NUM_DOCS;
Expand All @@ -544,7 +552,7 @@ public void readFrom(StreamInput in) throws IOException {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
commitId.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_6_3_0)) {
if (includeNumDocs(out.getVersion())) {
out.writeInt(numDocs);
}
}
Expand Down

0 comments on commit 452bfc0

Please sign in to comment.