|
@@ -18,15 +18,23 @@
|
|
|
|
|
|
package org.apache.hadoop.fs.contract.s3a;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import org.junit.Test;
|
|
|
+
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
+import org.apache.hadoop.fs.FSDataInputStream;
|
|
|
import org.apache.hadoop.fs.FileRange;
|
|
|
import org.apache.hadoop.fs.FileRangeImpl;
|
|
|
import org.apache.hadoop.fs.FileSystem;
|
|
|
import org.apache.hadoop.fs.contract.AbstractContractVectoredReadTest;
|
|
|
import org.apache.hadoop.fs.contract.AbstractFSContract;
|
|
|
+import org.apache.hadoop.fs.s3a.Constants;
|
|
|
+import org.apache.hadoop.fs.s3a.S3AFileSystem;
|
|
|
+import org.apache.hadoop.fs.s3a.S3ATestUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
+import static org.apache.hadoop.test.MoreAsserts.assertEqual;
|
|
|
|
|
|
public class ITestS3AContractVectoredRead extends AbstractContractVectoredReadTest {
|
|
|
|
|
@@ -42,7 +50,6 @@ public class ITestS3AContractVectoredRead extends AbstractContractVectoredReadTe
|
|
|
/**
|
|
|
* Overriding in S3 vectored read api fails fast in case of EOF
|
|
|
* requested range.
|
|
|
- * @throws Exception
|
|
|
*/
|
|
|
@Override
|
|
|
public void testEOFRanges() throws Exception {
|
|
@@ -51,4 +58,45 @@ public class ITestS3AContractVectoredRead extends AbstractContractVectoredReadTe
|
|
|
fileRanges.add(new FileRangeImpl(DATASET_LEN, 100));
|
|
|
testExceptionalVectoredRead(fs, fileRanges, "EOFException is expected");
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testMinSeekAndMaxSizeConfigsPropagation() throws Exception {
|
|
|
+ Configuration conf = getFileSystem().getConf();
|
|
|
+ S3ATestUtils.removeBaseAndBucketOverrides(conf,
|
|
|
+ Constants.AWS_S3_VECTOR_READS_MAX_MERGED_READ_SIZE,
|
|
|
+ Constants.AWS_S3_VECTOR_READS_MIN_SEEK_SIZE);
|
|
|
+ S3ATestUtils.disableFilesystemCaching(conf);
|
|
|
+ final int configuredMinSeek = 2 * 1024;
|
|
|
+ final int configuredMaxSize = 10 * 1024 * 1024;
|
|
|
+ conf.set(Constants.AWS_S3_VECTOR_READS_MIN_SEEK_SIZE, "2K");
|
|
|
+ conf.set(Constants.AWS_S3_VECTOR_READS_MAX_MERGED_READ_SIZE, "10M");
|
|
|
+ try (S3AFileSystem fs = S3ATestUtils.createTestFileSystem(conf)) {
|
|
|
+ try (FSDataInputStream fis = fs.open(path(VECTORED_READ_FILE_NAME))) {
|
|
|
+ int newMinSeek = fis.minSeekForVectorReads();
|
|
|
+ int newMaxSize = fis.maxReadSizeForVectorReads();
|
|
|
+ assertEqual(newMinSeek, configuredMinSeek,
|
|
|
+ "configured s3a min seek for vectored reads");
|
|
|
+ assertEqual(newMaxSize, configuredMaxSize,
|
|
|
+ "configured s3a max size for vectored reads");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testMinSeekAndMaxSizeDefaultValues() throws Exception {
|
|
|
+ Configuration conf = getFileSystem().getConf();
|
|
|
+ S3ATestUtils.removeBaseAndBucketOverrides(conf,
|
|
|
+ Constants.AWS_S3_VECTOR_READS_MIN_SEEK_SIZE,
|
|
|
+ Constants.AWS_S3_VECTOR_READS_MAX_MERGED_READ_SIZE);
|
|
|
+ try (S3AFileSystem fs = S3ATestUtils.createTestFileSystem(conf)) {
|
|
|
+ try (FSDataInputStream fis = fs.open(path(VECTORED_READ_FILE_NAME))) {
|
|
|
+ int minSeek = fis.minSeekForVectorReads();
|
|
|
+ int maxSize = fis.maxReadSizeForVectorReads();
|
|
|
+ assertEqual(minSeek, Constants.DEFAULT_AWS_S3_VECTOR_READS_MIN_SEEK_SIZE,
|
|
|
+ "default s3a min seek for vectored reads");
|
|
|
+ assertEqual(maxSize, Constants.DEFAULT_AWS_S3_VECTOR_READS_MAX_MERGED_READ_SIZE,
|
|
|
+ "default s3a max read size for vectored reads");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|