diff --git a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java index 58cc94026c4..b585e8feb77 100644 --- a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java +++ b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java @@ -1059,15 +1059,20 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp } } else { BlobContainer testBlobContainer = blobStore().blobContainer(basePath().add(testBlobPrefix(seed))); - try (InputStream ignored = testBlobContainer.readBlob("master.dat")) { - try { - BytesArray bytes = new BytesArray(seed); - try (InputStream stream = bytes.streamInput()) { - testBlobContainer.writeBlob("data-" + localNode.getId() + ".dat", stream, bytes.length(), true); - } - } catch (IOException exp) { - throw new RepositoryVerificationException(metadata.name(), "store location [" + blobStore() + - "] is not accessible on the node [" + localNode + "]", exp); + try { + BytesArray bytes = new BytesArray(seed); + try (InputStream stream = bytes.streamInput()) { + testBlobContainer.writeBlob("data-" + localNode.getId() + ".dat", stream, bytes.length(), true); + } + } catch (IOException exp) { + throw new RepositoryVerificationException(metadata.name(), "store location [" + blobStore() + + "] is not accessible on the node [" + localNode + "]", exp); + } + try (InputStream masterDat = testBlobContainer.readBlob("master.dat")) { + final String seedRead = Streams.readFully(masterDat).utf8ToString(); + if (seedRead.equals(seed) == false) { + throw new RepositoryVerificationException(metadata.name(), "Seed read from master.dat was [" + seedRead + + "] but expected seed [" + seed + "]"); } } catch (NoSuchFileException e) { throw new RepositoryVerificationException(metadata.name(), "a file written by master to the store [" + blobStore() +