Skip to content

Commit 8aa9a1e

Browse files
committed
review comments
1 parent 6f730d5 commit 8aa9a1e

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/streams/AnalyticsStream.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@
2424
import java.nio.ByteBuffer;
2525
import java.util.ArrayList;
2626
import java.util.List;
27-
import java.util.Optional;
2827
import java.util.concurrent.CompletableFuture;
2928
import java.util.function.Consumer;
3029
import java.util.function.IntFunction;
3130

32-
import org.apache.hadoop.fs.FileRange;
33-
import org.apache.hadoop.fs.VectoredReadUtils;
3431
import software.amazon.s3.analyticsaccelerator.S3SeekableInputStreamFactory;
3532
import software.amazon.s3.analyticsaccelerator.S3SeekableInputStream;
3633
import software.amazon.s3.analyticsaccelerator.common.ObjectRange;
@@ -47,6 +44,8 @@
4744
import org.apache.hadoop.fs.s3a.Retries;
4845
import org.apache.hadoop.fs.s3a.S3AInputPolicy;
4946
import org.apache.hadoop.fs.s3a.S3ObjectAttributes;
47+
import org.apache.hadoop.fs.FileRange;
48+
import org.apache.hadoop.fs.VectoredReadUtils;
5049

5150
import static org.apache.hadoop.fs.VectoredReadUtils.LOG_BYTE_BUFFER_RELEASED;
5251

@@ -142,12 +141,9 @@ public int read(byte[] buf, int off, int len) throws IOException {
142141
}
143142

144143
/**
145-
* {@inheritDoc}
146144
* Pass to {@link #readVectored(List, IntFunction, Consumer)}
147145
* with the {@link VectoredReadUtils#LOG_BYTE_BUFFER_RELEASED} releaser.
148-
* @param ranges the byte ranges to read.
149-
* @param allocate the function to allocate ByteBuffer.
150-
* @throws IOException IOE if any.
146+
* {@inheritDoc}
151147
*/
152148
@Override
153149
public void readVectored(List<? extends FileRange> ranges,
@@ -156,12 +152,9 @@ public void readVectored(List<? extends FileRange> ranges,
156152
}
157153

158154
/**
159-
* {@inheritDoc}
160155
* Pass to {@link #readVectored(List, IntFunction, Consumer)}
161156
* with the {@link VectoredReadUtils#LOG_BYTE_BUFFER_RELEASED} releaser.
162-
* @param ranges the byte ranges to read.
163-
* @param allocate the function to allocate ByteBuffer.
164-
* @throws IOException IOE if any.
157+
* {@inheritDoc}
165158
*/
166159
@Override
167160
public void readVectored(final List<? extends FileRange> ranges,

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractAnalyticsStreamVectoredRead.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@
2626
import org.apache.hadoop.fs.contract.ContractTestUtils;
2727
import org.apache.hadoop.fs.statistics.IOStatistics;
2828
import org.apache.hadoop.fs.statistics.StreamStatisticNames;
29+
import org.apache.hadoop.test.LambdaTestUtils;
2930
import org.apache.hadoop.test.tags.IntegrationTest;
3031

3132
import org.junit.jupiter.api.Test;
3233
import org.junit.jupiter.params.ParameterizedClass;
3334
import org.junit.jupiter.params.provider.MethodSource;
3435

3536
import java.util.List;
37+
import java.util.function.Consumer;
3638

39+
import static org.apache.hadoop.fs.contract.ContractTestUtils.skip;
40+
import static org.apache.hadoop.fs.contract.ContractTestUtils.validateVectoredReadResult;
3741
import static org.apache.hadoop.fs.s3a.S3ATestUtils.enableAnalyticsAccelerator;
3842
import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipForAnyEncryptionExceptSSES3;
3943
import static org.apache.hadoop.fs.statistics.IOStatisticAssertions.verifyStatisticCounterValue;
@@ -73,7 +77,6 @@ protected Configuration createConfiguration() {
7377
// This issue is tracked in:
7478
// https://github.com/awslabs/analytics-accelerator-s3/issues/218
7579
skipForAnyEncryptionExceptSSES3(conf);
76-
conf.set("fs.contract.vector-io-early-eof-check", "false");
7780
return conf;
7881
}
7982

@@ -82,18 +85,31 @@ protected AbstractFSContract createContract(Configuration conf) {
8285
return new S3AContract(conf);
8386
}
8487

88+
/**
89+
* When the offset is negative, AAL returns IllegalArgumentException, whereas the base implementation will return
90+
* an EoF.
91+
*/
8592
@Override
8693
public void testNegativeOffsetRange() throws Exception {
8794
verifyExceptionalVectoredRead(ContractTestUtils.range(-1, 50), IllegalArgumentException.class);
8895
}
8996

97+
/**
98+
* Currently there is no null check on the release operation, this will be fixed in the next AAL version.
99+
*/
100+
@Override
101+
public void testNullReleaseOperation() {
102+
skip("AAL current does not do a null check on the release operation");
103+
}
104+
90105
@Test
91106
public void testReadVectoredWithAALStatsCollection() throws Exception {
92107

93108
List<FileRange> fileRanges = createSampleNonOverlappingRanges();
94-
try (FSDataInputStream in = openVectorFile()){
109+
try (FSDataInputStream in = openVectorFile()) {
95110
in.readVectored(fileRanges, getAllocate());
96111

112+
validateVectoredReadResult(fileRanges, DATASET, 0);
97113
IOStatistics st = in.getIOStatistics();
98114

99115
// Statistics such as GET requests will be added after IoStats support.

0 commit comments

Comments
 (0)