diff --git a/server/src/main/java/org/opensearch/gateway/remote/model/RemoteClusterMetadataManifest.java b/server/src/main/java/org/opensearch/gateway/remote/model/RemoteClusterMetadataManifest.java index 5c7fb61d90684..999beaa4e865d 100644 --- a/server/src/main/java/org/opensearch/gateway/remote/model/RemoteClusterMetadataManifest.java +++ b/server/src/main/java/org/opensearch/gateway/remote/model/RemoteClusterMetadataManifest.java @@ -123,8 +123,7 @@ public UploadedMetadata getUploadedMetadata() { @Override public InputStream serialize() throws IOException { - ChecksumBlobStoreFormat blobStoreFormat = getClusterMetadataManifestBlobStoreFormatForUpload(); - return blobStoreFormat.serialize( + return CLUSTER_METADATA_MANIFEST_FORMAT.serialize( clusterMetadataManifest, generateBlobFileName(), getCompressor(), @@ -134,7 +133,7 @@ public InputStream serialize() throws IOException { @Override public ClusterMetadataManifest deserialize(final InputStream inputStream) throws IOException { - ChecksumBlobStoreFormat blobStoreFormat = getClusterMetadataManifestBlobStoreFormatForDownload(); + ChecksumBlobStoreFormat blobStoreFormat = getClusterMetadataManifestBlobStoreFormat(); return blobStoreFormat.deserialize(blobName, getNamedXContentRegistry(), Streams.readFully(inputStream)); } @@ -152,17 +151,8 @@ int getManifestCodecVersion() { } } - private ChecksumBlobStoreFormat getClusterMetadataManifestBlobStoreFormatForDownload() { + private ChecksumBlobStoreFormat getClusterMetadataManifestBlobStoreFormat() { long codecVersion = getManifestCodecVersion(); - return getClusterMetadataManifestBlobStoreFormat(codecVersion); - } - - private ChecksumBlobStoreFormat getClusterMetadataManifestBlobStoreFormatForUpload() { - long codecVersion = clusterMetadataManifest.getCodecVersion(); - return getClusterMetadataManifestBlobStoreFormat(codecVersion); - } - - private ChecksumBlobStoreFormat getClusterMetadataManifestBlobStoreFormat(long codecVersion) { if (codecVersion == ClusterMetadataManifest.MANIFEST_CURRENT_CODEC_VERSION) { return CLUSTER_METADATA_MANIFEST_FORMAT; } else if (codecVersion == ClusterMetadataManifest.CODEC_V3) {