Skip to content

Commit

Permalink
[TEST] fixes SharedClusterSnapshotRestoreIT test so it assumes we are
Browse files Browse the repository at this point in the history
working with a repository that supports atomic move operations
  • Loading branch information
Ali Beyad committed Jan 25, 2017
1 parent 5fb69de commit d5d2a91
Showing 1 changed file with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,7 @@ private void maybeIOExceptionOrBlock(String blobName) throws IOException {
}
}
}
}
// don't block on the index-N files, as getRepositoryData depends on it
else if (blobName.startsWith("index-") == false) {
} else {
if (shouldFail(blobName, randomControlIOExceptionRate) && (incrementAndGetFailureCount() < maximumNumberOfFailures)) {
logger.info("throwing random IOException for file [{}] at path [{}]", blobName, path());
throw new IOException("Random IOException");
Expand Down Expand Up @@ -324,17 +322,9 @@ public Map<String, BlobMetaData> listBlobsByPrefix(String blobNamePrefix) throws

@Override
public void move(String sourceBlob, String targetBlob) throws IOException {
if (RandomizedContext.current().getRandom().nextBoolean()) {
// simulate a non-atomic move, since many blob container implementations
// will not have an atomic move, and we should be able to handle that
maybeIOExceptionOrBlock(targetBlob);
super.writeBlob(targetBlob, super.readBlob(sourceBlob), 0L);
super.deleteBlob(sourceBlob);
} else {
// atomic move since this inherits from FsBlobContainer which provides atomic moves
maybeIOExceptionOrBlock(targetBlob);
super.move(sourceBlob, targetBlob);
}
// atomic move since this inherits from FsBlobContainer which provides atomic moves
maybeIOExceptionOrBlock(targetBlob);
super.move(sourceBlob, targetBlob);
}

@Override
Expand Down

0 comments on commit d5d2a91

Please sign in to comment.