Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,14 @@ public void clearFileEncryptionInfo() {
this.encInfo = null;
}

/**
* Set the file encryption info.
* @param fileEncryptionInfo
*/
public void setFileEncryptionInfo(FileEncryptionInfo fileEncryptionInfo) {
this.encInfo = fileEncryptionInfo;
}

public String getPath() {
if (StringUtils.isBlank(getFileName())) {
return getKeyName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,17 @@ public void testMPUwithTwoParts() throws Exception {
testMultipartUploadWithEncryption(bucket, 2);
}

@Test
public void testMPUwithThreePartsOverride() throws Exception {
String volumeName = UUID.randomUUID().toString();
String bucketName = UUID.randomUUID().toString();
OzoneBucket bucket = createVolumeAndBucket(volumeName, bucketName);
testMultipartUploadWithEncryption(bucket, 3);

// override the key and check content
testMultipartUploadWithEncryption(bucket, 3);
}


@Test
public void testMPUwithLinkBucket() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,21 @@ protected OmKeyInfo getOmKeyInfo(OzoneManager ozoneManager, long trxnLogIndex,
updatePrefixFSOInfo(dbOpenKeyInfo, builder);
omKeyInfo = builder.build();
} else {
OmKeyInfo dbOpenKeyInfo = getOmKeyInfoFromOpenKeyTable(multipartOpenKey,
keyName, omMetadataManager);

// Already a version exists, so we should add it as a new version.
// But now as versioning is not supported, just following the commit
// key approach. When versioning support comes, then we can uncomment
// below code keyInfo.addNewVersion(locations);

// As right now versioning is not supported, we can set encryption info
// at KeyInfo level, but once we start supporting versioning,
// encryption info needs to be set at KeyLocation level, as each version
// will have it's own file encryption info.
if (dbOpenKeyInfo.getFileEncryptionInfo() != null) {
omKeyInfo.setFileEncryptionInfo(dbOpenKeyInfo.getFileEncryptionInfo());
}
omKeyInfo.updateLocationInfoList(partLocationInfos, true, true);
omKeyInfo.setModificationTime(keyArgs.getModificationTime());
omKeyInfo.setDataSize(dataSize);
Expand Down