priyeshkaratha commented on code in PR #10949:
URL: https://github.com/apache/ozone/pull/10949#discussion_r3755368163
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -1109,55 +1109,103 @@ private void processMultipartUploads(OmBucketInfo
bucketInfo, List<OmLCRule> rul
upload.setCreationTime(Instant.ofEpochMilli(mpuKeyInfo.getCreationTime()));
String keyName = upload.getKeyName();
- String multipartOpenKey;
- try {
- multipartOpenKey = OMMultipartUploadUtils.getMultipartOpenKey(
- volumeName, bucketName, keyName, upload.getUploadId(),
- omMetadataManager, bucketInfo.getBucketLayout());
- } catch (OMException e) {
- LOG.warn("Failed to get multipart open key for {}/{}/{}, skipping",
- volumeName, bucketName, keyName, e);
- continue;
+ OmLCRule matchedRuleWithoutTags = null;
+ boolean needsTagMatch = false;
+ for (OmLCRule rule : ruleList) {
+ if (!passesAgeAndPrefix(upload, keyName, rule)) {
+ continue;
+ }
+ if (!rule.isTagEnable()) {
+ matchedRuleWithoutTags = rule;
+ break;
+ }
+ needsTagMatch = true;
}
- OmKeyInfo openKeyInfo =
omMetadataManager.getOpenKeyTable(bucketInfo.getBucketLayout())
- .get(multipartOpenKey);
- if (openKeyInfo == null) {
- LOG.warn("Open key not found for multipart upload {}/{}/{},
skipping",
- volumeName, bucketName, keyName);
+ if (matchedRuleWithoutTags == null && !needsTagMatch) {
continue;
}
- for (OmLCRule rule : ruleList) {
- if (shouldAbortUpload(openKeyInfo, upload, keyName, rule)) {
- if (expiredUploads.isFull()) {
- LOG.info("Multipart upload batch reached part count limit {},
aborting current batch " +
- "({} uploads, {} parts) for bucket {}/{}",
- mpuAbortLimitPerTask, expiredUploads.size(),
expiredUploads.getPartCount(),
- volumeName, bucketName);
- abortExpiredMultipartUploadsAndClear(bucketInfo,
expiredUploads);
- }
+ OmLCRule matchingRule = matchedRuleWithoutTags;
- // Split-schema MPUs keep parts in multipartPartsTable (the
embedded map
- // is empty); legacy MPUs use the embedded map. An MPU with no
uploaded
- // parts is valid (S3 allows aborting it with an empty parts
list).
- int uploadedParts;
- try {
- uploadedParts = mpuKeyInfo.getSchemaVersion()
- == OmMultipartKeyInfo.SPLIT_PARTS_TABLE_SCHEMA_VERSION
- ? OMMultipartUploadUtils.countParts(omMetadataManager,
upload.getUploadId())
- : mpuKeyInfo.getPartKeyInfoMap().size();
- } catch (IOException e) {
- LOG.warn("Failed to count parts for MPU {}/{}/{} uploadId {},
skipping",
- volumeName, bucketName, keyName, upload.getUploadId(), e);
- break;
+ if (matchingRule == null) {
+ String multipartOpenKey;
+ try {
+ multipartOpenKey = OMMultipartUploadUtils.getMultipartOpenKey(
+ volumeName, bucketName, keyName, upload.getUploadId(),
+ omMetadataManager, bucketInfo.getBucketLayout());
+ } catch (OMException e) {
+ LOG.warn("Failed to get multipart open key for {}/{}/{},
skipping",
+ volumeName, bucketName, keyName, e);
+ continue;
+ }
+
+ OmKeyInfo openKeyInfo;
+ try {
+ openKeyInfo =
omMetadataManager.getOpenKeyTable(bucketInfo.getBucketLayout())
+ .get(multipartOpenKey);
+ } catch (IOException e) {
+ LOG.warn("Failed to read open key table for {}/{}/{}, skipping",
+ volumeName, bucketName, keyName, e);
+ continue;
+ }
+
+ if (openKeyInfo == null) {
+ for (OmLCRule rule : ruleList) {
Review Comment:
Good catch. Updated the PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]