-
Notifications
You must be signed in to change notification settings - Fork 509
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
HDDS-10630. Add missing parent directories deleted between initiate and complete MPU #6496
Conversation
…leted between commit and complete mpu uploads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @SaketaChalamchala for the patch. Functionality looks OK to me. Please take a look at failing unit test. Would be nice to reuse some code from S3InitiateMultipartUploadRequestWithFSO
.
Thanks for the review @adoroszlai. The unit tests have been fixed. |
// Create missing parent directory entries. | ||
try (BatchOperation batchOperation = omMetadataManager.getStore() | ||
.initBatchOperation()) { | ||
for (OmDirectoryInfo parentDirInfo : missingParentInfos) { | ||
final String parentKey = omMetadataManager.getOzonePathKey( | ||
volumeId, bucketId, parentDirInfo.getParentObjectID(), | ||
parentDirInfo.getName()); | ||
omMetadataManager.getDirectoryTable().putWithBatch(batchOperation, | ||
parentKey, parentDirInfo); | ||
} | ||
|
||
// namespace quota changes for parent directory | ||
String bucketKey = omMetadataManager.getBucketKey( | ||
omBucketInfo.getVolumeName(), | ||
omBucketInfo.getBucketName()); | ||
omMetadataManager.getBucketTable().putWithBatch(batchOperation, | ||
bucketKey, omBucketInfo); | ||
|
||
omMetadataManager.getStore().commitBatchOperation(batchOperation); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding to DB batch should be handled in the response object by design. It uses an existing batch and commits only if the response is OK.
Lines 79 to 102 in 06c0d81
@Override | |
public void addToDBBatch(OMMetadataManager omMetadataManager, | |
BatchOperation batchOperation) throws IOException { | |
/** | |
* Create parent directory entries during MultiPartFileKey Create - do not | |
* wait for File Commit request. | |
*/ | |
if (parentDirInfos != null) { | |
for (OmDirectoryInfo parentDirInfo : parentDirInfos) { | |
final String parentKey = omMetadataManager.getOzonePathKey( | |
volumeId, bucketId, parentDirInfo.getParentObjectID(), | |
parentDirInfo.getName()); | |
omMetadataManager.getDirectoryTable().putWithBatch(batchOperation, | |
parentKey, parentDirInfo); | |
} | |
// namespace quota changes for parent directory | |
String bucketKey = omMetadataManager.getBucketKey( | |
omBucketInfo.getVolumeName(), | |
omBucketInfo.getBucketName()); | |
omMetadataManager.getBucketTable().putWithBatch(batchOperation, | |
bucketKey, omBucketInfo); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SaketaChalamchala Thanks for the patch, Please find the comment below.
Only cache entry should be added in request and db insert should be done in response.
final String parentKey = omMetadataManager.getOzonePathKey( | ||
volumeId, bucketId, parentDirInfo.getParentObjectID(), | ||
parentDirInfo.getName()); | ||
omMetadataManager.getDirectoryTable().putWithBatch(batchOperation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be done in S3MultipartUploadCompleteResponseWithFSO instead here or else db entry will be added only on the leader OM.
try (BatchOperation batchOperation = omMetadataManager.getStore() | ||
.initBatchOperation()) { | ||
|
||
OMFileRequest.addToOpenFileTableForMultipart(omMetadataManager, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even this should be done in S3MultipartUploadCompleteResponseWithFSO instead here.
@adoroszlai and @ashishkumar50 updated the patch based on your comments. Please let me know if you have any more comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @SaketaChalamchala for updating the patch, LGTM. Also tested with ITestS3ACommitterMRJob
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SaketaChalamchala Thanks for updating patch, Change LGTM.
Thanks @SaketaChalamchala for the patch, @ashishkumar50 for the review. |
…nd complete MPU (apache#6496) (cherry picked from commit c1b27a8)
…nd complete MPU (apache#6496) (cherry picked from commit c1b27a8)
…nd complete MPU (apache#6496) (cherry picked from commit c1b27a8)
…nd complete MPU (apache#6496) (cherry picked from commit c1b27a8)
…nd complete MPU (apache#6496) (cherry picked from commit c1b27a8)
…s deleted between initiate and complete MPU (apache#6496) (cherry picked from commit c1b27a8) Change-Id: I365ea43497bf47d5c00570c665f2c293e73f4c09
What changes were proposed in this pull request?
S3a provides multiple mapreduce committers. When using the directory staging committer
fs.s3a.committer.name=directory
with replace conflict modefs.s3a.committer.staging.conflict-mode=replace
and writing to FSO buckets, the job fails with the following errors.This is because the logic to add back missing parent directories and missing output prefix directories similar to Initiate MPU request (S3InitiateMultipartUploadRequestWithFSO.java, S3InitiateMultipartUploadResponseWithFSO.java) is missing in the Complete MPU request.
The proposed solution adds the missing parent and output prefix directories back to DB before completing the MPU.
Errors:
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10630
How was this patch tested?
Ran the s3a hadoop contract test
ITestS3ACommitterMRJob
to verify. There is another PR out to add s3a contract tests to acceptance testing.