Skip to content

Commit ad85edd

Browse files
committed
HADOOP-18508. Terasort path isolation
* terasort uses path under fork/job id, which requires disabling test dir cleanup. * +method name for logs includes memory option * +reports CSV file includes memory flag * sequential and surefire test runs also pass down job id, so that it is possible to safely run a single test in one process while a full suite runs against the same bucket. Change-Id: Ib37ef6b5f23e5e7beb53d7c04c44e811ac4e2fa3
1 parent 63a7ed0 commit ad85edd

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

hadoop-tools/hadoop-aws/pom.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,8 @@
120120
<test.build.data>${test.build.data}/${surefire.forkNumber}</test.build.data>
121121
<test.build.dir>${test.build.dir}/${surefire.forkNumber}</test.build.dir>
122122
<hadoop.tmp.dir>${hadoop.tmp.dir}/${surefire.forkNumber}</hadoop.tmp.dir>
123+
<test.unique.fork.id>job-${job.id}-fork-000${surefire.forkNumber}</test.unique.fork.id>
123124

124-
<!-- Due to a Maven quirk, setting this to just -->
125-
<!-- surefire.forkNumber won't do the parameter -->
126-
<!-- substitution. Putting a prefix in front of it like -->
127-
<!-- "fork-" makes it work. -->
128-
<!-- Important: Those leading 0s are needed to guarantee that -->
129-
<!-- trailing three chars are always numeric and unique -->
130-
<test.unique.fork.id>fork-000${surefire.forkNumber}</test.unique.fork.id>
131125
<!-- Propagate scale parameters -->
132126
<fs.s3a.scale.test.enabled>${fs.s3a.scale.test.enabled}</fs.s3a.scale.test.enabled>
133127
<fs.s3a.scale.test.huge.filesize>${fs.s3a.scale.test.huge.filesize}</fs.s3a.scale.test.huge.filesize>
@@ -297,6 +291,7 @@
297291
<fs.s3a.directory.marker.audit>${fs.s3a.directory.marker.audit}</fs.s3a.directory.marker.audit>
298292
<!-- Prefetch -->
299293
<fs.s3a.prefetch.enabled>${fs.s3a.prefetch.enabled}</fs.s3a.prefetch.enabled>
294+
<test.unique.fork.id>job-${job.id}</test.unique.fork.id>
300295
</systemPropertyVariables>
301296
<forkedProcessTimeoutInSeconds>${fs.s3a.scale.test.timeout}</forkedProcessTimeoutInSeconds>
302297
</configuration>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ public interface S3ATestConstants {
193193

194194
/**
195195
* Fork ID passed down from maven if the test is running in parallel.
196+
* If a build was also executed with job.id set, this is included in
197+
* the fork ID.
196198
*/
197199
String TEST_UNIQUE_FORK_ID = "test.unique.fork.id";
198200
String TEST_STS_ENABLED = "test.fs.s3a.sts.enabled";

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ public static void assumePathCapabilityFalse(FileSystem fs, String capability) {
601601
/**
602602
* Create a test path, using the value of
603603
* {@link S3ATestConstants#TEST_UNIQUE_FORK_ID} if it is set.
604+
* This path is *not* qualified.
604605
* @param defVal default value
605606
* @return a path
606607
*/

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/terasort/ITestTerasortOnS3A.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import java.io.File;
2222
import java.io.FileNotFoundException;
23+
import java.io.IOException;
2324
import java.nio.charset.StandardCharsets;
2425
import java.util.Arrays;
2526
import java.util.Collection;
@@ -43,6 +44,7 @@
4344
import org.apache.hadoop.examples.terasort.TeraSortConfigKeys;
4445
import org.apache.hadoop.examples.terasort.TeraValidate;
4546
import org.apache.hadoop.fs.Path;
47+
import org.apache.hadoop.fs.s3a.S3ATestUtils;
4648
import org.apache.hadoop.fs.s3a.commit.AbstractYarnClusterITest;
4749
import org.apache.hadoop.fs.s3a.commit.CommitConstants;
4850
import org.apache.hadoop.fs.s3a.commit.magic.MagicS3GuardCommitter;
@@ -118,7 +120,7 @@ public class ITestTerasortOnS3A extends AbstractYarnClusterITest {
118120
*
119121
* @return the committer binding for this run.
120122
*/
121-
@Parameterized.Parameters(name = "{0}")
123+
@Parameterized.Parameters(name = "{0}-memory={1}")
122124
public static Collection<Object[]> params() {
123125
return Arrays.asList(new Object[][]{
124126
{DirectoryStagingCommitter.NAME, false},
@@ -143,6 +145,11 @@ public void setup() throws Exception {
143145
prepareToTerasort();
144146
}
145147

148+
@Override
149+
protected void deleteTestDirInTeardown() throws IOException {
150+
/* no-op */
151+
}
152+
146153
/**
147154
* Set up the job conf with the options for terasort chosen by the scale
148155
* options.
@@ -180,14 +187,14 @@ protected int getRowCount() {
180187
* The paths used must be unique across parameterized runs but
181188
* common across all test cases in a single parameterized run.
182189
*/
183-
private void prepareToTerasort() {
190+
private void prepareToTerasort() throws IOException {
184191
// small sample size for faster runs
185-
terasortPath = new Path("/terasort-" + committerName + "-" + trackCommitsInMemory)
186-
.makeQualified(getFileSystem());
192+
terasortPath = getFileSystem().qualify(
193+
new Path(S3ATestUtils.createTestPath(new Path("terasort-test")),
194+
"terasort-" + committerName + "-" + trackCommitsInMemory));
187195
sortInput = new Path(terasortPath, "sortin");
188196
sortOutput = new Path(terasortPath, "sortout");
189197
sortValidate = new Path(terasortPath, "validate");
190-
191198
}
192199

193200
/**
@@ -254,7 +261,7 @@ private void executeStage(
254261
*/
255262
@Test
256263
public void test_100_terasort_setup() throws Throwable {
257-
describe("Setting up for a terasort");
264+
describe("Setting up for a terasort with path of %s", terasortPath);
258265

259266
getFileSystem().delete(terasortPath, true);
260267
completedStages = new HashMap<>();
@@ -339,7 +346,8 @@ public void test_140_teracomplete() throws Throwable {
339346
stage.accept("teravalidate");
340347
stage.accept("overall");
341348
String text = results.toString();
342-
File resultsFile = new File(getReportDir(), committerName + ".csv");
349+
File resultsFile = new File(getReportDir(),
350+
String.format("%s-%s.csv", committerName, trackCommitsInMemory));
343351
FileUtils.write(resultsFile, text, StandardCharsets.UTF_8);
344352
LOG.info("Results are in {}\n{}", resultsFile, text);
345353
}

0 commit comments

Comments
 (0)