Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-7749

Review and fix all incorrect usage of openKeyTable and openFileTable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Ozone Manager

    Description

      The current open key/open file design is very brittle. I found several places where incorrect key name are used.

      Review these and fix them asap.

       

      ozone/KeyManagerImpl.java at 2ba8bb71f128ec619c5bed9b6303394e8677bf53 · apache/ozone

      String objectKey = metadataManager.getOzoneKey(volume, bucket, keyName);

      metadataManager.getOpenKeyTable(bucketLayout).get(objectKey);

      objectKey is not in the the format of an open key name.

      ozone/S3MultipartUploadCommitPartRequest.java at ca2d59bde4614a8fde5beabd2e81ebf022bed2ac · apache/ozone

       

      {{omMetadataManager.getOpenKeyTable(getBucketLayout()).addCacheEntry(
      new CacheKey<>(openKey),
      new CacheValue<>(Optional.absent(), trxnLogIndex));}}

      multipart upload request does not add openKey to open key table. Instead, it uses multipartkey.

      ozone/S3MultipartUploadCommitPartRequest.java at ca2d59bde4614a8fde5beabd2e81ebf022bed2ac · apache/ozone

       

      {{protected OmKeyInfo getOmKeyInfo(OMMetadataManager omMetadataManager,
      String openKey, String keyName) throws IOException

      { return omMetadataManager.getOpenKeyTable(getBucketLayout()).get(openKey); }

      }}

      this code looks suspicious. Again, multipart upload request does not use openKey in the open table. So why is this needed at all?

      ozone/TestS3MultipartUploadCommitPartResponseWithFSO.java at 576a3ebc0ae180bf96e05e1b0ee829f5cb000b45 · apache/ozone

       

      {{Assert.assertNull(
      omMetadataManager.getOpenKeyTable(getBucketLayout()).get(openKey));}}

      looks suspicious. Again, openKey are supposedly not used and shouldn’t need to check.

      ozone/TestS3MultipartUploadCompleteResponseWithFSO.java at 576a3ebc0ae180bf96e05e1b0ee829f5cb000b45 · apache/ozone

       

      {{Assert.assertNull(
      omMetadataManager.getOpenKeyTable(getBucketLayout()).get(multipartKey));}}

      Again, a “multiplartOpenKey” should be used instead.

      ozone/OMFileRequest.java at 179755eab0913ffa8fe32f3ccb3316f8bfc19486 · apache/ozone

       

      {{/**

      • Adding multipart omKeyInfo to open file table.
        *
        *@paramomMetadataMgrOM Metadata Manager
        *@parambatchOpbatch of db operations
        *@paramomFileInfoomKeyInfo
        *@paramuploadIDuploadID
        *@returnmultipartFileKey
        *@throwsIOException DB failure
        */
        public static String addToOpenFileTable(OMMetadataManager omMetadataMgr,
        BatchOperation batchOp, OmKeyInfo omFileInfo, String uploadID,
        long volumeId, long bucketId) throws IOException {}}

      ozone/OMMetadataManager.java at 5eead92666b374c4bb912f332488acb23f9a81df · apache/ozone

       

      {{/**

      • Returns the DB key name of a multipart upload key in OM metadata store.
        *
        *@paramvolumeId- ID of the volume
        *@parambucketId- ID of the bucket
        *@paramparentObjectId- parent object Id
        *@paramfileName- file name
        *@paramuploadId- the upload id for this key
        *@returnbytes of DB key.
        */
        String getMultipartKey(long volumeId, long bucketId,
        long parentObjectId, String fileName,
        String uploadId);}}

      This API is used by FSO only. Need to make it clear.

      Attachments

        Activity

          People

            tejaswiniv99 Tejaswini Vakkalagaddi
            weichiu Wei-Chiu Chuang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: