* Fixing this for two reasons: 1. Why not verify that the seed we wrote is actually there when we can 2. The AWS S3 SDK started to log a bunch of WARN messages about not fully reading the stream now that we started to abuse the read blob as an `exists` check after removing that method from the blob container
This commit is contained in:
parent
ad3d8c59bd
commit
1beea3588b
|
@ -1059,7 +1059,6 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BlobContainer testBlobContainer = blobStore().blobContainer(basePath().add(testBlobPrefix(seed)));
|
BlobContainer testBlobContainer = blobStore().blobContainer(basePath().add(testBlobPrefix(seed)));
|
||||||
try (InputStream ignored = testBlobContainer.readBlob("master.dat")) {
|
|
||||||
try {
|
try {
|
||||||
BytesArray bytes = new BytesArray(seed);
|
BytesArray bytes = new BytesArray(seed);
|
||||||
try (InputStream stream = bytes.streamInput()) {
|
try (InputStream stream = bytes.streamInput()) {
|
||||||
|
@ -1069,6 +1068,12 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
||||||
throw new RepositoryVerificationException(metadata.name(), "store location [" + blobStore() +
|
throw new RepositoryVerificationException(metadata.name(), "store location [" + blobStore() +
|
||||||
"] is not accessible on the node [" + localNode + "]", exp);
|
"] 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) {
|
} catch (NoSuchFileException e) {
|
||||||
throw new RepositoryVerificationException(metadata.name(), "a file written by master to the store [" + blobStore() +
|
throw new RepositoryVerificationException(metadata.name(), "a file written by master to the store [" + blobStore() +
|
||||||
"] cannot be accessed on the node [" + localNode + "]. " +
|
"] cannot be accessed on the node [" + localNode + "]. " +
|
||||||
|
|
Loading…
Reference in New Issue