Skip to content

Commit 0fd36df

Browse files
virajjasanisteveloughran
authored andcommitted
HADOOP-18377. hadoop-aws build to add a -prefetch profile to run all tests with prefetching (#4914)
Contributed by Viraj Jasani
1 parent 76e243a commit 0fd36df

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

hadoop-tools/hadoop-aws/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
<fs.s3a.directory.marker.audit>false</fs.s3a.directory.marker.audit>
5353
<!-- marker retention policy -->
5454
<fs.s3a.directory.marker.retention></fs.s3a.directory.marker.retention>
55+
56+
<!-- Is prefetch enabled? -->
57+
<fs.s3a.prefetch.enabled>unset</fs.s3a.prefetch.enabled>
5558
</properties>
5659

5760
<profiles>
@@ -126,6 +129,8 @@
126129
<!-- Markers-->
127130
<fs.s3a.directory.marker.retention>${fs.s3a.directory.marker.retention}</fs.s3a.directory.marker.retention>
128131
<fs.s3a.directory.marker.audit>${fs.s3a.directory.marker.audit}</fs.s3a.directory.marker.audit>
132+
<!-- Prefetch -->
133+
<fs.s3a.prefetch.enabled>${fs.s3a.prefetch.enabled}</fs.s3a.prefetch.enabled>
129134
</systemPropertyVariables>
130135
</configuration>
131136
</plugin>
@@ -165,6 +170,8 @@
165170
<fs.s3a.directory.marker.retention>${fs.s3a.directory.marker.retention}</fs.s3a.directory.marker.retention>
166171

167172
<test.default.timeout>${test.integration.timeout}</test.default.timeout>
173+
<!-- Prefetch -->
174+
<fs.s3a.prefetch.enabled>${fs.s3a.prefetch.enabled}</fs.s3a.prefetch.enabled>
168175
</systemPropertyVariables>
169176
<!-- Some tests cannot run in parallel. Tests that cover -->
170177
<!-- access to the root directory must run in isolation -->
@@ -214,6 +221,8 @@
214221
<!-- Markers-->
215222
<fs.s3a.directory.marker.retention>${fs.s3a.directory.marker.retention}</fs.s3a.directory.marker.retention>
216223
<fs.s3a.directory.marker.audit>${fs.s3a.directory.marker.audit}</fs.s3a.directory.marker.audit>
224+
<!-- Prefetch -->
225+
<fs.s3a.prefetch.enabled>${fs.s3a.prefetch.enabled}</fs.s3a.prefetch.enabled>
217226
</systemPropertyVariables>
218227
<!-- Do a sequential run for tests that cannot handle -->
219228
<!-- parallel execution. -->
@@ -270,6 +279,8 @@
270279
<!-- Markers-->
271280
<fs.s3a.directory.marker.retention>${fs.s3a.directory.marker.retention}</fs.s3a.directory.marker.retention>
272281
<fs.s3a.directory.marker.audit>${fs.s3a.directory.marker.audit}</fs.s3a.directory.marker.audit>
282+
<!-- Prefetch -->
283+
<fs.s3a.prefetch.enabled>${fs.s3a.prefetch.enabled}</fs.s3a.prefetch.enabled>
273284
</systemPropertyVariables>
274285
<forkedProcessTimeoutInSeconds>${fs.s3a.scale.test.timeout}</forkedProcessTimeoutInSeconds>
275286
</configuration>
@@ -331,6 +342,19 @@
331342
</properties>
332343
</profile>
333344

345+
<!-- Turn on prefetching-->
346+
<profile>
347+
<id>prefetch</id>
348+
<activation>
349+
<property>
350+
<name>prefetch</name>
351+
</property>
352+
</activation>
353+
<properties>
354+
<fs.s3a.prefetch.enabled>true</fs.s3a.prefetch.enabled>
355+
</properties>
356+
</profile>
357+
334358
</profiles>
335359

336360
<build>

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/testing.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,20 @@ your `core-site.xml` file, so that trying to use S3 select fails fast with
617617
a meaningful error ("S3 Select not supported") rather than a generic Bad Request
618618
exception.
619619

620+
### <a name="enabling-prefetch"></a> Enabling prefetch for all tests
621+
622+
The tests are run with prefetch if the `prefetch` property is set in the
623+
maven build. This can be combined with the scale tests as well.
624+
625+
```bash
626+
mvn verify -Dprefetch
627+
628+
mvn verify -Dparallel-tests -Dprefetch -DtestsThreadCount=8
629+
630+
mvn verify -Dparallel-tests -Dprefetch -Dscale -DtestsThreadCount=8
631+
```
632+
633+
620634
### Testing Requester Pays
621635

622636
By default, the requester pays tests will look for a bucket that exists on Amazon S3

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,10 @@ public static Configuration prepareTestConfiguration(final Configuration conf) {
575575
DEFAULT_DIRECTORY_MARKER_POLICY);
576576
conf.set(DIRECTORY_MARKER_POLICY, directoryRetention);
577577

578+
boolean prefetchEnabled =
579+
getTestPropertyBool(conf, PREFETCH_ENABLED_KEY, PREFETCH_ENABLED_DEFAULT);
580+
conf.setBoolean(PREFETCH_ENABLED_KEY, prefetchEnabled);
581+
578582
return conf;
579583
}
580584

0 commit comments

Comments
 (0)