Search in sources :

Example 1 with MultipartUploadCompleteRequest

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest in project ozone by apache.

the class S3MultipartUploadCompleteRequest method validateAndUpdateCache.

@Override
@SuppressWarnings("methodlength")
public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager, long trxnLogIndex, OzoneManagerDoubleBufferHelper omDoubleBufferHelper) {
    MultipartUploadCompleteRequest multipartUploadCompleteRequest = getOmRequest().getCompleteMultiPartUploadRequest();
    KeyArgs keyArgs = multipartUploadCompleteRequest.getKeyArgs();
    List<OzoneManagerProtocolProtos.Part> partsList = multipartUploadCompleteRequest.getPartsListList();
    Map<String, String> auditMap = buildKeyArgsAuditMap(keyArgs);
    String volumeName = keyArgs.getVolumeName();
    String bucketName = keyArgs.getBucketName();
    final String requestedVolume = volumeName;
    final String requestedBucket = bucketName;
    String keyName = keyArgs.getKeyName();
    String uploadID = keyArgs.getMultipartUploadID();
    String multipartKey = null;
    ozoneManager.getMetrics().incNumCompleteMultipartUploads();
    OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager();
    boolean acquiredLock = false;
    OMResponse.Builder omResponse = OmResponseUtil.getOMResponseBuilder(getOmRequest());
    OMClientResponse omClientResponse = null;
    IOException exception = null;
    Result result = null;
    try {
        keyArgs = resolveBucketLink(ozoneManager, keyArgs, auditMap);
        volumeName = keyArgs.getVolumeName();
        bucketName = keyArgs.getBucketName();
        multipartKey = omMetadataManager.getMultipartKey(volumeName, bucketName, keyName, uploadID);
        // check Acl
        checkKeyAcls(ozoneManager, volumeName, bucketName, keyName, IAccessAuthorizer.ACLType.WRITE, OzoneObj.ResourceType.KEY);
        acquiredLock = omMetadataManager.getLock().acquireWriteLock(BUCKET_LOCK, volumeName, bucketName);
        validateBucketAndVolume(omMetadataManager, volumeName, bucketName);
        OmBucketInfo omBucketInfo = getBucketInfo(omMetadataManager, volumeName, bucketName);
        String ozoneKey = omMetadataManager.getOzoneKey(volumeName, bucketName, keyName);
        String dbOzoneKey = getDBOzoneKey(omMetadataManager, volumeName, bucketName, keyName);
        String dbMultipartOpenKey = getDBMultipartOpenKey(volumeName, bucketName, keyName, uploadID, omMetadataManager);
        OmMultipartKeyInfo multipartKeyInfo = omMetadataManager.getMultipartInfoTable().get(multipartKey);
        // Check for directory exists with same name, if it exists throw error.
        checkDirectoryAlreadyExists(ozoneManager, volumeName, bucketName, keyName, omMetadataManager);
        if (multipartKeyInfo == null) {
            throw new OMException(failureMessage(requestedVolume, requestedBucket, keyName), OMException.ResultCodes.NO_SUCH_MULTIPART_UPLOAD_ERROR);
        }
        TreeMap<Integer, PartKeyInfo> partKeyInfoMap = multipartKeyInfo.getPartKeyInfoMap();
        if (partsList.size() > 0) {
            if (partKeyInfoMap.size() == 0) {
                LOG.error("Complete MultipartUpload failed for key {} , MPU Key has" + " no parts in OM, parts given to upload are {}", ozoneKey, partsList);
                throw new OMException(failureMessage(requestedVolume, requestedBucket, keyName), OMException.ResultCodes.INVALID_PART);
            }
            // First Check for Invalid Part Order.
            List<Integer> partNumbers = new ArrayList<>();
            int partsListSize = getPartsListSize(requestedVolume, requestedBucket, keyName, ozoneKey, partNumbers, partsList);
            List<OmKeyLocationInfo> partLocationInfos = new ArrayList<>();
            long dataSize = getMultipartDataSize(requestedVolume, requestedBucket, keyName, ozoneKey, partKeyInfoMap, partsListSize, partLocationInfos, partsList, ozoneManager);
            // All parts have same replication information. Here getting from last
            // part.
            OmKeyInfo omKeyInfo = getOmKeyInfo(ozoneManager, trxnLogIndex, keyArgs, volumeName, bucketName, keyName, dbMultipartOpenKey, omMetadataManager, dbOzoneKey, partKeyInfoMap, partLocationInfos, dataSize);
            // Find all unused parts.
            List<OmKeyInfo> unUsedParts = new ArrayList<>();
            for (Map.Entry<Integer, PartKeyInfo> partKeyInfo : partKeyInfoMap.entrySet()) {
                if (!partNumbers.contains(partKeyInfo.getKey())) {
                    unUsedParts.add(OmKeyInfo.getFromProtobuf(partKeyInfo.getValue().getPartKeyInfo()));
                }
            }
            // If bucket versioning is turned on during the update, between key
            // creation and key commit, old versions will be just overwritten and
            // not kept. Bucket versioning will be effective from the first key
            // creation after the knob turned on.
            RepeatedOmKeyInfo oldKeyVersionsToDelete = null;
            OmKeyInfo keyToDelete = omMetadataManager.getKeyTable(getBucketLayout()).get(dbOzoneKey);
            long usedBytesDiff = 0;
            boolean isNamespaceUpdate = false;
            if (keyToDelete != null && !omBucketInfo.getIsVersionEnabled()) {
                oldKeyVersionsToDelete = getOldVersionsToCleanUp(dbOzoneKey, keyToDelete, omMetadataManager, trxnLogIndex, ozoneManager.isRatisEnabled());
                long numCopy = keyToDelete.getReplicationConfig().getRequiredNodes();
                usedBytesDiff -= keyToDelete.getDataSize() * numCopy;
            } else {
                checkBucketQuotaInNamespace(omBucketInfo, 1L);
                omBucketInfo.incrUsedNamespace(1L);
                isNamespaceUpdate = true;
            }
            String dbBucketKey = omMetadataManager.getBucketKey(omBucketInfo.getVolumeName(), omBucketInfo.getBucketName());
            if (usedBytesDiff != 0) {
                omBucketInfo.incrUsedBytes(usedBytesDiff);
            } else if (!isNamespaceUpdate) {
                // If no bucket size and Namespace changed, prevent from updating
                // bucket object.
                omBucketInfo = null;
            }
            updateCache(omMetadataManager, dbBucketKey, omBucketInfo, dbOzoneKey, dbMultipartOpenKey, multipartKey, omKeyInfo, trxnLogIndex);
            if (oldKeyVersionsToDelete != null) {
                OMFileRequest.addDeletedTableCacheEntry(omMetadataManager, dbOzoneKey, oldKeyVersionsToDelete, trxnLogIndex);
            }
            omResponse.setCompleteMultiPartUploadResponse(MultipartUploadCompleteResponse.newBuilder().setVolume(requestedVolume).setBucket(requestedBucket).setKey(keyName).setHash(DigestUtils.sha256Hex(keyName)));
            omClientResponse = getOmClientResponse(multipartKey, omResponse, dbMultipartOpenKey, omKeyInfo, unUsedParts, omBucketInfo, oldKeyVersionsToDelete);
            result = Result.SUCCESS;
        } else {
            throw new OMException(failureMessage(requestedVolume, requestedBucket, keyName) + " because of empty part list", OMException.ResultCodes.INVALID_REQUEST);
        }
    } catch (IOException ex) {
        result = Result.FAILURE;
        exception = ex;
        omClientResponse = getOmClientResponse(omResponse, exception);
    } finally {
        addResponseToDoubleBuffer(trxnLogIndex, omClientResponse, omDoubleBufferHelper);
        if (acquiredLock) {
            omMetadataManager.getLock().releaseWriteLock(BUCKET_LOCK, volumeName, bucketName);
        }
    }
    logResult(ozoneManager, multipartUploadCompleteRequest, partsList, auditMap, volumeName, bucketName, keyName, exception, result);
    return omClientResponse;
}
Also used : OmBucketInfo(org.apache.hadoop.ozone.om.helpers.OmBucketInfo) MultipartUploadCompleteRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest) ArrayList(java.util.ArrayList) OmKeyInfo(org.apache.hadoop.ozone.om.helpers.OmKeyInfo) RepeatedOmKeyInfo(org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo) OMClientResponse(org.apache.hadoop.ozone.om.response.OMClientResponse) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs) IOException(java.io.IOException) OmKeyLocationInfo(org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo) OMResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse) RepeatedOmKeyInfo(org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo) OmMultipartKeyInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartKeyInfo) OMMetadataManager(org.apache.hadoop.ozone.om.OMMetadataManager) PartKeyInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PartKeyInfo) OMException(org.apache.hadoop.ozone.om.exceptions.OMException) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 2 with MultipartUploadCompleteRequest

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest in project ozone by apache.

the class OzoneManagerProtocolClientSideTranslatorPB method completeMultipartUpload.

@Override
public OmMultipartUploadCompleteInfo completeMultipartUpload(OmKeyArgs omKeyArgs, OmMultipartUploadCompleteList multipartUploadList) throws IOException {
    MultipartUploadCompleteRequest.Builder multipartUploadCompleteRequest = MultipartUploadCompleteRequest.newBuilder();
    KeyArgs.Builder keyArgs = KeyArgs.newBuilder().setVolumeName(omKeyArgs.getVolumeName()).setBucketName(omKeyArgs.getBucketName()).setKeyName(omKeyArgs.getKeyName()).addAllAcls(omKeyArgs.getAcls().stream().map(a -> OzoneAcl.toProtobuf(a)).collect(Collectors.toList())).setMultipartUploadID(omKeyArgs.getMultipartUploadID());
    multipartUploadCompleteRequest.setKeyArgs(keyArgs.build());
    multipartUploadCompleteRequest.addAllPartsList(multipartUploadList.getPartsList());
    OMRequest omRequest = createOMRequest(Type.CompleteMultiPartUpload).setCompleteMultiPartUploadRequest(multipartUploadCompleteRequest.build()).build();
    MultipartUploadCompleteResponse response = handleError(submitRequest(omRequest)).getCompleteMultiPartUploadResponse();
    OmMultipartUploadCompleteInfo info = new OmMultipartUploadCompleteInfo(response.getVolume(), response.getBucket(), response.getKey(), response.getHash());
    return info;
}
Also used : GetDelegationTokenResponseProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetDelegationTokenResponseProto) GetS3VolumeContextResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetS3VolumeContextResponse) OmMultipartCommitUploadPartInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartCommitUploadPartInfo) Text(org.apache.hadoop.io.Text) ServiceInfo(org.apache.hadoop.ozone.om.helpers.ServiceInfo) DeleteKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyRequest) TenantAssignUserAccessIdResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantAssignUserAccessIdResponse) OmDeleteKeys(org.apache.hadoop.ozone.om.helpers.OmDeleteKeys) FinalizeUpgradeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeRequest) AllocateBlockRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AllocateBlockRequest) LookupFileRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupFileRequest) ListKeysResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysResponse) TenantListUserResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserResponse) GetFileStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusRequest) Map(java.util.Map) DBUpdates(org.apache.hadoop.ozone.om.helpers.DBUpdates) OzoneManagerProtocolProtos(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos) GetS3SecretResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetS3SecretResponse) TenantUserList(org.apache.hadoop.ozone.om.helpers.TenantUserList) MultipartUploadListPartsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadListPartsRequest) OmRenameKeys(org.apache.hadoop.ozone.om.helpers.OmRenameKeys) CancelDelegationTokenRequestProto(org.apache.hadoop.ozone.security.proto.SecurityProtos.CancelDelegationTokenRequestProto) GetS3VolumeContextRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetS3VolumeContextRequest) SetBucketPropertyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetBucketPropertyRequest) SetS3SecretResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetS3SecretResponse) AddAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclRequest) CommitKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CommitKeyRequest) MultipartCommitUploadPartResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartCommitUploadPartResponse) OK(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.OK) OmBucketInfo(org.apache.hadoop.ozone.om.helpers.OmBucketInfo) MultipartUploadCompleteResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteResponse) CreateFileResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateFileResponse) OzoneFileStatusProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneFileStatusProto) RevokeS3SecretRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RevokeS3SecretRequest) CheckVolumeAccessRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CheckVolumeAccessRequest) KeyValueUtil(org.apache.hadoop.ozone.om.helpers.KeyValueUtil) SetBucketPropertyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetBucketPropertyResponse) TenantUserInfoValue(org.apache.hadoop.ozone.om.helpers.TenantUserInfoValue) BucketInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.BucketInfo) CancelPrepareResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CancelPrepareResponse) AllocateBlockResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AllocateBlockResponse) OMPBHelper(org.apache.hadoop.ozone.protocolPB.OMPBHelper) CreateBucketRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateBucketRequest) PrepareResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareResponse) GetS3SecretRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetS3SecretRequest) ExcludeList(org.apache.hadoop.hdds.scm.container.common.helpers.ExcludeList) AddAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclResponse) RenameKeysRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenameKeysRequest) Type(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type) GetAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclResponse) DeleteTenantRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteTenantRequest) OzoneAclInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneAclInfo) DeleteTenantState(org.apache.hadoop.ozone.om.helpers.DeleteTenantState) MultipartInfoInitiateResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartInfoInitiateResponse) ListBucketsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsResponse) TenantListUserRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserRequest) TenantRevokeAdminRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantRevokeAdminRequest) CreateVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateVolumeRequest) DeleteVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteVolumeRequest) RecoverTrashResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RecoverTrashResponse) S3Secret(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.S3Secret) OmMultipartUploadListParts(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts) SetVolumePropertyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetVolumePropertyResponse) TenantAssignAdminRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantAssignAdminRequest) CancelPrepareRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CancelPrepareRequest) S3Auth(org.apache.hadoop.ozone.om.protocol.S3Auth) GetAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclRequest) SetVolumePropertyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetVolumePropertyRequest) InfoVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeRequest) ArrayList(java.util.ArrayList) ListMultipartUploadsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse) Strings(com.google.common.base.Strings) RenewDelegationTokenResponseProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenewDelegationTokenResponseProto) SetAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetAclResponse) OMResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse) DeleteBucketRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteBucketRequest) PrepareRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareRequest) GetDelegationTokenRequestProto(org.apache.hadoop.ozone.security.proto.SecurityProtos.GetDelegationTokenRequestProto) OmMultipartInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartInfo) CreateTenantRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateTenantRequest) OpenKeySession(org.apache.hadoop.ozone.om.helpers.OpenKeySession) ReplicationConfig(org.apache.hadoop.hdds.client.ReplicationConfig) IOException(java.io.IOException) OmTenantArgs(org.apache.hadoop.ozone.om.helpers.OmTenantArgs) PrepareRequestArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareRequestArgs) Token(org.apache.hadoop.security.token.Token) ListBucketsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsRequest) ListTenantResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTenantResponse) InterfaceAudience(org.apache.hadoop.hdds.annotation.InterfaceAudience) CreateFileRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateFileRequest) MultipartUploadAbortRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadAbortRequest) TenantAssignUserAccessIdRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantAssignUserAccessIdRequest) RenewDelegationTokenRequestProto(org.apache.hadoop.ozone.security.proto.SecurityProtos.RenewDelegationTokenRequestProto) RenameKeysArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenameKeysArgs) SetS3SecretRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetS3SecretRequest) Preconditions(com.google.common.base.Preconditions) TenantStateList(org.apache.hadoop.ozone.om.helpers.TenantStateList) OmMultipartUploadCompleteList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteList) GetFileStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusResponse) VolumeInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.VolumeInfo) UpgradeFinalizer(org.apache.hadoop.ozone.upgrade.UpgradeFinalizer) MultipartCommitUploadPartRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartCommitUploadPartRequest) DeleteTenantResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteTenantResponse) OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs) ListStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusRequest) CreateDirectoryRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateDirectoryRequest) OzoneFileStatus(org.apache.hadoop.ozone.om.helpers.OzoneFileStatus) ListTrashRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashRequest) StatusAndMessages(org.apache.hadoop.ozone.upgrade.UpgradeFinalizer.StatusAndMessages) TenantRevokeUserAccessIdRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantRevokeUserAccessIdRequest) OzoneTokenIdentifier(org.apache.hadoop.ozone.security.OzoneTokenIdentifier) OzoneAcl(org.apache.hadoop.ozone.OzoneAcl) OmMultipartUpload(org.apache.hadoop.ozone.om.helpers.OmMultipartUpload) TenantGetUserInfoRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantGetUserInfoRequest) S3VolumeContext(org.apache.hadoop.ozone.om.helpers.S3VolumeContext) LookupKeyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupKeyResponse) ListStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusResponse) OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) TenantGetUserInfoResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantGetUserInfoResponse) ListTrashResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashResponse) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) DBUpdatesResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesResponse) FinalizeUpgradeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeResponse) ByteString(com.google.protobuf.ByteString) List(java.util.List) ServiceListRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListRequest) OMException(org.apache.hadoop.ozone.om.exceptions.OMException) OmMultipartUploadCompleteInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteInfo) ClientVersion(org.apache.hadoop.ozone.ClientVersion) OzoneObj(org.apache.hadoop.ozone.security.acl.OzoneObj) ListVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeRequest) LookupFileResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupFileResponse) MultipartUploadCompleteRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest) DIRECTORY_ALREADY_EXISTS(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.DIRECTORY_ALREADY_EXISTS) ServiceInfoEx(org.apache.hadoop.ozone.om.helpers.ServiceInfoEx) DeleteKeysRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeysRequest) ListTenantRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTenantRequest) CreateKeyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateKeyResponse) PrepareStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusRequest) DeleteKeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyArgs) ServiceListResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListResponse) RenameKeysMap(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenameKeysMap) LookupKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupKeyRequest) UpgradeFinalizationStatus(org.apache.hadoop.hdds.protocol.proto.HddsProtos.UpgradeFinalizationStatus) ResultCodes(org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes) ACCESS_DENIED(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.ACCESS_DENIED) SetAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetAclRequest) DBUpdatesRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesRequest) OmMultipartUploadList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList) InfoBucketRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketRequest) TOKEN_ERROR_OTHER(org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.TOKEN_ERROR_OTHER) OmKeyInfo(org.apache.hadoop.ozone.om.helpers.OmKeyInfo) OmKeyLocationInfo(org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo) S3SecretValue(org.apache.hadoop.ozone.om.helpers.S3SecretValue) MultipartInfoInitiateRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartInfoInitiateRequest) FinalizeUpgradeProgressRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressRequest) OmBucketArgs(org.apache.hadoop.ozone.om.helpers.OmBucketArgs) CancelDelegationTokenResponseProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CancelDelegationTokenResponseProto) S3Authentication(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.S3Authentication) InfoVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeResponse) RecoverTrashRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RecoverTrashRequest) BucketArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.BucketArgs) CreateKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateKeyRequest) InfoBucketResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketResponse) ListKeysRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysRequest) ECReplicationConfig(org.apache.hadoop.hdds.client.ECReplicationConfig) OmVolumeArgs(org.apache.hadoop.ozone.om.helpers.OmVolumeArgs) RenameKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenameKeyRequest) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs) MultipartUploadListPartsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadListPartsResponse) RepeatedOmKeyInfo(org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo) FinalizeUpgradeProgressResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressResponse) TracingUtil(org.apache.hadoop.hdds.tracing.TracingUtil) RemoveAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RemoveAclResponse) ListVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeResponse) PrepareStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusResponse) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ListMultipartUploadsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsRequest) RemoveAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RemoveAclRequest) MultipartUploadCompleteRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest) OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OmMultipartUploadCompleteInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteInfo) OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs) DeleteKeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyArgs) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs) MultipartUploadCompleteResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteResponse)

Example 3 with MultipartUploadCompleteRequest

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest in project ozone by apache.

the class OMRequestTestUtils method createCompleteMPURequest.

public static OMRequest createCompleteMPURequest(String volumeName, String bucketName, String keyName, String multipartUploadID, List<OzoneManagerProtocolProtos.Part> partList) {
    KeyArgs.Builder keyArgs = KeyArgs.newBuilder().setVolumeName(volumeName).setKeyName(keyName).setBucketName(bucketName).setMultipartUploadID(multipartUploadID);
    MultipartUploadCompleteRequest multipartUploadCompleteRequest = MultipartUploadCompleteRequest.newBuilder().setKeyArgs(keyArgs).addAllPartsList(partList).build();
    return OMRequest.newBuilder().setClientId(UUID.randomUUID().toString()).setCmdType(OzoneManagerProtocolProtos.Type.CompleteMultiPartUpload).setCompleteMultiPartUploadRequest(multipartUploadCompleteRequest).build();
}
Also used : MultipartUploadCompleteRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)

Example 4 with MultipartUploadCompleteRequest

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest in project ozone by apache.

the class S3MultipartUploadCompleteRequest method preExecute.

@Override
public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
    MultipartUploadCompleteRequest multipartUploadCompleteRequest = getOmRequest().getCompleteMultiPartUploadRequest();
    KeyArgs keyArgs = multipartUploadCompleteRequest.getKeyArgs();
    String keyPath = keyArgs.getKeyName();
    keyPath = validateAndNormalizeKey(ozoneManager.getEnableFileSystemPaths(), keyPath, getBucketLayout());
    return getOmRequest().toBuilder().setCompleteMultiPartUploadRequest(multipartUploadCompleteRequest.toBuilder().setKeyArgs(keyArgs.toBuilder().setModificationTime(Time.now()).setKeyName(keyPath))).setUserInfo(getUserInfo()).build();
}
Also used : MultipartUploadCompleteRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)

Aggregations

KeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)4 MultipartUploadCompleteRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest)4 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 OMException (org.apache.hadoop.ozone.om.exceptions.OMException)2 OmBucketInfo (org.apache.hadoop.ozone.om.helpers.OmBucketInfo)2 OmKeyInfo (org.apache.hadoop.ozone.om.helpers.OmKeyInfo)2 OmKeyLocationInfo (org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions (com.google.common.base.Preconditions)1 Strings (com.google.common.base.Strings)1 ByteString (com.google.protobuf.ByteString)1 Instant (java.time.Instant)1 List (java.util.List)1 TreeMap (java.util.TreeMap)1 Collectors (java.util.stream.Collectors)1 InterfaceAudience (org.apache.hadoop.hdds.annotation.InterfaceAudience)1 ECReplicationConfig (org.apache.hadoop.hdds.client.ECReplicationConfig)1 ReplicationConfig (org.apache.hadoop.hdds.client.ReplicationConfig)1