adoroszlai commented on code in PR #6496:
URL: https://github.com/apache/ozone/pull/6496#discussion_r1558836072
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/multipart/S3MultipartUploadCompleteRequestWithFSO.java:
##########
@@ -74,6 +77,70 @@ protected void checkDirectoryAlreadyExists(OzoneManager
ozoneManager,
}
}
+ @Override
+ protected void addMissingParentsToTable(OmBucketInfo omBucketInfo,
+ List<OmDirectoryInfo> missingParentInfos,
+ OMMetadataManager omMetadataManager, long volumeId, long bucketId,
+ long transactionLogIndex) throws IOException {
+
+ // validate and update namespace for missing parent directory.
+ checkBucketQuotaInNamespace(omBucketInfo, missingParentInfos.size());
+ omBucketInfo.incrUsedNamespace(missingParentInfos.size());
+
+ // Add cache entries for the missing parent directories.
+ OMFileRequest.addDirectoryTableCacheEntries(omMetadataManager,
+ volumeId, bucketId, transactionLogIndex,
+ missingParentInfos, null);
+
+ // 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);
+ }
Review Comment:
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.
https://github.com/apache/ozone/blob/06c0d81af229d66cbb0464e74dda67b73095d106/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/s3/multipart/S3InitiateMultipartUploadResponseWithFSO.java#L79-L102
--
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]