|
@@ -26,7 +26,6 @@ import java.util.List;
|
|
|
|
|
|
import com.amazonaws.services.s3.model.PartETag;
|
|
import com.amazonaws.services.s3.model.PartETag;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
-import org.junit.Assume;
|
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -39,6 +38,7 @@ import org.apache.hadoop.fs.FileSystem;
|
|
import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.fs.s3a.S3AFileSystem;
|
|
import org.apache.hadoop.fs.s3a.S3AFileSystem;
|
|
import org.apache.hadoop.fs.s3a.Statistic;
|
|
import org.apache.hadoop.fs.s3a.Statistic;
|
|
|
|
+import org.apache.hadoop.fs.s3a.auth.ProgressCounter;
|
|
import org.apache.hadoop.fs.s3a.commit.files.SinglePendingCommit;
|
|
import org.apache.hadoop.fs.s3a.commit.files.SinglePendingCommit;
|
|
import org.apache.hadoop.fs.s3a.commit.magic.MagicCommitTracker;
|
|
import org.apache.hadoop.fs.s3a.commit.magic.MagicCommitTracker;
|
|
import org.apache.hadoop.fs.s3a.commit.magic.MagicS3GuardCommitter;
|
|
import org.apache.hadoop.fs.s3a.commit.magic.MagicS3GuardCommitter;
|
|
@@ -69,6 +69,7 @@ public class ITestCommitOperations extends AbstractCommitITest {
|
|
private static final byte[] DATASET = dataset(1000, 'a', 32);
|
|
private static final byte[] DATASET = dataset(1000, 'a', 32);
|
|
private static final String S3A_FACTORY_KEY = String.format(
|
|
private static final String S3A_FACTORY_KEY = String.format(
|
|
COMMITTER_FACTORY_SCHEME_PATTERN, "s3a");
|
|
COMMITTER_FACTORY_SCHEME_PATTERN, "s3a");
|
|
|
|
+ private ProgressCounter progress;
|
|
|
|
|
|
/**
|
|
/**
|
|
* A compile time flag which allows you to disable failure reset before
|
|
* A compile time flag which allows you to disable failure reset before
|
|
@@ -105,6 +106,8 @@ public class ITestCommitOperations extends AbstractCommitITest {
|
|
verifyIsMagicCommitFS(getFileSystem());
|
|
verifyIsMagicCommitFS(getFileSystem());
|
|
// abort,; rethrow on failure
|
|
// abort,; rethrow on failure
|
|
setThrottling(HIGH_THROTTLE, STANDARD_FAILURE_LIMIT);
|
|
setThrottling(HIGH_THROTTLE, STANDARD_FAILURE_LIMIT);
|
|
|
|
+ progress = new ProgressCounter();
|
|
|
|
+ progress.assertCount("progress", 0);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -366,7 +369,7 @@ public class ITestCommitOperations extends AbstractCommitITest {
|
|
private void validateIntermediateAndFinalPaths(Path magicFilePath,
|
|
private void validateIntermediateAndFinalPaths(Path magicFilePath,
|
|
Path destFile)
|
|
Path destFile)
|
|
throws IOException {
|
|
throws IOException {
|
|
- assertPathDoesNotExist("dest file was found", destFile);
|
|
|
|
|
|
+ assertPathDoesNotExist("dest file was created", destFile);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -452,8 +455,10 @@ public class ITestCommitOperations extends AbstractCommitITest {
|
|
|
|
|
|
SinglePendingCommit pendingCommit =
|
|
SinglePendingCommit pendingCommit =
|
|
actions.uploadFileToPendingCommit(tempFile,
|
|
actions.uploadFileToPendingCommit(tempFile,
|
|
- dest, null,
|
|
|
|
- DEFAULT_MULTIPART_SIZE);
|
|
|
|
|
|
+ dest,
|
|
|
|
+ null,
|
|
|
|
+ DEFAULT_MULTIPART_SIZE,
|
|
|
|
+ progress);
|
|
resetFailures();
|
|
resetFailures();
|
|
assertPathDoesNotExist("pending commit", dest);
|
|
assertPathDoesNotExist("pending commit", dest);
|
|
fullThrottle();
|
|
fullThrottle();
|
|
@@ -461,6 +466,8 @@ public class ITestCommitOperations extends AbstractCommitITest {
|
|
resetFailures();
|
|
resetFailures();
|
|
FileStatus status = verifyPathExists(fs,
|
|
FileStatus status = verifyPathExists(fs,
|
|
"uploaded file commit", dest);
|
|
"uploaded file commit", dest);
|
|
|
|
+ progress.assertCount("Progress counter should be 1.",
|
|
|
|
+ 1);
|
|
assertEquals("File length in " + status, 0, status.getLen());
|
|
assertEquals("File length in " + status, 0, status.getLen());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -477,10 +484,11 @@ public class ITestCommitOperations extends AbstractCommitITest {
|
|
assertPathDoesNotExist("test setup", dest);
|
|
assertPathDoesNotExist("test setup", dest);
|
|
SinglePendingCommit pendingCommit =
|
|
SinglePendingCommit pendingCommit =
|
|
actions.uploadFileToPendingCommit(tempFile,
|
|
actions.uploadFileToPendingCommit(tempFile,
|
|
- dest, null,
|
|
|
|
- DEFAULT_MULTIPART_SIZE);
|
|
|
|
|
|
+ dest,
|
|
|
|
+ null,
|
|
|
|
+ DEFAULT_MULTIPART_SIZE,
|
|
|
|
+ progress);
|
|
resetFailures();
|
|
resetFailures();
|
|
- LOG.debug("Precommit validation");
|
|
|
|
assertPathDoesNotExist("pending commit", dest);
|
|
assertPathDoesNotExist("pending commit", dest);
|
|
fullThrottle();
|
|
fullThrottle();
|
|
LOG.debug("Postcommit validation");
|
|
LOG.debug("Postcommit validation");
|
|
@@ -488,6 +496,8 @@ public class ITestCommitOperations extends AbstractCommitITest {
|
|
resetFailures();
|
|
resetFailures();
|
|
String s = readUTF8(fs, dest, -1);
|
|
String s = readUTF8(fs, dest, -1);
|
|
assertEquals(text, s);
|
|
assertEquals(text, s);
|
|
|
|
+ progress.assertCount("Progress counter should be 1.",
|
|
|
|
+ 1);
|
|
}
|
|
}
|
|
|
|
|
|
@Test(expected = FileNotFoundException.class)
|
|
@Test(expected = FileNotFoundException.class)
|
|
@@ -498,7 +508,9 @@ public class ITestCommitOperations extends AbstractCommitITest {
|
|
Path dest = methodPath("testUploadMissingile");
|
|
Path dest = methodPath("testUploadMissingile");
|
|
fullThrottle();
|
|
fullThrottle();
|
|
actions.uploadFileToPendingCommit(tempFile, dest, null,
|
|
actions.uploadFileToPendingCommit(tempFile, dest, null,
|
|
- DEFAULT_MULTIPART_SIZE);
|
|
|
|
|
|
+ DEFAULT_MULTIPART_SIZE, progress);
|
|
|
|
+ progress.assertCount("Progress counter should be 1.",
|
|
|
|
+ 1);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -598,7 +610,8 @@ public class ITestCommitOperations extends AbstractCommitITest {
|
|
SinglePendingCommit commit1 =
|
|
SinglePendingCommit commit1 =
|
|
actions.uploadFileToPendingCommit(localFile,
|
|
actions.uploadFileToPendingCommit(localFile,
|
|
destination, null,
|
|
destination, null,
|
|
- DEFAULT_MULTIPART_SIZE);
|
|
|
|
|
|
+ DEFAULT_MULTIPART_SIZE,
|
|
|
|
+ progress);
|
|
commits.add(commit1);
|
|
commits.add(commit1);
|
|
}
|
|
}
|
|
resetFailures();
|
|
resetFailures();
|