Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
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.
{{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.
{{protected OmKeyInfo getOmKeyInfo(OMMetadataManager omMetadataManager,
String openKey, String keyName) throws IOException
}}
this code looks suspicious. Again, multipart upload request does not use openKey in the open table. So why is this needed at all?
{{Assert.assertNull(
omMetadataManager.getOpenKeyTable(getBucketLayout()).get(openKey));}}
looks suspicious. Again, openKey are supposedly not used and shouldn’t need to check.
{{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.