From fee2d06528ef16952a40cd9248b71ee70c55020a Mon Sep 17 00:00:00 2001 From: David Turner Date: Thu, 27 Aug 2020 08:11:09 +0100 Subject: [PATCH] Complete backport of #60522 (#61615) Adjusts versions for wire format and re-enables BWC tests --- build.gradle | 4 +-- .../SearchableSnapshotShardStats.java | 26 +++++-------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index e7cd42545aed8..44f3d4559ec0a 100644 --- a/build.gradle +++ b/build.gradle @@ -174,8 +174,8 @@ tasks.register("verifyVersions") { * after the backport of the backcompat code is complete. */ -boolean bwc_tests_enabled = false -final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/61595" /* place a PR link here when committing bwc changes */ +boolean bwc_tests_enabled = true +final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */ if (bwc_tests_enabled == false) { if (bwc_tests_disabled_issue.isEmpty()) { throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false") diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/searchablesnapshots/SearchableSnapshotShardStats.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/searchablesnapshots/SearchableSnapshotShardStats.java index 9ddccc69414be..0ca88493fcaa2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/searchablesnapshots/SearchableSnapshotShardStats.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/searchablesnapshots/SearchableSnapshotShardStats.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.xpack.core.searchablesnapshots; -import org.elasticsearch.Version; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -180,21 +179,12 @@ public CacheIndexInputStats(String fileName, long fileLength, long openCount, lo this.contiguousReads = new Counter(in); this.nonContiguousReads = new Counter(in); this.cachedBytesRead = new Counter(in); - if (in.getVersion().onOrAfter(Version.V_8_0_0)) { - this.indexCacheBytesRead = new Counter(in); - } else { - this.indexCacheBytesRead = new Counter(0, 0, 0, 0); - } + this.indexCacheBytesRead = new Counter(in); this.cachedBytesWritten = new TimedCounter(in); this.directBytesRead = new TimedCounter(in); this.optimizedBytesRead = new TimedCounter(in); - if (in.getVersion().onOrAfter(Version.V_8_0_0)) { - this.blobStoreBytesRequested = new Counter(in); - this.currentIndexCacheFills = in.readVLong(); - } else { - this.blobStoreBytesRequested = new Counter(0, 0, 0, 0); - this.currentIndexCacheFills = 0; - } + this.blobStoreBytesRequested = new Counter(in); + this.currentIndexCacheFills = in.readVLong(); } @Override @@ -211,16 +201,12 @@ public void writeTo(StreamOutput out) throws IOException { contiguousReads.writeTo(out); nonContiguousReads.writeTo(out); cachedBytesRead.writeTo(out); - if (out.getVersion().onOrAfter(Version.V_8_0_0)) { - indexCacheBytesRead.writeTo(out); - } + indexCacheBytesRead.writeTo(out); cachedBytesWritten.writeTo(out); directBytesRead.writeTo(out); optimizedBytesRead.writeTo(out); - if (out.getVersion().onOrAfter(Version.V_8_0_0)) { - blobStoreBytesRequested.writeTo(out); - out.writeVLong(currentIndexCacheFills); - } + blobStoreBytesRequested.writeTo(out); + out.writeVLong(currentIndexCacheFills); } public String getFileName() {