-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-19587. SSE-C integration changes #7738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,9 +21,13 @@ | |
|
|
||
| import java.io.EOFException; | ||
| import java.io.IOException; | ||
| import java.util.Optional; | ||
|
|
||
| import org.apache.hadoop.fs.s3a.S3AEncryptionMethods; | ||
| import org.apache.hadoop.fs.s3a.auth.delegation.EncryptionSecretOperations; | ||
| import software.amazon.s3.analyticsaccelerator.S3SeekableInputStreamFactory; | ||
| import software.amazon.s3.analyticsaccelerator.S3SeekableInputStream; | ||
| import software.amazon.s3.analyticsaccelerator.request.EncryptionSecrets; | ||
|
Check failure on line 30 in hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/streams/AnalyticsStream.java
|
||
| import software.amazon.s3.analyticsaccelerator.request.ObjectMetadata; | ||
| import software.amazon.s3.analyticsaccelerator.util.InputPolicy; | ||
| import software.amazon.s3.analyticsaccelerator.util.OpenStreamInformation; | ||
|
|
@@ -205,6 +209,12 @@ | |
| .etag(parameters.getObjectAttributes().getETag()).build()); | ||
| } | ||
|
|
||
| if(parameters.getEncryptionSecrets().getEncryptionMethod() == S3AEncryptionMethods.SSE_C) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: add a space before the { |
||
| EncryptionSecretOperations.getSSECustomerKey(parameters.getEncryptionSecrets()) | ||
| .ifPresent(base64customerKey -> openStreamInformationBuilder.encryptionSecrets( | ||
| EncryptionSecrets.builder().sseCustomerKey(Optional.of(base64customerKey)).build())); | ||
| } | ||
|
|
||
| return openStreamInformationBuilder.build(); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| import org.apache.hadoop.fs.LocalDirAllocator; | ||
| import org.apache.hadoop.fs.s3a.S3AReadOpContext; | ||
| import org.apache.hadoop.fs.s3a.S3ObjectAttributes; | ||
| import org.apache.hadoop.fs.s3a.auth.delegation.EncryptionSecrets; | ||
| import org.apache.hadoop.fs.s3a.statistics.S3AInputStreamStatistics; | ||
|
|
||
| import static java.util.Objects.requireNonNull; | ||
|
|
@@ -69,6 +70,29 @@ public final class ObjectReadParameters { | |
| */ | ||
| private LocalDirAllocator directoryAllocator; | ||
|
|
||
| /** | ||
| * Encryption secrets for this stream | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a . at the end |
||
| */ | ||
| private EncryptionSecrets encryptionSecrets; | ||
|
|
||
| /** | ||
| * Getter. | ||
| * @return Encryption secrets. | ||
| */ | ||
| public EncryptionSecrets getEncryptionSecrets() { | ||
| return encryptionSecrets; | ||
| } | ||
|
|
||
| /** | ||
| * Set encryption secrets. | ||
| * @param value new value | ||
| * @return the builder | ||
| */ | ||
| public ObjectReadParameters withEncryptionSecrets(final EncryptionSecrets value) { | ||
| encryptionSecrets = value; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * @return Read operation context. | ||
| */ | ||
|
|
@@ -185,6 +209,7 @@ public ObjectReadParameters validate() { | |
| requireNonNull(directoryAllocator, "directoryAllocator"); | ||
| requireNonNull(objectAttributes, "objectAttributes"); | ||
| requireNonNull(streamStatistics, "streamStatistics"); | ||
| requireNonNull(encryptionSecrets, "encryptionSecrets"); | ||
| return this; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,10 +40,10 @@ | |
| import static org.apache.hadoop.fs.s3a.Constants.SERVER_SIDE_ENCRYPTION_KEY; | ||
|
|
||
| import static org.apache.hadoop.fs.s3a.S3ATestUtils.assumeStoreAwsHosted; | ||
| import static org.apache.hadoop.fs.s3a.S3ATestUtils.enableAnalyticsAccelerator; | ||
| import static org.apache.hadoop.fs.s3a.S3ATestUtils.getTestBucketName; | ||
| import static org.apache.hadoop.fs.s3a.S3ATestUtils.maybeSkipRootTests; | ||
| import static org.apache.hadoop.fs.s3a.S3ATestUtils.removeBaseAndBucketOverrides; | ||
| import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipIfAnalyticsAcceleratorEnabled; | ||
| import static org.apache.hadoop.test.LambdaTestUtils.intercept; | ||
|
|
||
| /** | ||
|
|
@@ -96,8 +96,6 @@ protected Configuration createConfiguration() { | |
| @Override | ||
| public void setup() throws Exception { | ||
| super.setup(); | ||
| skipIfAnalyticsAcceleratorEnabled(getConfiguration(), | ||
| "Analytics Accelerator currently does not support SSE-C"); | ||
| assumeEnabled(); | ||
| // although not a root dir test, this confuses paths enough it shouldn't be run in | ||
| // parallel with other jobs | ||
|
|
@@ -327,6 +325,65 @@ public void testChecksumRequiresReadAccess() throws Throwable { | |
| () -> fsKeyB.getFileChecksum(path)); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Tests the creation and reading of a file using a different encryption key | ||
| * when Analytics Accelerator is enabled. | ||
| * | ||
| * @throws Exception if any error occurs during the test execution | ||
| */ | ||
| @Test | ||
| public void testCreateFileAndReadWithDifferentEncryptionKeyWithAnalyticsAcceleratorEnabled() throws Exception { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rather than do it this way, make the entire test suite (i.e. class) something which runs with both the normal and accelerated options. |
||
| enableAnalyticsAccelerator(getConfiguration()); | ||
| testCreateFileAndReadWithDifferentEncryptionKey(); | ||
| } | ||
|
|
||
| /** | ||
| * Tests the creation and movement of a file using a different SSE-C key | ||
| * when Analytics Accelerator is enabled. | ||
| * | ||
| * @throws Exception if any error occurs during the test execution | ||
| */ | ||
| @Test | ||
| public void testCreateFileThenMoveWithDifferentSSECKeyWithAnalyticsAcceleratorEnabled() throws Exception { | ||
| enableAnalyticsAccelerator(getConfiguration()); | ||
| testCreateFileThenMoveWithDifferentSSECKey(); | ||
| } | ||
|
|
||
| /** | ||
| * Tests create and file rename operation when Analytics Accelerator is enabled. | ||
| * | ||
| * @throws Exception if any error occurs during the test execution | ||
| */ | ||
| @Test | ||
| public void testCreateFileAndRenameFileWithAnalyticsAcceleratorEnabled() throws Exception { | ||
| enableAnalyticsAccelerator(getConfiguration()); | ||
| testRenameFile(); | ||
| } | ||
|
|
||
| /** | ||
| * Tests the creation and listing of encrypted files when Analytics Accelerator is enabled. | ||
| * | ||
| * @throws Exception if any error occurs during the test execution | ||
| */ | ||
| @Test | ||
| public void testCreateFileAndListStatusEncryptedFileWithAnalyticsAcceleratorEnabled() throws Exception { | ||
| enableAnalyticsAccelerator(getConfiguration()); | ||
| testListStatusEncryptedFile(); | ||
| } | ||
|
|
||
| /** | ||
| * Tests the creation and deletion of an encrypted object using a different key | ||
| * when Analytics Accelerator is enabled.t. | ||
| * | ||
| * @throws Exception if any error occurs during the test execution | ||
| */ | ||
| @Test | ||
| public void testCreateFileAndDeleteEncryptedObjectWithDifferentKeyWithAnalyticsAcceleratorEnabled() throws Exception { | ||
| enableAnalyticsAccelerator(getConfiguration()); | ||
| testDeleteEncryptedObjectWithDifferentKey(); | ||
| } | ||
|
|
||
| private S3AFileSystem createNewFileSystemWithSSECKey(String sseCKey) throws | ||
| IOException { | ||
| Configuration conf = this.createConfiguration(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.